diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index 5cc37de78..b3dd14532 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -1800,12 +1800,13 @@ impl Writer { } } - // Matrices and arrays of matrices both require decorations, - // so "see through" an array to determine if they're needed. - let member_array_subty_inner = match arena[member.ty].inner { - crate::TypeInner::Array { base, .. } => &arena[base].inner, - ref other => other, - }; + // Matrices and (potentially nested) arrays of matrices both require decorations, + // so "see through" any arrays to determine if they're needed. + let mut member_array_subty_inner = &arena[member.ty].inner; + while let crate::TypeInner::Array { base, .. } = *member_array_subty_inner { + member_array_subty_inner = &arena[base].inner; + } + if let crate::TypeInner::Matrix { columns: _, rows, diff --git a/naga/tests/out/spv/globals.spvasm b/naga/tests/out/spv/globals.spvasm index 4aa6a10ad..31e836531 100644 --- a/naga/tests/out/spv/globals.spvasm +++ b/naga/tests/out/spv/globals.spvasm @@ -44,10 +44,14 @@ OpDecorate %45 DescriptorSet 0 OpDecorate %45 Binding 6 OpDecorate %46 Block OpMemberDecorate %46 0 Offset 0 +OpMemberDecorate %46 0 ColMajor +OpMemberDecorate %46 0 MatrixStride 16 OpDecorate %48 DescriptorSet 0 OpDecorate %48 Binding 7 OpDecorate %49 Block OpMemberDecorate %49 0 Offset 0 +OpMemberDecorate %49 0 ColMajor +OpMemberDecorate %49 0 MatrixStride 8 OpDecorate %116 BuiltIn LocalInvocationId %2 = OpTypeVoid %3 = OpTypeBool