Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions wgpu-core/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down Expand Up @@ -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 {
Expand Down