From 401f014c12b881797ea40253af155842d348f676 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Wed, 6 Aug 2025 09:41:17 -0400 Subject: [PATCH 1/2] docs(vulkan): clarify safety contract for `DeviceShared::set_object_name` --- wgpu-hal/src/vulkan/device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 1d229635317..7988daa4585 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -27,7 +27,7 @@ impl super::DeviceShared { /// /// # Safety /// - /// It must be valid to set `object`'s debug name + /// - It must be safe to mutate `object` from this thread. pub(super) unsafe fn set_object_name(&self, object: impl vk::Handle, name: &str) { let Some(extension) = self.extension_fns.debug_utils.as_ref() else { return; From 2e1f81db16e4f7d471803abf855fb5a49606b431 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Wed, 6 Aug 2025 09:46:53 -0400 Subject: [PATCH 2/2] fixup! docs(vulkan): clarify safety contract for `DeviceShared::set_object_name` --- wgpu-hal/src/vulkan/device.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 7988daa4585..48be11a124d 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -27,7 +27,17 @@ impl super::DeviceShared { /// /// # Safety /// - /// - It must be safe to mutate `object` from this thread. + /// This method inherits the safety contract from [`vkSetDebugUtilsObjectName`]. In particular: + /// + /// - `object` must be a valid handle for one of the following: + /// - An instance-level object from the same instance as this device. + /// - A physical-device-level object that descends from the same physical device as this + /// device. + /// - A device-level object that descends from this device. + /// - `object` must be externally synchronized—only the calling thread should access it during + /// this call. + /// + /// [`vkSetDebugUtilsObjectName`]: https://registry.khronos.org/vulkan/specs/latest/man/html/vkSetDebugUtilsObjectNameEXT.html pub(super) unsafe fn set_object_name(&self, object: impl vk::Handle, name: &str) { let Some(extension) = self.extension_fns.debug_utils.as_ref() else { return;