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

Enable GPU-based validation for Vulkan #5046

Merged
Merged
Changes from 1 commit
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
Next Next commit
refactor(vulkan): hoist validation layer check
This will be used shortly for checking if we should proceed with
enabling GPU-based validation.
  • Loading branch information
ErichDonGubler committed Feb 12, 2024
commit da94d93016aaabbd4e88a42357d4c5a6e74942df
8 changes: 5 additions & 3 deletions wgpu-hal/src/vulkan/instance.rs
ErichDonGubler marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ impl crate::Instance<super::Api> for super::Instance {
.find(|inst_layer| cstr_from_bytes_until_nul(&inst_layer.layer_name) == Some(name))
}

let validation_layer_name =
CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0").unwrap();
let validation_layer_properties = find_layer(&instance_layers, validation_layer_name);

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();

Expand All @@ -654,9 +658,7 @@ impl crate::Instance<super::Api> for super::Instance {
// Request validation layer if asked.
let mut debug_utils = None;
if desc.flags.intersects(wgt::InstanceFlags::VALIDATION) {
let validation_layer_name =
CStr::from_bytes_with_nul(b"VK_LAYER_KHRONOS_validation\0").unwrap();
if let Some(layer_properties) = find_layer(&instance_layers, validation_layer_name) {
if let Some(layer_properties) = validation_layer_properties {
layers.push(validation_layer_name);

if extensions.contains(&ext::DebugUtils::name()) {
Expand Down