[naga spv-out] Handle nested arrays when adding matrix decorations

Previously we only checked whether the outermost array's subtype was a
Matrix when determining whether to add ColMajor and MatrixStride
decorations, meaning arrays of arrays of matrices would not be
decorated.
This commit is contained in:
Jamie Nicol 2024-11-19 15:27:47 +00:00 committed by Jim Blandy
parent 6f5014f0a3
commit 00a6032eb7
2 changed files with 11 additions and 6 deletions

View File

@ -1800,12 +1800,13 @@ impl Writer {
} }
} }
// Matrices and arrays of matrices both require decorations, // Matrices and (potentially nested) arrays of matrices both require decorations,
// so "see through" an array to determine if they're needed. // so "see through" any arrays to determine if they're needed.
let member_array_subty_inner = match arena[member.ty].inner { let mut member_array_subty_inner = &arena[member.ty].inner;
crate::TypeInner::Array { base, .. } => &arena[base].inner, while let crate::TypeInner::Array { base, .. } = *member_array_subty_inner {
ref other => other, member_array_subty_inner = &arena[base].inner;
}; }
if let crate::TypeInner::Matrix { if let crate::TypeInner::Matrix {
columns: _, columns: _,
rows, rows,

View File

@ -44,10 +44,14 @@ OpDecorate %45 DescriptorSet 0
OpDecorate %45 Binding 6 OpDecorate %45 Binding 6
OpDecorate %46 Block OpDecorate %46 Block
OpMemberDecorate %46 0 Offset 0 OpMemberDecorate %46 0 Offset 0
OpMemberDecorate %46 0 ColMajor
OpMemberDecorate %46 0 MatrixStride 16
OpDecorate %48 DescriptorSet 0 OpDecorate %48 DescriptorSet 0
OpDecorate %48 Binding 7 OpDecorate %48 Binding 7
OpDecorate %49 Block OpDecorate %49 Block
OpMemberDecorate %49 0 Offset 0 OpMemberDecorate %49 0 Offset 0
OpMemberDecorate %49 0 ColMajor
OpMemberDecorate %49 0 MatrixStride 8
OpDecorate %116 BuiltIn LocalInvocationId OpDecorate %116 BuiltIn LocalInvocationId
%2 = OpTypeVoid %2 = OpTypeVoid
%3 = OpTypeBool %3 = OpTypeBool