diff --git a/CHANGELOG.md b/CHANGELOG.md index be56b914a7a..77b3ffd5534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -67,7 +67,7 @@ Bottom level categories: - `tan` - `tanh` - Eager release of GPU resources comes from device.trackers. By @bradwerth in [#5075](https://github.com/gfx-rs/wgpu/pull/5075) -- Added `InstanceFlags::GPU_BASED_VALIDATION`, which enables GPU-based validation for shaders. This is currently only supported on the DX12 back end; other platforms ignore this flag, for now. +- Added `InstanceFlags::GPU_BASED_VALIDATION`, which enables GPU-based validation for shaders. This is currently only supported on the DX12 and Vulkan back ends; other platforms ignore this flag, for now. - This has been added to the set of flags set by `InstanceFlags::debugging` and `InstanceFlags::from_build_config`. If you notice your graphics workloads running more slowly, this may be the culprit. - As with other instance flags, this flag can be changed in calls to `InstanceFlags::with_env` with the new `WGPU_GPU_BASED_VALIDATION` environment variable. diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 1f0159413f1..1d7e79f4cfd 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -756,6 +756,15 @@ impl crate::Instance for super::Instance { create_info = create_info.push_next(vk_create_info); } + let mut gpu_assisted_validation = vk::ValidationFeaturesEXT::builder() + .enabled_validation_features(&[vk::ValidationFeatureEnableEXT::GPU_ASSISTED]); + if desc + .flags + .intersects(wgt::InstanceFlags::GPU_BASED_VALIDATION) + { + create_info = create_info.push_next(&mut gpu_assisted_validation); + } + unsafe { profiling::scope!("vkCreateInstance"); entry.create_instance(&create_info, None)