From 1f782a55aed6a6f16ac7902a4c4fcc0023630da8 Mon Sep 17 00:00:00 2001 From: Andy Leiserson Date: Thu, 27 Aug 2026 03:35:08 -0700 Subject: [PATCH] fix(hal/vulkan): Respect `InstanceFlags::DISCARD_HAL_LABELS` (#10121) --- wgpu-hal/src/vulkan/command.rs | 13 ++++++++++--- wgpu-hal/src/vulkan/device.rs | 8 +++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/wgpu-hal/src/vulkan/command.rs b/wgpu-hal/src/vulkan/command.rs index 62d282798..ba6ac2fe7 100644 --- a/wgpu-hal/src/vulkan/command.rs +++ b/wgpu-hal/src/vulkan/command.rs @@ -134,9 +134,16 @@ impl crate::CommandEncoder for super::CommandEncoder { } let raw = self.free.pop().unwrap(); - // Set the name unconditionally, since there might be a - // previous name assigned to this. - unsafe { self.device.set_object_name(raw, label.unwrap_or_default()) }; + if !self + .device + .instance + .flags + .contains(wgt::InstanceFlags::DISCARD_HAL_LABELS) + { + // Set the name even if it is empty, since there might be a + // previous name assigned to the command buffer. + unsafe { self.device.set_object_name(raw, label.unwrap_or_default()) }; + } // Reset some state in case the last renderpass was never ended. self.rpass_debug_marker_active = false; diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 00febeaa4..cb4b8d793 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -3030,7 +3030,13 @@ impl super::DeviceShared { .create_semaphore(&vk::SemaphoreCreateInfo::default(), None) .map_err(super::map_host_device_oom_err)?; - self.set_object_name(semaphore, name); + if !self + .instance + .flags + .contains(wgt::InstanceFlags::DISCARD_HAL_LABELS) + { + self.set_object_name(semaphore, name); + } Ok(semaphore) }