mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-25 16:24:24 +00:00
refactor(vulkan): hoist validation layer check
This will be used shortly for checking if we should proceed with enabling GPU-based validation.
This commit is contained in:
parent
59e79c0664
commit
e154cc0312
@ -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();
|
||||
|
||||
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user