-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move(naga)!: move WGSL-specific
diagnostic_filter
stuff to `naga::f…
…ront::wgsl`
- Loading branch information
1 parent
a9572d7
commit 38a0e55
Showing
3 changed files
with
39 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::diagnostic_filter::{FilterableTriggeringRule, Severity}; | ||
|
||
impl Severity { | ||
const ERROR: &'static str = "error"; | ||
const WARNING: &'static str = "warning"; | ||
const INFO: &'static str = "info"; | ||
const OFF: &'static str = "off"; | ||
|
||
/// Convert from a sentinel word in WGSL into its associated [`Severity`], if possible. | ||
pub fn from_wgsl_ident(s: &str) -> Option<Self> { | ||
Some(match s { | ||
Self::ERROR => Self::Error, | ||
Self::WARNING => Self::Warning, | ||
Self::INFO => Self::Info, | ||
Self::OFF => Self::Off, | ||
_ => return None, | ||
}) | ||
} | ||
} | ||
|
||
impl FilterableTriggeringRule { | ||
const DERIVATIVE_UNIFORMITY: &'static str = "derivative_uniformity"; | ||
|
||
/// Convert from a sentinel word in WGSL into its associated [`FilterableTriggeringRule`], if possible. | ||
pub fn from_wgsl_ident(s: &str) -> Option<Self> { | ||
Some(match s { | ||
Self::DERIVATIVE_UNIFORMITY => Self::DerivativeUniformity, | ||
_ => return None, | ||
}) | ||
} | ||
|
||
/// Maps this [`FilterableTriggeringRule`] into the sentinel word associated with it in WGSL. | ||
pub const fn to_wgsl_ident(self) -> &'static str { | ||
match self { | ||
Self::DerivativeUniformity => Self::DERIVATIVE_UNIFORMITY, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters