Skip to content

Commit 38b6663

Browse files
authored
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
1 parent 6a7aa14 commit 38b6663

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

wgpu-core/src/validation.rs

+3-14
Original file line numberDiff line numberDiff line change
@@ -815,19 +815,6 @@ impl NumericType {
815815
_ => false,
816816
}
817817
}
818-
819-
fn is_compatible_with(&self, other: &NumericType) -> bool {
820-
if self.scalar.kind != other.scalar.kind {
821-
return false;
822-
}
823-
match (self.dim, other.dim) {
824-
(NumericDimension::Scalar, NumericDimension::Scalar) => true,
825-
(NumericDimension::Scalar, NumericDimension::Vector(_)) => true,
826-
(NumericDimension::Vector(_), NumericDimension::Vector(_)) => true,
827-
(NumericDimension::Matrix(..), NumericDimension::Matrix(..)) => true,
828-
_ => false,
829-
}
830-
}
831818
}
832819

833820
/// Return true if the fragment `format` is covered by the provided `output`.
@@ -1221,8 +1208,10 @@ impl Interface {
12211208
// For vertex attributes, there are defaults filled out
12221209
// by the driver if data is not provided.
12231210
naga::ShaderStage::Vertex => {
1211+
let is_compatible =
1212+
iv.ty.scalar.kind == provided.ty.scalar.kind;
12241213
// vertex inputs don't count towards inter-stage
1225-
(iv.ty.is_compatible_with(&provided.ty), 0)
1214+
(is_compatible, 0)
12261215
}
12271216
naga::ShaderStage::Fragment => {
12281217
if iv.interpolation != provided.interpolation {

0 commit comments

Comments
 (0)