diff --git a/crates/gpui_wgpu/src/wgpu_renderer.rs b/crates/gpui_wgpu/src/wgpu_renderer.rs index d8ed5155c9d652d8b8f24d66d26447a744afa5b0..468f4e11b272a2a80f261bfef187785ff66f7756 100644 --- a/crates/gpui_wgpu/src/wgpu_renderer.rs +++ b/crates/gpui_wgpu/src/wgpu_renderer.rs @@ -97,7 +97,6 @@ pub struct WgpuRenderer { queue: Arc, surface: wgpu::Surface<'static>, surface_config: wgpu::SurfaceConfiguration, - surface_configured: bool, pipelines: WgpuPipelines, bind_group_layouts: WgpuBindGroupLayouts, atlas: Arc, @@ -364,7 +363,6 @@ impl WgpuRenderer { queue, surface, surface_config, - surface_configured: true, pipelines, bind_group_layouts, atlas, @@ -834,9 +832,7 @@ impl WgpuRenderer { self.surface_config.width = clamped_width.max(1); self.surface_config.height = clamped_height.max(1); - if self.surface_configured { - self.surface.configure(&self.device, &self.surface_config); - } + self.surface.configure(&self.device, &self.surface_config); // Invalidate intermediate textures - they will be lazily recreated // in draw() after we confirm the surface is healthy. This avoids @@ -887,9 +883,7 @@ impl WgpuRenderer { if new_alpha_mode != self.surface_config.alpha_mode { self.surface_config.alpha_mode = new_alpha_mode; - if self.surface_configured { - self.surface.configure(&self.device, &self.surface_config); - } + self.surface.configure(&self.device, &self.surface_config); self.pipelines = Self::create_pipelines( &self.device, &self.bind_group_layouts, @@ -946,7 +940,7 @@ impl WgpuRenderer { let frame = match self.surface.get_current_texture() { Ok(frame) => frame, Err(wgpu::SurfaceError::Lost | wgpu::SurfaceError::Outdated) => { - self.surface_configured = false; + self.surface.configure(&self.device, &self.surface_config); return; } Err(e) => {