|
1 | 1 | use anyhow::{anyhow, Context as _}; |
| 2 | +use naga::front::wgsl::TreatMissingCapabiltiesAsUnknown; |
2 | 3 | use std::fs; |
3 | 4 | use std::{error::Error, fmt, io::Read, path::Path, str::FromStr}; |
4 | 5 |
|
@@ -152,6 +153,11 @@ struct Args { |
152 | 153 | /// "67108864"), the string "none", or the string "all". |
153 | 154 | #[argh(option, default = "CapabilitiesArg(naga::valid::Capabilities::all())")] |
154 | 155 | capabilities: CapabilitiesArg, |
| 156 | + |
| 157 | + /// whether diagnostics should recognize enable-extensions whose capabilities are missing, or |
| 158 | + /// pretend that such an extension is unknown. |
| 159 | + #[argh(switch)] |
| 160 | + treat_missing_capabilities_as_unknown: bool, |
155 | 161 | } |
156 | 162 |
|
157 | 163 | /// Newtype so we can implement [`FromStr`] for `BoundsCheckPolicy`. |
@@ -390,7 +396,7 @@ struct Parameters<'a> { |
390 | 396 | shader_stage: Option<ShaderStage>, |
391 | 397 | defines: FastHashMap<String, String>, |
392 | 398 | capabilities: naga::valid::Capabilities, |
393 | | - |
| 399 | + treat_missing_capabilities_as_unknown: bool, |
394 | 400 | /// We use this copy of `args.compact` to know whether we should pass the |
395 | 401 | /// entrypoint to `process_overrides`, which will result in removal from |
396 | 402 | /// the module of anything not reachable from that entry point. |
@@ -543,7 +549,7 @@ fn run() -> anyhow::Result<()> { |
543 | 549 | ); |
544 | 550 |
|
545 | 551 | params.compact = args.compact; |
546 | | - params.capabilities = args.capabilities.0; |
| 552 | +(??) |
547 | 553 |
|
548 | 554 | if args.bulk_validate { |
549 | 555 | return bulk_validate(&args, ¶ms); |
@@ -721,12 +727,7 @@ fn parse_input(input_path: &Path, input: Vec<u8>, params: &Parameters) -> anyhow |
721 | 727 | }, |
722 | 728 | InputKind::Wgsl => { |
723 | 729 | let input = String::from_utf8(input)?; |
724 | | - let options = naga::front::wgsl::Options { |
725 | | - parse_doc_comments: false, |
726 | | - capabilities: params.capabilities, |
727 | | - }; |
728 | | - let mut frontend = naga::front::wgsl::Frontend::new_with_options(options); |
729 | | - let result = frontend.parse(&input); |
| 730 | +(??) let result = naga::front::wgsl::parse_str(&input); |
730 | 731 | match result { |
731 | 732 | Ok(v) => Parsed { |
732 | 733 | module: v, |
|
0 commit comments