From 95c451a3b8b0b9e20882eaa52fe48e8ae0193765 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Wed, 3 Jan 2024 13:48:16 +0100 Subject: [PATCH] Check thata bindgroup's textures are not destroyed before using it --- wgpu-core/src/binding_model.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wgpu-core/src/binding_model.rs b/wgpu-core/src/binding_model.rs index 5f4dfb434..ec97568f0 100644 --- a/wgpu-core/src/binding_model.rs +++ b/wgpu-core/src/binding_model.rs @@ -847,11 +847,14 @@ impl Drop for BindGroup { impl BindGroup { pub(crate) fn raw(&self, guard: &SnatchGuard) -> Option<&A::BindGroup> { + // Clippy insist on writing it this way. The idea is to return None + // if any of the raw buffer is not valid anymore. for buffer in &self.used_buffer_ranges { - // Clippy insist on writing it this way. The idea is to return None - // if any of the raw buffer is not valid anymore. let _ = buffer.buffer.raw(guard)?; } + for texture in &self.used_texture_ranges { + let _ = texture.texture.raw(guard)?; + } self.raw.as_ref() } pub(crate) fn validate_dynamic_bindings(