Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress validation error caused by OBS layer #4002

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions wgpu-hal/src/vulkan/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ unsafe extern "system" fn debug_utils_messenger_callback(
return vk::FALSE;
}

// Silence Vulkan Validation error "VUID-VkRenderPassBeginInfo-framebuffer-04627"
// if the OBS layer is enabled. This is a bug in the OBS layer. As the OBS layer
// does not have a version number they increment, there is no way to qualify the
// supression of the error to a specific version of the OBS layer.
//
// See https://github.com/obsproject/obs-studio/issues/9353
const VUID_VKRENDERPASSBEGININFO_FRAMEBUFFER_04627: i32 = 0x45125641;
if cd.message_id_number == VUID_VKRENDERPASSBEGININFO_FRAMEBUFFER_04627
&& user_data.has_obs_layer
{
return vk::FALSE;
}

let level = match message_severity {
vk::DebugUtilsMessageSeverityFlagsEXT::VERBOSE => log::Level::Debug,
vk::DebugUtilsMessageSeverityFlagsEXT::INFO => log::Level::Info,
Expand Down Expand Up @@ -593,6 +606,9 @@ impl crate::Instance<super::Api> for super::Instance {
let nv_optimus_layer = CStr::from_bytes_with_nul(b"VK_LAYER_NV_optimus\0").unwrap();
let has_nv_optimus = find_layer(&instance_layers, nv_optimus_layer).is_some();

let obs_layer = CStr::from_bytes_with_nul(b"VK_LAYER_OBS_HOOK\0").unwrap();
let has_obs_layer = find_layer(&instance_layers, obs_layer).is_some();

let mut layers: Vec<&'static CStr> = Vec::new();

// Request validation layer if asked.
Expand All @@ -609,6 +625,7 @@ impl crate::Instance<super::Api> for super::Instance {
.unwrap()
.to_owned(),
validation_layer_spec_version: layer_properties.spec_version,
has_obs_layer,
});
} else {
log::warn!(
Expand Down
4 changes: 4 additions & 0 deletions wgpu-hal/src/vulkan/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ pub struct DebugUtilsMessengerUserData {

/// Validation layer specification version, from `vk::LayerProperties`.
validation_layer_spec_version: u32,

/// If the OBS layer is present. OBS never increments the version of their layer,
/// so there's no reason to have the version.
has_obs_layer: bool,
}

pub struct InstanceShared {
Expand Down