diff --git a/Makefile b/Makefile index 268df6a6b4..8f38834193 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ SNAPSHOTS_IN=tests/in SNAPSHOTS_OUT=tests/out all: + cargo fmt cargo test --all-features cargo clippy --all-features diff --git a/src/lib.rs b/src/lib.rs index 6f491d6f47..1921b4d7ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -471,6 +471,8 @@ pub struct GlobalVariable { pub ty: Handle, /// Initial value for this variable. pub init: Option>, + //TODO: require fragment input interpolation once the entry point I/O + // is refactored. /// The interpolation qualifier, if any. /// If the this `GlobalVariable` is a vertex output /// or fragment input, `None` corresponds to the diff --git a/src/proc/validator.rs b/src/proc/validator.rs index 92306d9598..1bc45087f9 100644 --- a/src/proc/validator.rs +++ b/src/proc/validator.rs @@ -249,8 +249,8 @@ pub enum EntryPointError { BindingCollision(Handle), #[error("Built-in {0:?} is not applicable to this entry point")] InvalidBuiltIn(crate::BuiltIn), - #[error("Interpolation of an integer has to be flat")] - InvalidIntegerInterpolation, + #[error("Location {location} onterpolation of an integer has to be flat")] + InvalidIntegerInterpolation { location: u32 }, #[error(transparent)] Function(#[from] FunctionError), } @@ -1091,19 +1091,16 @@ impl Validator { continue; } - if let Some(crate::Binding::Location(_)) = var.binding { - match (stage, var.class) { - (crate::ShaderStage::Vertex, crate::StorageClass::Output) - | (crate::ShaderStage::Fragment, crate::StorageClass::Input) => { - match module.types[var.ty].inner.scalar_kind() { - Some(crate::ScalarKind::Float) => {} - Some(_) if var.interpolation != Some(crate::Interpolation::Flat) => { - return Err(EntryPointError::InvalidIntegerInterpolation); - } - _ => {} + if let Some(crate::Binding::Location(location)) = var.binding { + if stage == crate::ShaderStage::Fragment && var.class == crate::StorageClass::Input + { + match module.types[var.ty].inner.scalar_kind() { + Some(crate::ScalarKind::Float) => {} + Some(_) if var.interpolation != Some(crate::Interpolation::Flat) => { + return Err(EntryPointError::InvalidIntegerInterpolation { location }); } + _ => {} } - _ => {} } }