@@ -23,6 +23,7 @@ pub(crate) struct RenderState {
2323 bind_group : Option < wgpu:: BindGroup > ,
2424 #[ derivative( Debug = "ignore" ) ]
2525 overlays_scene : Option < vello:: Scene > ,
26+ surface_outdated : bool ,
2627}
2728
2829impl RenderState {
@@ -186,6 +187,7 @@ impl RenderState {
186187 ui_texture : None ,
187188 bind_group : None ,
188189 overlays_scene : None ,
190+ surface_outdated : true ,
189191 }
190192 }
191193
@@ -196,6 +198,7 @@ impl RenderState {
196198
197199 self . desired_width = width;
198200 self . desired_height = height;
201+ self . surface_outdated = true ;
199202
200203 if width > 0 && height > 0 && ( self . config . width != width || self . config . height != height) {
201204 self . config . width = width;
@@ -244,6 +247,9 @@ impl RenderState {
244247 }
245248
246249 pub ( crate ) fn render ( & mut self , window : & Window ) -> Result < ( ) , RenderError > {
250+ if !self . surface_outdated {
251+ return Ok ( ( ) ) ;
252+ }
247253 let ui_scale = if let Some ( ui_texture) = & self . ui_texture
248254 && ( self . desired_width != ui_texture. width ( ) || self . desired_height != ui_texture. height ( ) )
249255 {
@@ -305,11 +311,13 @@ impl RenderState {
305311 if ui_scale. is_some ( ) {
306312 return Err ( RenderError :: OutdatedUITextureError ) ;
307313 }
314+ self . surface_outdated = false ;
308315
309316 Ok ( ( ) )
310317 }
311318
312319 fn update_bindgroup ( & mut self ) {
320+ self . surface_outdated = true ;
313321 let viewport_texture_view = self . viewport_texture . as_ref ( ) . unwrap_or ( & self . transparent_texture ) . create_view ( & wgpu:: TextureViewDescriptor :: default ( ) ) ;
314322 let overlays_texture_view = self
315323 . overlays_texture
0 commit comments