Add supported caps info to naga backends (#9068)

* Initial commit

* 3/5 done I think

* Updated naga bin to use new caps

* Made clippy shut up

* Tried to fix dota2 validation error

* HLSL list made, also formatted Cargo.toml

* Made stuff work with snapshots

* Added changelog and GLSL list

* Updated message
This commit is contained in:
Inner Daemons authored and GitHub committed 2026-02-23 06:44:20 -07:00
1 parent 6432094c9e
commit fdd903e6e4
24 files changed
+377 -62

No files matched your search

+7
View File
@@ -47,6 +47,13 @@ wgpu-core = { workspace = true, features = ["trace"] }
wgpu-hal = { workspace = true, features = ["validation_canary"] }
wgpu-macros.workspace = true
wgpu-types.workspace = true
naga = { workspace = true, features = [
"spv-out",
"wgsl-out",
"hlsl-out",
"msl-out",
"glsl-out",
] }
anyhow.workspace = true
arrayvec.workspace = true
+2
View File
@@ -39,6 +39,7 @@ mod life_cycle;
mod mem_leaks;
mod mesh_shader;
mod multiview;
mod naga_capabilities;
mod occlusion_query;
mod oob_indexing;
mod oom;
@@ -157,6 +158,7 @@ fn all_tests() -> Vec<wgpu_test::GpuTestInitializer> {
vertex_state::all_tests(&mut tests);
write_texture::all_tests(&mut tests);
zero_init_texture_after_discard::all_tests(&mut tests);
naga_capabilities::all_tests(&mut tests);
tests
}
+35
View File
@@ -0,0 +1,35 @@
use wgpu_test::{
gpu_test, GpuTestConfiguration, GpuTestInitializer, TestParameters, TestingContext,
};
pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) {
vec.push(VALIDATE_CAPABILITIES);
}
pub fn validate_capabilities(ctx: TestingContext) {
use naga::valid::Capabilities as Caps;
let device_caps = wgpu_core::device::features_to_naga_capabilities(
ctx.adapter.features(),
ctx.adapter.get_downlevel_capabilities().flags,
);
let max_caps = match ctx.adapter.get_info().backend {
wgpu::Backend::Vulkan => naga::back::spv::supported_capabilities(),
// TODO: when mesh shaders land, change this
wgpu::Backend::Dx12 => naga::back::hlsl::supported_capabilities() | Caps::MESH_SHADER,
wgpu::Backend::Metal => naga::back::msl::supported_capabilities() | Caps::MESH_SHADER,
wgpu::Backend::Gl => naga::back::glsl::supported_capabilities(),
wgpu::Backend::BrowserWebGpu => naga::back::wgsl::supported_capabilities(),
wgpu::Backend::Noop => Caps::all(),
};
let diff = device_caps - max_caps;
assert_eq!(diff, Caps::empty());
}
#[gpu_test]
static VALIDATE_CAPABILITIES: GpuTestConfiguration = GpuTestConfiguration::new()
.parameters(
TestParameters::default()
.downlevel_flags(wgpu::DownlevelFlags::empty())
.limits(wgpu::Limits::downlevel_defaults()),
)
.run_sync(validate_capabilities);