Skip to content

Commit

Permalink
amend! feat(vulkan): enable GPU-based validation for Vulkan backend
Browse files Browse the repository at this point in the history
feat(vulkan): enable GPU-based validation for Vulkan backend

If [`VK_LAYER_KHRONOS_validation`] is present, and it supports
[`VK_EXT_validation_features`], we can configure it with another instance
creation info. element of type [`VkValidationFeaturesEXT`] to enable
GPU-based validation. Wire `InstanceFlags::GPU_BASED_VALIDATION` to do
this in the Vulkan backend. It's even already finding issues in our
`examples` and other tests! But…we'd like to handle those later, since
this is so important for users. So, I've broken that out to separate
issues. The instances we're aware of:

* `water` is running into sync. validation issues: see
  <#5231>
* `wgpu_test::shader::struct_layout::uniform_input` is failing to
    instrument shaders now; see
    <#5245>

It is apparent from this and the [DX12 implementation of GPU-based
validation] that we will need to communicate clearly to users that
`InstanceFlags::GPU_BASED_VALIDATION` implies
`InstanceFlags::VALIDATION`. Not all backends enforce this yet; I have
[split out this work][follow-up for flag implication].

Note that `VK_EXT_validation_features` has been deprecated in favor of
the more general layer configuration mechanism offered by
[`VK_EXT_layer_settings`].

[DX12 implementation of GPU-based validation]: #5146
[`VK_EXT_layer_settings`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_layer_settings.html
[`VK_EXT_validation_features`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_validation_features.html
[`VK_LAYER_KHRONOS_validation`]:https://vulkan.lunarg.com/doc/sdk/1.3.275.0/linux/khronos_validation_layer.html
[`VkValidationFeaturesEXT`]: https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkValidationFeaturesEXT.html
[follow-up for flag implication]: #5232
  • Loading branch information
ErichDonGubler committed Feb 12, 2024
1 parent c3df032 commit 8f7e720
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/tests/shader/struct_layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ static UNIFORM_INPUT: GpuTestConfiguration = GpuTestConfiguration::new()
FailureCase::backend(wgpu::Backends::VULKAN)
.validation_error("a matrix with stride 8 not satisfying alignment to 16"),
)
.expect_fail(
FailureCase::backend(wgpu::Backends::VULKAN).validation_error(
"Failure to instrument shader. Proceeding with non-instrumented shader.",
),
)
.limits(Limits::downlevel_defaults()),
)
.run_async(|ctx| {
Expand Down

0 comments on commit 8f7e720

Please sign in to comment.