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) }