validation: Fix type compatibility for streams vs. vertex inputs (#7600)

The old is_compatible_with handled scalar/scalar, scalar/vector, vector/vector, but was missing vector/scalar.

Since is_compatible_with is only used by vertex shader inputs, and vertex shader inputs can't be matrices (only scalars and vectors), we can actually simplify this by removing the other match and just only checking the kind.

Fixes #7568
This commit is contained in:
Jasper St. Pierre 2025-04-25 06:08:27 -07:00 committed by GitHub
parent 6a7aa14fbd
commit 38b6663f3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -815,19 +815,6 @@ impl NumericType {
_ => false,
}
}
fn is_compatible_with(&self, other: &NumericType) -> bool {
if self.scalar.kind != other.scalar.kind {
return false;
}
match (self.dim, other.dim) {
(NumericDimension::Scalar, NumericDimension::Scalar) => true,
(NumericDimension::Scalar, NumericDimension::Vector(_)) => true,
(NumericDimension::Vector(_), NumericDimension::Vector(_)) => true,
(NumericDimension::Matrix(..), NumericDimension::Matrix(..)) => true,
_ => false,
}
}
}
/// Return true if the fragment `format` is covered by the provided `output`.
@ -1221,8 +1208,10 @@ impl Interface {
// For vertex attributes, there are defaults filled out
// by the driver if data is not provided.
naga::ShaderStage::Vertex => {
let is_compatible =
iv.ty.scalar.kind == provided.ty.scalar.kind;
// vertex inputs don't count towards inter-stage
(iv.ty.is_compatible_with(&provided.ty), 0)
(is_compatible, 0)
}
naga::ShaderStage::Fragment => {
if iv.interpolation != provided.interpolation {