[vulkan] set spir-v capabilities based on downlevel flags (#4197)

This commit is contained in:
Teodor Tanasoaia authored and GitHub committed 2023-10-03 16:34:36 -04:00
1 parent 61300afd22
commit e63b0f6f17
1 file changed
+16 -6
+16 -6
View File
@@ -1223,6 +1223,8 @@ impl super::Adapter {
let naga_options = {
use naga::back::spv;
// The following capabilities are always available
// see https://registry.khronos.org/vulkan/specs/1.3-extensions/html/chap52.html#spirvenv-capabilities
let mut capabilities = vec![
spv::Capability::Shader,
spv::Capability::Matrix,
@@ -1230,15 +1232,23 @@ impl super::Adapter {
spv::Capability::Image1D,
spv::Capability::ImageQuery,
spv::Capability::DerivativeControl,
spv::Capability::SampledCubeArray,
spv::Capability::SampleRateShading,
//Note: this is requested always, no matter what the actual
// adapter supports. It's not the responsibility of SPV-out
// translation to handle the storage support for formats.
spv::Capability::StorageImageExtendedFormats,
//TODO: fill out the rest
];
if self
.downlevel_flags
.contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES)
{
capabilities.push(spv::Capability::SampledCubeArray);
}
if self
.downlevel_flags
.contains(wgt::DownlevelFlags::MULTISAMPLED_SHADING)
{
capabilities.push(spv::Capability::SampleRateShading);
}
if features.contains(wgt::Features::MULTIVIEW) {
capabilities.push(spv::Capability::MultiView);
}