Remove the glsl-validate feature

When it was introduced it was supposed to allow for fast compiles by
skipping glsl specific validation, but as it turns the subset of glsl that's
compilable code is already pretty close to the subset of valid glsl code.

So the current code gated behind glsl-validate amounts to a single branch that
isn't even performance sensitive, and most of the validation is not specific to
glsl and is made by naga's validator which can be turned off, so the original
goal of fast compile times by disabling validation can still be accomplished.
This commit is contained in:
João Capucho
2022-09-05 23:45:55 +01:00
committed by Jim Blandy
parent d9c9fe6218
commit 7d0e9847b0
4 changed files with 1 additions and 5 deletions

View File

@@ -26,7 +26,6 @@ default = []
clone = []
dot-out = []
glsl-in = ["pp-rs"]
glsl-validate = []
glsl-out = []
msl-out = []
serialize = ["serde", "indexmap/serde-1"]

View File

@@ -14,7 +14,7 @@ name = "naga"
path = "src/main.rs"
[dependencies]
naga = { version = "0.9", path = "../", features = ["validate", "span", "wgsl-in", "wgsl-out", "glsl-in", "glsl-out", "spv-in", "spv-out", "msl-out", "hlsl-out", "dot-out", "glsl-validate", "serialize", "deserialize"] }
naga = { version = "0.9", path = "../", features = ["validate", "span", "wgsl-in", "wgsl-out", "glsl-in", "glsl-out", "spv-in", "spv-out", "msl-out", "hlsl-out", "dot-out", "serialize", "deserialize"] }
bincode = "1"
log = "0.4"
codespan-reporting = "0.11"

View File

@@ -101,7 +101,6 @@ pub enum ErrorKind {
#[error("unsupported matrix of the form matCx2 in std140 block layout")]
UnsupportedMatrixTypeInStd140,
/// A variable with the same name already exists in the current scope.
#[cfg(feature = "glsl-validate")]
#[error("Variable already declared: {0}")]
VariableAlreadyDeclared(String),
/// A semantic error was detected in the shader.

View File

@@ -637,10 +637,8 @@ impl Parser {
let expr = ctx.add_expression(Expression::LocalVariable(handle), decl.meta, body);
if let Some(name) = decl.name {
#[allow(unused_variables)]
let maybe_var = ctx.add_local_var(name.clone(), expr, mutable);
#[cfg(feature = "glsl-validate")]
if maybe_var.is_some() {
self.errors.push(Error {
kind: ErrorKind::VariableAlreadyDeclared(name),