mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Let validation check for more unsupported builtins.
Add `valid::Capabilities` flags for the `ClipDistance` and `CullDistance` builtins, which are not supported by all back ends. Have the CLI perform valation with only those capabilities that the requested back ends support. Fixes #1961.
This commit is contained in:
@@ -317,12 +317,23 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
|
||||
_ => return Err(CliError("Unknown input file extension").into()),
|
||||
};
|
||||
|
||||
// Decide which capabilities our output formats can support.
|
||||
let validation_caps =
|
||||
output_paths
|
||||
.iter()
|
||||
.fold(naga::valid::Capabilities::all(), |caps, path| {
|
||||
use naga::valid::Capabilities as C;
|
||||
let missing = match Path::new(path).extension().and_then(|ex| ex.to_str()) {
|
||||
Some("wgsl") => C::CLIP_DISTANCE | C::CULL_DISTANCE,
|
||||
Some("metal") => C::CULL_DISTANCE,
|
||||
_ => C::empty(),
|
||||
};
|
||||
caps & !missing
|
||||
});
|
||||
|
||||
// validate the IR
|
||||
let info = match naga::valid::Validator::new(
|
||||
params.validation_flags,
|
||||
naga::valid::Capabilities::all(),
|
||||
)
|
||||
.validate(&module)
|
||||
let info = match naga::valid::Validator::new(params.validation_flags, validation_caps)
|
||||
.validate(&module)
|
||||
{
|
||||
Ok(info) => Some(info),
|
||||
Err(error) => {
|
||||
|
||||
Reference in New Issue
Block a user