mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Relax interpolation validation for vertex outputs
This commit is contained in:
committed by
Dzmitry Malyshau
parent
e92b35725c
commit
6afd72b8dd
1
Makefile
1
Makefile
@@ -4,6 +4,7 @@ SNAPSHOTS_IN=tests/in
|
||||
SNAPSHOTS_OUT=tests/out
|
||||
|
||||
all:
|
||||
cargo fmt
|
||||
cargo test --all-features
|
||||
cargo clippy --all-features
|
||||
|
||||
|
||||
@@ -471,6 +471,8 @@ pub struct GlobalVariable {
|
||||
pub ty: Handle<Type>,
|
||||
/// Initial value for this variable.
|
||||
pub init: Option<Handle<Constant>>,
|
||||
//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
|
||||
|
||||
@@ -249,8 +249,8 @@ pub enum EntryPointError {
|
||||
BindingCollision(Handle<crate::GlobalVariable>),
|
||||
#[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 });
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user