Skip to content

Commit 37d9c4f

Browse files
committed
io_shareable
1 parent 0cab67d commit 37d9c4f

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

naga/src/valid/interface.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -460,9 +460,20 @@ impl VaryingContext<'_> {
460460
));
461461
}
462462
}
463+
let (ty, ty_inner) = if interpolation == Some(crate::Interpolation::PerVertex) {
464+
let three = crate::ArraySize::Constant(core::num::NonZeroU32::new(3).unwrap());
465+
match ty_inner {
466+
&Ti::Array { base, size, .. } if size == three => {
467+
(base, &self.types[base].inner)
468+
}
469+
_ => return Err(VaryingError::PerVertexNotArrayOfThree),
470+
}
471+
} else {
472+
(ty, ty_inner)
473+
};
474+
463475
// Only IO-shareable types may be stored in locations.
464-
// Per Vertex case is checked later.
465-
else if !self.type_info[ty.index()]
476+
if !self.type_info[ty.index()]
466477
.flags
467478
.contains(super::TypeFlags::IO_SHAREABLE)
468479
{
@@ -568,17 +579,7 @@ impl VaryingContext<'_> {
568579
return Err(VaryingError::UnsupportedCapability(required));
569580
}
570581

571-
if interpolation == Some(crate::Interpolation::PerVertex) {
572-
let three = crate::ArraySize::Constant(core::num::NonZeroU32::new(3).unwrap());
573-
match ty_inner {
574-
&Ti::Array { base, size, .. } if size == three => {
575-
if self.types[base].inner.scalar_kind().is_none() {
576-
return Err(VaryingError::InvalidType(base));
577-
}
578-
}
579-
_ => return Err(VaryingError::PerVertexNotArrayOfThree),
580-
}
581-
} else {
582+
if interpolation != Some(crate::Interpolation::PerVertex) {
582583
match ty_inner.scalar_kind() {
583584
Some(crate::ScalarKind::Float) => {
584585
if needs_interpolation && interpolation.is_none() {

0 commit comments

Comments
 (0)