From 2f04aee0b434d589c2b6b15b306779acf8651beb Mon Sep 17 00:00:00 2001 From: rajveermalviya Date: Tue, 15 Aug 2023 01:36:41 +0530 Subject: [PATCH] drop clear_views in surface_texture_discard Fixes #4056 --- wgpu-core/src/present.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/wgpu-core/src/present.rs b/wgpu-core/src/present.rs index c9df46ad930..c74be8971df 100644 --- a/wgpu-core/src/present.rs +++ b/wgpu-core/src/present.rs @@ -386,10 +386,24 @@ impl Global { // The texture ID got added to the device tracker by `submit()`, // and now we are moving it away. + log::debug!( + "Removing swapchain texture {:?} from the device tracker", + texture_id.value + ); device.trackers.lock().textures.remove(texture_id.value); let (texture, _) = hub.textures.unregister(texture_id.value.0, &mut token); if let Some(texture) = texture { + if let resource::TextureClearMode::RenderPass { clear_views, .. } = + texture.clear_mode + { + for clear_view in clear_views { + unsafe { + hal::Device::destroy_texture_view(&device.raw, clear_view); + } + } + } + let suf = A::get_surface_mut(surface); match texture.inner { resource::TextureInner::Surface {