From 847afc74fa6cae84de5ae1e318c3e07298a7c45c Mon Sep 17 00:00:00 2001 From: David De Jesus Duarte Date: Tue, 5 Aug 2025 11:20:07 +0200 Subject: [PATCH] hal/vulkan: Only decrement counter for raw shaders The counter is decremented for raw and intermediate shaders but only incremented for raw shaders, this lead to a negative counter value and did not represent the number of allocated shaders. --- wgpu-hal/src/vulkan/device.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 1d229635317..8174d6cb2b7 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -1954,11 +1954,11 @@ impl crate::Device for super::Device { match module { super::ShaderModule::Raw(raw) => { unsafe { self.shared.raw.destroy_shader_module(raw, None) }; + + self.counters.shader_modules.sub(1); } super::ShaderModule::Intermediate { .. } => {} } - - self.counters.shader_modules.sub(1); } unsafe fn create_render_pipeline(