@@ -38,21 +38,23 @@ use self::{
3838 render_pass:: RenderPass ,
3939} ;
4040
41+ /// A RenderContext is a localized rendering context that can be used to render
42+ /// to a window. It is localized to a single window at the moment.
4143pub struct RenderContextBuilder {
4244 name : String ,
4345 render_timeout : u64 ,
4446}
4547
4648impl RenderContextBuilder {
47- /// Create a new localized RenderContext
49+ /// Create a new localized RenderContext with the given name.
4850 pub fn new ( name : & str ) -> Self {
4951 return Self {
5052 name : name. to_string ( ) ,
5153 render_timeout : 1_000_000_000 ,
5254 } ;
5355 }
5456
55- /// The time rendering has to complete before timing out .
57+ /// The time rendering has to complete before a timeout occurs .
5658 pub fn with_render_timeout ( mut self , render_timeout : u64 ) -> Self {
5759 self . render_timeout = render_timeout;
5860 return self ;
@@ -69,7 +71,7 @@ impl RenderContextBuilder {
6971
7072 let mut instance = internal:: InstanceBuilder :: new ( )
7173 . build :: < internal:: RenderBackend > ( name. as_str ( ) ) ;
72- let mut surface = Rc :: new (
74+ let surface = Rc :: new (
7375 internal:: SurfaceBuilder :: new ( ) . build ( & instance, window. window_handle ( ) ) ,
7476 ) ;
7577
@@ -90,10 +92,6 @@ impl RenderContextBuilder {
9092 let render_semaphore =
9193 internal:: RenderSemaphoreBuilder :: new ( ) . build ( & mut gpu) ;
9294
93- // Create the image extent and initial frame buffer attachment description
94- // for rendering.
95- let ( width, height) = window. dimensions ( ) ;
96-
9795 return RenderContext {
9896 name,
9997 instance,
@@ -305,10 +303,14 @@ impl RenderContext {
305303 }
306304 }
307305
306+ /// Get the render pass with the resource ID that was provided upon
307+ /// attachment.
308308 pub fn get_render_pass ( & self , id : ResourceId ) -> & RenderPass {
309309 return & self . render_passes [ id] ;
310310 }
311311
312+ /// Get the render pipeline with the resource ID that was provided upon
313+ /// attachment.
312314 pub fn get_render_pipeline ( & mut self , id : ResourceId ) -> & RenderPipeline {
313315 return & self . render_pipelines [ id] ;
314316 }
0 commit comments