diff --git a/CHANGELOG.md b/CHANGELOG.md index 9af353b393a..9b892aca0c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,6 +46,10 @@ Bottom level categories: - Change `AdapterInfo::{device,vendor}` to be `u32` instead of `usize`. By @ameknite in [#3760](https://github.com/gfx-rs/wgpu/pull/3760) +#### Vulkan + +- Work around [Vulkan-ValidationLayers#5671](https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5671) by ignoring reports of violations of [VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912](https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912). By @jimblandy in [#3809](https://github.com/gfx-rs/wgpu/pull/3809). + ### Documentation #### General diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 101f303c16a..08617aac62e 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -16,13 +16,30 @@ unsafe extern "system" fn debug_utils_messenger_callback( callback_data_ptr: *const vk::DebugUtilsMessengerCallbackDataEXT, _user_data: *mut c_void, ) -> vk::Bool32 { - const VUID_VKSWAPCHAINCREATEINFOKHR_IMAGEEXTENT_01274: i32 = 0x7cd0911d; use std::borrow::Cow; if thread::panicking() { return vk::FALSE; } + let cd = unsafe { &*callback_data_ptr }; + + const VUID_VKSWAPCHAINCREATEINFOKHR_IMAGEEXTENT_01274: i32 = 0x7cd0911d; + const VUID_VKCMDENDDEBUGUTILSLABELEXT_COMMANDBUFFER_01912: i32 = 0x56146426; + + // Silence Vulkan Validation error " VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912" + // This is a bug in the validation layer: + // https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5671 + if cd.message_id_number == VUID_VKCMDENDDEBUGUTILSLABELEXT_COMMANDBUFFER_01912 { + return vk::FALSE; + } + + // Silence Vulkan Validation error "VUID-VkSwapchainCreateInfoKHR-imageExtent-01274" + // - it's a false positive due to the inherent racy-ness of surface resizing + if cd.message_id_number == VUID_VKSWAPCHAINCREATEINFOKHR_IMAGEEXTENT_01274 { + return vk::FALSE; + } + let level = match message_severity { vk::DebugUtilsMessageSeverityFlagsEXT::VERBOSE => log::Level::Debug, vk::DebugUtilsMessageSeverityFlagsEXT::INFO => log::Level::Info, @@ -31,8 +48,6 @@ unsafe extern "system" fn debug_utils_messenger_callback( _ => log::Level::Warn, }; - let cd = unsafe { &*callback_data_ptr }; - let message_id_name = if cd.p_message_id_name.is_null() { Cow::from("") } else { @@ -44,12 +59,6 @@ unsafe extern "system" fn debug_utils_messenger_callback( unsafe { CStr::from_ptr(cd.p_message) }.to_string_lossy() }; - // Silence Vulkan Validation error "VUID-VkSwapchainCreateInfoKHR-imageExtent-01274" - // - it's a false positive due to the inherent racy-ness of surface resizing - if cd.message_id_number == VUID_VKSWAPCHAINCREATEINFOKHR_IMAGEEXTENT_01274 { - return vk::FALSE; - } - let _ = std::panic::catch_unwind(|| { log::log!( level,