Skip to content

Commit

Permalink
Don't report violations of VUID-vkCmdEndDebugUtilsLabelEXT-commandBuf…
Browse files Browse the repository at this point in the history
…fer-01912.

As described in [Vulkan-ValidationLayers#5671], the validation layers don't understand debug ranges paired across different command buffers on the same queue, even though the Vulkan spec says:

> An application may open a debug label region in one command buffer and close it in another, or otherwise split debug label regions across multiple command buffers or multiple queue submissions. When viewed from the linear series of submissions to a single queue, the calls to vkCmdBeginDebugUtilsLabelEXT and vkCmdEndDebugUtilsLabelEXT must be matched and balanced.

Until this is fixed, wgpu should ignore this validation error to reduce noise in test runs.

Fixes #3733.

[Vulkan-ValidationLayers#5671]: KhronosGroup/Vulkan-ValidationLayers#5671,
  • Loading branch information
jimblandy committed May 28, 2023
1 parent 4478c52 commit 88ac91f
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions wgpu-hal/src/vulkan/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 {
Expand All @@ -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,
Expand Down

0 comments on commit 88ac91f

Please sign in to comment.