From 112e2858cfd23f7d2510c138cde786aa2abdfd5b Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Thu, 5 Jul 2018 13:19:39 -0700 Subject: [PATCH] SPIRV: Simplify matrix->matrix constructor When constructing a matrix from another matrix with smaller dimensions, there's no need to extract the scalars out of columns and rebuild the resulting matrix from scalars - instead, we can just construct shorter vectors with OpShuffle and combine them to the final result. This keeps the common casts such as mat3(mat4) in vector registers, which may improve performance for some GPUs, and cleans up output of translation tools like SPIRV-Cross. Fixes #1412. --- SPIRV/SpvBuilder.cpp | 160 ++++---- .../hlsl.cbuffer-identifier.vert.out | 125 +++---- Test/baseResults/hlsl.mul-truncate.frag.out | 349 ++++++++---------- 3 files changed, 305 insertions(+), 329 deletions(-) diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index 10d655b0..6839d4e7 100755 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -2031,83 +2031,113 @@ Id Builder::createMatrixConstructor(Decoration precision, const std::vector& Instruction* instr = module.getInstruction(componentTypeId); Id bitCount = instr->getIdOperand(0); - // Will use a two step process - // 1. make a compile-time 2D array of values - // 2. construct a matrix from that array - - // Step 1. - - // initialize the array to the identity matrix - Id ids[maxMatrixSize][maxMatrixSize]; - Id one = (bitCount == 64 ? makeDoubleConstant(1.0) : makeFloatConstant(1.0)); - Id zero = (bitCount == 64 ? makeDoubleConstant(0.0) : makeFloatConstant(0.0)); - for (int col = 0; col < 4; ++col) { - for (int row = 0; row < 4; ++row) { - if (col == row) - ids[col][row] = one; - else - ids[col][row] = zero; - } - } - - // modify components as dictated by the arguments - if (sources.size() == 1 && isScalar(sources[0])) { - // a single scalar; resets the diagonals - for (int col = 0; col < 4; ++col) - ids[col][col] = sources[0]; - } else if (isMatrix(sources[0])) { - // constructing from another matrix; copy over the parts that exist in both the argument and constructee + if (isMatrix(sources[0]) && getNumColumns(sources[0]) >= numCols && getNumRows(sources[0]) >= numRows) { + // To truncate the matrix to a smaller number of rows/columns, we need to: + // 1. For each column, extract the column and truncate it to the required size using shuffle + // 2. Assemble the resulting matrix from all columns Id matrix = sources[0]; - int minCols = std::min(numCols, getNumColumns(matrix)); - int minRows = std::min(numRows, getNumRows(matrix)); - for (int col = 0; col < minCols; ++col) { + Id columnTypeId = getContainedTypeId(resultTypeId); + Id sourceColumnTypeId = getContainedTypeId(getTypeId(matrix)); + + std::vector channels; + for (int row = 0; row < numRows; ++row) { + channels.push_back(row); + } + + std::vector matrixColumns; + for (int col = 0; col < numCols; ++col) { std::vector indexes; indexes.push_back(col); - for (int row = 0; row < minRows; ++row) { - indexes.push_back(row); - ids[col][row] = createCompositeExtract(matrix, componentTypeId, indexes); - indexes.pop_back(); - setPrecision(ids[col][row], precision); + Id colv = createCompositeExtract(matrix, sourceColumnTypeId, indexes); + setPrecision(colv, precision); + + if (numRows != getNumRows(matrix)) { + matrixColumns.push_back(createRvalueSwizzle(precision, columnTypeId, colv, channels)); + } else { + matrixColumns.push_back(colv); } } + + return setPrecision(createCompositeConstruct(resultTypeId, matrixColumns), precision); } else { - // fill in the matrix in column-major order with whatever argument components are available - int row = 0; - int col = 0; + // Will use a two step process + // 1. make a compile-time 2D array of values + // 2. construct a matrix from that array - for (int arg = 0; arg < (int)sources.size(); ++arg) { - Id argComp = sources[arg]; - for (int comp = 0; comp < getNumComponents(sources[arg]); ++comp) { - if (getNumComponents(sources[arg]) > 1) { - argComp = createCompositeExtract(sources[arg], componentTypeId, comp); - setPrecision(argComp, precision); + // Step 1. + + // initialize the array to the identity matrix + Id ids[maxMatrixSize][maxMatrixSize]; + Id one = (bitCount == 64 ? makeDoubleConstant(1.0) : makeFloatConstant(1.0)); + Id zero = (bitCount == 64 ? makeDoubleConstant(0.0) : makeFloatConstant(0.0)); + for (int col = 0; col < 4; ++col) { + for (int row = 0; row < 4; ++row) { + if (col == row) + ids[col][row] = one; + else + ids[col][row] = zero; + } + } + + // modify components as dictated by the arguments + if (sources.size() == 1 && isScalar(sources[0])) { + // a single scalar; resets the diagonals + for (int col = 0; col < 4; ++col) + ids[col][col] = sources[0]; + } else if (isMatrix(sources[0])) { + // constructing from another matrix; copy over the parts that exist in both the argument and constructee + Id matrix = sources[0]; + int minCols = std::min(numCols, getNumColumns(matrix)); + int minRows = std::min(numRows, getNumRows(matrix)); + for (int col = 0; col < minCols; ++col) { + std::vector indexes; + indexes.push_back(col); + for (int row = 0; row < minRows; ++row) { + indexes.push_back(row); + ids[col][row] = createCompositeExtract(matrix, componentTypeId, indexes); + indexes.pop_back(); + setPrecision(ids[col][row], precision); } - ids[col][row++] = argComp; - if (row == numRows) { - row = 0; - col++; + } + } else { + // fill in the matrix in column-major order with whatever argument components are available + int row = 0; + int col = 0; + + for (int arg = 0; arg < (int)sources.size(); ++arg) { + Id argComp = sources[arg]; + for (int comp = 0; comp < getNumComponents(sources[arg]); ++comp) { + if (getNumComponents(sources[arg]) > 1) { + argComp = createCompositeExtract(sources[arg], componentTypeId, comp); + setPrecision(argComp, precision); + } + ids[col][row++] = argComp; + if (row == numRows) { + row = 0; + col++; + } } } } + + // Step 2: Construct a matrix from that array. + // First make the column vectors, then make the matrix. + + // make the column vectors + Id columnTypeId = getContainedTypeId(resultTypeId); + std::vector matrixColumns; + for (int col = 0; col < numCols; ++col) { + std::vector vectorComponents; + for (int row = 0; row < numRows; ++row) + vectorComponents.push_back(ids[col][row]); + Id column = createCompositeConstruct(columnTypeId, vectorComponents); + setPrecision(column, precision); + matrixColumns.push_back(column); + } + + // make the matrix + return setPrecision(createCompositeConstruct(resultTypeId, matrixColumns), precision); } - - // Step 2: Construct a matrix from that array. - // First make the column vectors, then make the matrix. - - // make the column vectors - Id columnTypeId = getContainedTypeId(resultTypeId); - std::vector matrixColumns; - for (int col = 0; col < numCols; ++col) { - std::vector vectorComponents; - for (int row = 0; row < numRows; ++row) - vectorComponents.push_back(ids[col][row]); - Id column = createCompositeConstruct(columnTypeId, vectorComponents); - setPrecision(column, precision); - matrixColumns.push_back(column); - } - - // make the matrix - return setPrecision(createCompositeConstruct(resultTypeId, matrixColumns), precision); } // Comments in header diff --git a/Test/baseResults/hlsl.cbuffer-identifier.vert.out b/Test/baseResults/hlsl.cbuffer-identifier.vert.out index 6142ca06..f7225f84 100644 --- a/Test/baseResults/hlsl.cbuffer-identifier.vert.out +++ b/Test/baseResults/hlsl.cbuffer-identifier.vert.out @@ -251,12 +251,12 @@ Shader version: 500 // Module Version 10000 // Generated by (magic number): 80007 -// Id's are bound by 106 +// Id's are bound by 93 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Vertex 4 "main" 87 91 99 103 + EntryPoint Vertex 4 "main" 74 78 86 90 Source HLSL 500 Name 4 "main" Name 9 "VS_INPUT" @@ -274,13 +274,13 @@ Shader version: 500 MemberName 28(C) 1 "View" MemberName 28(C) 2 "Projection" Name 30 "" - Name 85 "input" - Name 87 "input.Pos" - Name 91 "input.Norm" - Name 94 "flattenTemp" - Name 95 "param" - Name 99 "@entryPointOutput.Pos" - Name 103 "@entryPointOutput.Norm" + Name 72 "input" + Name 74 "input.Pos" + Name 78 "input.Norm" + Name 81 "flattenTemp" + Name 82 "param" + Name 86 "@entryPointOutput.Pos" + Name 90 "@entryPointOutput.Norm" MemberDecorate 28(C) 0 RowMajor MemberDecorate 28(C) 0 Offset 0 MemberDecorate 28(C) 0 MatrixStride 16 @@ -293,10 +293,10 @@ Shader version: 500 Decorate 28(C) Block Decorate 30 DescriptorSet 0 Decorate 30 Binding 0 - Decorate 87(input.Pos) Location 0 - Decorate 91(input.Norm) Location 1 - Decorate 99(@entryPointOutput.Pos) BuiltIn Position - Decorate 103(@entryPointOutput.Norm) Location 0 + Decorate 74(input.Pos) Location 0 + Decorate 78(input.Norm) Location 1 + Decorate 86(@entryPointOutput.Pos) BuiltIn Position + Decorate 90(@entryPointOutput.Norm) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -324,37 +324,36 @@ Shader version: 500 39: 16(int) Constant 1 46: 16(int) Constant 2 55: TypeMatrix 7(fvec4) 3 - 56: 6(float) Constant 1065353216 - 73: TypePointer Function 8(fvec3) - 86: TypePointer Input 7(fvec4) - 87(input.Pos): 86(ptr) Variable Input - 90: TypePointer Input 8(fvec3) - 91(input.Norm): 90(ptr) Variable Input - 98: TypePointer Output 7(fvec4) -99(@entryPointOutput.Pos): 98(ptr) Variable Output - 102: TypePointer Output 8(fvec3) -103(@entryPointOutput.Norm): 102(ptr) Variable Output + 60: TypePointer Function 8(fvec3) + 73: TypePointer Input 7(fvec4) + 74(input.Pos): 73(ptr) Variable Input + 77: TypePointer Input 8(fvec3) + 78(input.Norm): 77(ptr) Variable Input + 85: TypePointer Output 7(fvec4) +86(@entryPointOutput.Pos): 85(ptr) Variable Output + 89: TypePointer Output 8(fvec3) +90(@entryPointOutput.Norm): 89(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 85(input): 10(ptr) Variable Function - 94(flattenTemp): 20(ptr) Variable Function - 95(param): 10(ptr) Variable Function - 88: 7(fvec4) Load 87(input.Pos) - 89: 34(ptr) AccessChain 85(input) 26 - Store 89 88 - 92: 8(fvec3) Load 91(input.Norm) - 93: 73(ptr) AccessChain 85(input) 39 - Store 93 92 - 96: 9(VS_INPUT) Load 85(input) - Store 95(param) 96 - 97:11(PS_INPUT) FunctionCall 14(@main(struct-VS_INPUT-vf4-vf31;) 95(param) - Store 94(flattenTemp) 97 - 100: 34(ptr) AccessChain 94(flattenTemp) 26 - 101: 7(fvec4) Load 100 - Store 99(@entryPointOutput.Pos) 101 - 104: 73(ptr) AccessChain 94(flattenTemp) 39 - 105: 8(fvec3) Load 104 - Store 103(@entryPointOutput.Norm) 105 + 72(input): 10(ptr) Variable Function + 81(flattenTemp): 20(ptr) Variable Function + 82(param): 10(ptr) Variable Function + 75: 7(fvec4) Load 74(input.Pos) + 76: 34(ptr) AccessChain 72(input) 26 + Store 76 75 + 79: 8(fvec3) Load 78(input.Norm) + 80: 60(ptr) AccessChain 72(input) 39 + Store 80 79 + 83: 9(VS_INPUT) Load 72(input) + Store 82(param) 83 + 84:11(PS_INPUT) FunctionCall 14(@main(struct-VS_INPUT-vf4-vf31;) 82(param) + Store 81(flattenTemp) 84 + 87: 34(ptr) AccessChain 81(flattenTemp) 26 + 88: 7(fvec4) Load 87 + Store 86(@entryPointOutput.Pos) 88 + 91: 60(ptr) AccessChain 81(flattenTemp) 39 + 92: 8(fvec3) Load 91 + Store 90(@entryPointOutput.Norm) 92 Return FunctionEnd 14(@main(struct-VS_INPUT-vf4-vf31;):11(PS_INPUT) Function None 12 @@ -387,31 +386,19 @@ Shader version: 500 Store 52 51 53: 31(ptr) AccessChain 30 26 54: 27 Load 53 - 57: 6(float) CompositeExtract 54 0 0 - 58: 6(float) CompositeExtract 54 0 1 - 59: 6(float) CompositeExtract 54 0 2 - 60: 6(float) CompositeExtract 54 0 3 - 61: 6(float) CompositeExtract 54 1 0 - 62: 6(float) CompositeExtract 54 1 1 - 63: 6(float) CompositeExtract 54 1 2 - 64: 6(float) CompositeExtract 54 1 3 - 65: 6(float) CompositeExtract 54 2 0 - 66: 6(float) CompositeExtract 54 2 1 - 67: 6(float) CompositeExtract 54 2 2 - 68: 6(float) CompositeExtract 54 2 3 - 69: 7(fvec4) CompositeConstruct 57 58 59 60 - 70: 7(fvec4) CompositeConstruct 61 62 63 64 - 71: 7(fvec4) CompositeConstruct 65 66 67 68 - 72: 55 CompositeConstruct 69 70 71 - 74: 73(ptr) AccessChain 13(input) 39 - 75: 8(fvec3) Load 74 - 76: 7(fvec4) MatrixTimesVector 72 75 - 77: 6(float) CompositeExtract 76 0 - 78: 6(float) CompositeExtract 76 1 - 79: 6(float) CompositeExtract 76 2 - 80: 8(fvec3) CompositeConstruct 77 78 79 - 81: 73(ptr) AccessChain 21(output) 39 - Store 81 80 - 82:11(PS_INPUT) Load 21(output) - ReturnValue 82 + 56: 7(fvec4) CompositeExtract 54 0 + 57: 7(fvec4) CompositeExtract 54 1 + 58: 7(fvec4) CompositeExtract 54 2 + 59: 55 CompositeConstruct 56 57 58 + 61: 60(ptr) AccessChain 13(input) 39 + 62: 8(fvec3) Load 61 + 63: 7(fvec4) MatrixTimesVector 59 62 + 64: 6(float) CompositeExtract 63 0 + 65: 6(float) CompositeExtract 63 1 + 66: 6(float) CompositeExtract 63 2 + 67: 8(fvec3) CompositeConstruct 64 65 66 + 68: 60(ptr) AccessChain 21(output) 39 + Store 68 67 + 69:11(PS_INPUT) Load 21(output) + ReturnValue 69 FunctionEnd diff --git a/Test/baseResults/hlsl.mul-truncate.frag.out b/Test/baseResults/hlsl.mul-truncate.frag.out index 80fe1cbd..1973fad1 100644 --- a/Test/baseResults/hlsl.mul-truncate.frag.out +++ b/Test/baseResults/hlsl.mul-truncate.frag.out @@ -384,12 +384,12 @@ gl_FragCoord origin is upper left // Module Version 10000 // Generated by (magic number): 80007 -// Id's are bound by 231 +// Id's are bound by 190 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "main" 229 + EntryPoint Fragment 4 "main" 188 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "main" @@ -408,14 +408,14 @@ gl_FragCoord origin is upper left Name 23 "" Name 37 "r01" Name 49 "r10" - Name 75 "r11" - Name 87 "r20" - Name 110 "r21" - Name 124 "r30" - Name 144 "r31" - Name 162 "r32" - Name 181 "r33" - Name 229 "@entryPointOutput" + Name 61 "r11" + Name 73 "r20" + Name 88 "r21" + Name 102 "r30" + Name 118 "r31" + Name 133 "r32" + Name 146 "r33" + Name 188 "@entryPointOutput" MemberDecorate 21(Matrix) 0 RowMajor MemberDecorate 21(Matrix) 0 Offset 0 MemberDecorate 21(Matrix) 0 MatrixStride 16 @@ -439,7 +439,7 @@ gl_FragCoord origin is upper left MemberDecorate 21(Matrix) 8 Offset 352 Decorate 21(Matrix) Block Decorate 23 DescriptorSet 0 - Decorate 229(@entryPointOutput) Location 0 + Decorate 188(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 @@ -467,32 +467,30 @@ gl_FragCoord origin is upper left 48: TypePointer Function 7(fvec4) 50: 24(int) Constant 0 51: TypePointer Uniform 13 - 54: 6(float) Constant 1065353216 - 55: 6(float) Constant 0 - 76: 24(int) Constant 2 - 77: TypePointer Uniform 16 - 117: 24(int) Constant 1 - 118: TypePointer Uniform 15 - 122: TypeMatrix 14(fvec3) 2 - 123: TypePointer Function 122 - 125: 24(int) Constant 3 - 126: TypePointer Uniform 17 - 129: 24(int) Constant 4 - 130: TypePointer Uniform 18 - 143: TypePointer Function 16 - 149: TypeMatrix 19(fvec2) 3 - 161: TypePointer Function 149 - 163: 24(int) Constant 5 - 164: TypePointer Uniform 20 - 180: TypePointer Function 15 - 209: TypeInt 32 0 - 210: 209(int) Constant 0 - 228: TypePointer Output 7(fvec4) -229(@entryPointOutput): 228(ptr) Variable Output + 62: 24(int) Constant 2 + 63: TypePointer Uniform 16 + 95: 24(int) Constant 1 + 96: TypePointer Uniform 15 + 100: TypeMatrix 14(fvec3) 2 + 101: TypePointer Function 100 + 103: 24(int) Constant 3 + 104: TypePointer Uniform 17 + 107: 24(int) Constant 4 + 108: TypePointer Uniform 18 + 117: TypePointer Function 16 + 123: TypeMatrix 19(fvec2) 3 + 132: TypePointer Function 123 + 134: 24(int) Constant 5 + 135: TypePointer Uniform 20 + 145: TypePointer Function 15 + 168: TypeInt 32 0 + 169: 168(int) Constant 0 + 187: TypePointer Output 7(fvec4) +188(@entryPointOutput): 187(ptr) Variable Output 4(main): 2 Function None 3 5: Label - 230: 7(fvec4) FunctionCall 9(@main() - Store 229(@entryPointOutput) 230 + 189: 7(fvec4) FunctionCall 9(@main() + Store 188(@entryPointOutput) 189 Return FunctionEnd 9(@main(): 7(fvec4) Function None 8 @@ -500,13 +498,13 @@ gl_FragCoord origin is upper left 12(r00): 11(ptr) Variable Function 37(r01): 11(ptr) Variable Function 49(r10): 48(ptr) Variable Function - 75(r11): 48(ptr) Variable Function - 87(r20): 48(ptr) Variable Function - 110(r21): 48(ptr) Variable Function - 124(r30): 123(ptr) Variable Function - 144(r31): 143(ptr) Variable Function - 162(r32): 161(ptr) Variable Function - 181(r33): 180(ptr) Variable Function + 61(r11): 48(ptr) Variable Function + 73(r20): 48(ptr) Variable Function + 88(r21): 48(ptr) Variable Function + 102(r30): 101(ptr) Variable Function + 118(r31): 117(ptr) Variable Function + 133(r32): 132(ptr) Variable Function + 146(r33): 145(ptr) Variable Function 27: 26(ptr) AccessChain 23 25 28: 19(fvec2) Load 27 31: 30(ptr) AccessChain 23 29 @@ -527,158 +525,119 @@ gl_FragCoord origin is upper left Store 37(r01) 47 52: 51(ptr) AccessChain 23 50 53: 13 Load 52 - 56: 6(float) CompositeExtract 53 0 0 - 57: 6(float) CompositeExtract 53 0 1 - 58: 6(float) CompositeExtract 53 0 2 - 59: 6(float) CompositeExtract 53 0 3 - 60: 6(float) CompositeExtract 53 1 0 - 61: 6(float) CompositeExtract 53 1 1 - 62: 6(float) CompositeExtract 53 1 2 - 63: 6(float) CompositeExtract 53 1 3 - 64: 6(float) CompositeExtract 53 2 0 - 65: 6(float) CompositeExtract 53 2 1 - 66: 6(float) CompositeExtract 53 2 2 - 67: 6(float) CompositeExtract 53 2 3 - 68: 7(fvec4) CompositeConstruct 56 57 58 59 - 69: 7(fvec4) CompositeConstruct 60 61 62 63 - 70: 7(fvec4) CompositeConstruct 64 65 66 67 - 71: 16 CompositeConstruct 68 69 70 - 72: 30(ptr) AccessChain 23 29 - 73: 14(fvec3) Load 72 - 74: 7(fvec4) MatrixTimesVector 71 73 - Store 49(r10) 74 - 78: 77(ptr) AccessChain 23 76 - 79: 16 Load 78 - 80: 39(ptr) AccessChain 23 38 - 81: 7(fvec4) Load 80 - 82: 6(float) CompositeExtract 81 0 - 83: 6(float) CompositeExtract 81 1 - 84: 6(float) CompositeExtract 81 2 - 85: 14(fvec3) CompositeConstruct 82 83 84 - 86: 7(fvec4) MatrixTimesVector 79 85 - Store 75(r11) 86 - 88: 30(ptr) AccessChain 23 29 - 89: 14(fvec3) Load 88 - 90: 51(ptr) AccessChain 23 50 - 91: 13 Load 90 - 92: 6(float) CompositeExtract 91 0 0 - 93: 6(float) CompositeExtract 91 0 1 - 94: 6(float) CompositeExtract 91 0 2 - 95: 6(float) CompositeExtract 91 1 0 - 96: 6(float) CompositeExtract 91 1 1 - 97: 6(float) CompositeExtract 91 1 2 - 98: 6(float) CompositeExtract 91 2 0 - 99: 6(float) CompositeExtract 91 2 1 - 100: 6(float) CompositeExtract 91 2 2 - 101: 6(float) CompositeExtract 91 3 0 - 102: 6(float) CompositeExtract 91 3 1 - 103: 6(float) CompositeExtract 91 3 2 - 104: 14(fvec3) CompositeConstruct 92 93 94 - 105: 14(fvec3) CompositeConstruct 95 96 97 - 106: 14(fvec3) CompositeConstruct 98 99 100 - 107: 14(fvec3) CompositeConstruct 101 102 103 - 108: 15 CompositeConstruct 104 105 106 107 - 109: 7(fvec4) VectorTimesMatrix 89 108 - Store 87(r20) 109 - 111: 39(ptr) AccessChain 23 38 - 112: 7(fvec4) Load 111 - 113: 6(float) CompositeExtract 112 0 - 114: 6(float) CompositeExtract 112 1 - 115: 6(float) CompositeExtract 112 2 - 116: 14(fvec3) CompositeConstruct 113 114 115 - 119: 118(ptr) AccessChain 23 117 - 120: 15 Load 119 - 121: 7(fvec4) VectorTimesMatrix 116 120 - Store 110(r21) 121 - 127: 126(ptr) AccessChain 23 125 - 128: 17 Load 127 - 131: 130(ptr) AccessChain 23 129 - 132: 18 Load 131 - 133: 6(float) CompositeExtract 132 0 0 - 134: 6(float) CompositeExtract 132 0 1 - 135: 6(float) CompositeExtract 132 0 2 - 136: 6(float) CompositeExtract 132 1 0 - 137: 6(float) CompositeExtract 132 1 1 - 138: 6(float) CompositeExtract 132 1 2 - 139: 14(fvec3) CompositeConstruct 133 134 135 - 140: 14(fvec3) CompositeConstruct 136 137 138 - 141: 122 CompositeConstruct 139 140 - 142: 122 MatrixTimesMatrix 128 141 - Store 124(r30) 142 - 145: 130(ptr) AccessChain 23 129 - 146: 18 Load 145 - 147: 126(ptr) AccessChain 23 125 + 54: 7(fvec4) CompositeExtract 53 0 + 55: 7(fvec4) CompositeExtract 53 1 + 56: 7(fvec4) CompositeExtract 53 2 + 57: 16 CompositeConstruct 54 55 56 + 58: 30(ptr) AccessChain 23 29 + 59: 14(fvec3) Load 58 + 60: 7(fvec4) MatrixTimesVector 57 59 + Store 49(r10) 60 + 64: 63(ptr) AccessChain 23 62 + 65: 16 Load 64 + 66: 39(ptr) AccessChain 23 38 + 67: 7(fvec4) Load 66 + 68: 6(float) CompositeExtract 67 0 + 69: 6(float) CompositeExtract 67 1 + 70: 6(float) CompositeExtract 67 2 + 71: 14(fvec3) CompositeConstruct 68 69 70 + 72: 7(fvec4) MatrixTimesVector 65 71 + Store 61(r11) 72 + 74: 30(ptr) AccessChain 23 29 + 75: 14(fvec3) Load 74 + 76: 51(ptr) AccessChain 23 50 + 77: 13 Load 76 + 78: 7(fvec4) CompositeExtract 77 0 + 79: 14(fvec3) VectorShuffle 78 78 0 1 2 + 80: 7(fvec4) CompositeExtract 77 1 + 81: 14(fvec3) VectorShuffle 80 80 0 1 2 + 82: 7(fvec4) CompositeExtract 77 2 + 83: 14(fvec3) VectorShuffle 82 82 0 1 2 + 84: 7(fvec4) CompositeExtract 77 3 + 85: 14(fvec3) VectorShuffle 84 84 0 1 2 + 86: 15 CompositeConstruct 79 81 83 85 + 87: 7(fvec4) VectorTimesMatrix 75 86 + Store 73(r20) 87 + 89: 39(ptr) AccessChain 23 38 + 90: 7(fvec4) Load 89 + 91: 6(float) CompositeExtract 90 0 + 92: 6(float) CompositeExtract 90 1 + 93: 6(float) CompositeExtract 90 2 + 94: 14(fvec3) CompositeConstruct 91 92 93 + 97: 96(ptr) AccessChain 23 95 + 98: 15 Load 97 + 99: 7(fvec4) VectorTimesMatrix 94 98 + Store 88(r21) 99 + 105: 104(ptr) AccessChain 23 103 + 106: 17 Load 105 + 109: 108(ptr) AccessChain 23 107 + 110: 18 Load 109 + 111: 7(fvec4) CompositeExtract 110 0 + 112: 14(fvec3) VectorShuffle 111 111 0 1 2 + 113: 7(fvec4) CompositeExtract 110 1 + 114: 14(fvec3) VectorShuffle 113 113 0 1 2 + 115: 100 CompositeConstruct 112 114 + 116: 100 MatrixTimesMatrix 106 115 + Store 102(r30) 116 + 119: 108(ptr) AccessChain 23 107 + 120: 18 Load 119 + 121: 104(ptr) AccessChain 23 103 + 122: 17 Load 121 + 124: 14(fvec3) CompositeExtract 122 0 + 125: 19(fvec2) VectorShuffle 124 124 0 1 + 126: 14(fvec3) CompositeExtract 122 1 + 127: 19(fvec2) VectorShuffle 126 126 0 1 + 128: 14(fvec3) CompositeExtract 122 2 + 129: 19(fvec2) VectorShuffle 128 128 0 1 + 130: 123 CompositeConstruct 125 127 129 + 131: 16 MatrixTimesMatrix 120 130 + Store 118(r31) 131 + 136: 135(ptr) AccessChain 23 134 + 137: 20 Load 136 + 138: 19(fvec2) CompositeExtract 137 0 + 139: 19(fvec2) CompositeExtract 137 1 + 140: 19(fvec2) CompositeExtract 137 2 + 141: 123 CompositeConstruct 138 139 140 + 142: 104(ptr) AccessChain 23 103 + 143: 17 Load 142 + 144: 123 MatrixTimesMatrix 141 143 + Store 133(r32) 144 + 147: 104(ptr) AccessChain 23 103 148: 17 Load 147 - 150: 6(float) CompositeExtract 148 0 0 - 151: 6(float) CompositeExtract 148 0 1 - 152: 6(float) CompositeExtract 148 1 0 - 153: 6(float) CompositeExtract 148 1 1 - 154: 6(float) CompositeExtract 148 2 0 - 155: 6(float) CompositeExtract 148 2 1 - 156: 19(fvec2) CompositeConstruct 150 151 - 157: 19(fvec2) CompositeConstruct 152 153 - 158: 19(fvec2) CompositeConstruct 154 155 - 159: 149 CompositeConstruct 156 157 158 - 160: 16 MatrixTimesMatrix 146 159 - Store 144(r31) 160 - 165: 164(ptr) AccessChain 23 163 - 166: 20 Load 165 - 167: 6(float) CompositeExtract 166 0 0 - 168: 6(float) CompositeExtract 166 0 1 - 169: 6(float) CompositeExtract 166 1 0 - 170: 6(float) CompositeExtract 166 1 1 - 171: 6(float) CompositeExtract 166 2 0 - 172: 6(float) CompositeExtract 166 2 1 - 173: 19(fvec2) CompositeConstruct 167 168 - 174: 19(fvec2) CompositeConstruct 169 170 - 175: 19(fvec2) CompositeConstruct 171 172 - 176: 149 CompositeConstruct 173 174 175 - 177: 126(ptr) AccessChain 23 125 - 178: 17 Load 177 - 179: 149 MatrixTimesMatrix 176 178 - Store 162(r32) 179 - 182: 126(ptr) AccessChain 23 125 - 183: 17 Load 182 - 184: 6(float) CompositeExtract 183 0 0 - 185: 6(float) CompositeExtract 183 0 1 - 186: 6(float) CompositeExtract 183 0 2 - 187: 6(float) CompositeExtract 183 1 0 - 188: 6(float) CompositeExtract 183 1 1 - 189: 6(float) CompositeExtract 183 1 2 - 190: 14(fvec3) CompositeConstruct 184 185 186 - 191: 14(fvec3) CompositeConstruct 187 188 189 - 192: 122 CompositeConstruct 190 191 - 193: 164(ptr) AccessChain 23 163 - 194: 20 Load 193 - 195: 15 MatrixTimesMatrix 192 194 - Store 181(r33) 195 - 196: 7(fvec4) Load 49(r10) - 197: 7(fvec4) Load 75(r11) - 198: 7(fvec4) FAdd 196 197 - 199: 7(fvec4) Load 87(r20) - 200: 7(fvec4) FAdd 198 199 - 201: 7(fvec4) Load 110(r21) - 202: 7(fvec4) FAdd 200 201 - 203: 6(float) Load 12(r00) - 204: 7(fvec4) CompositeConstruct 203 203 203 203 - 205: 7(fvec4) FAdd 202 204 - 206: 6(float) Load 37(r01) - 207: 7(fvec4) CompositeConstruct 206 206 206 206 - 208: 7(fvec4) FAdd 205 207 - 211: 11(ptr) AccessChain 124(r30) 50 210 - 212: 6(float) Load 211 - 213: 7(fvec4) CompositeConstruct 212 212 212 212 - 214: 7(fvec4) FAdd 208 213 - 215: 48(ptr) AccessChain 144(r31) 50 - 216: 7(fvec4) Load 215 - 217: 7(fvec4) FAdd 214 216 - 218: 11(ptr) AccessChain 162(r32) 50 210 - 219: 6(float) Load 218 - 220: 7(fvec4) CompositeConstruct 219 219 219 219 - 221: 7(fvec4) FAdd 217 220 - 222: 15 Load 181(r33) - 223: 16 Transpose 222 - 224: 7(fvec4) CompositeExtract 223 0 - 225: 7(fvec4) FAdd 221 224 - ReturnValue 225 + 149: 14(fvec3) CompositeExtract 148 0 + 150: 14(fvec3) CompositeExtract 148 1 + 151: 100 CompositeConstruct 149 150 + 152: 135(ptr) AccessChain 23 134 + 153: 20 Load 152 + 154: 15 MatrixTimesMatrix 151 153 + Store 146(r33) 154 + 155: 7(fvec4) Load 49(r10) + 156: 7(fvec4) Load 61(r11) + 157: 7(fvec4) FAdd 155 156 + 158: 7(fvec4) Load 73(r20) + 159: 7(fvec4) FAdd 157 158 + 160: 7(fvec4) Load 88(r21) + 161: 7(fvec4) FAdd 159 160 + 162: 6(float) Load 12(r00) + 163: 7(fvec4) CompositeConstruct 162 162 162 162 + 164: 7(fvec4) FAdd 161 163 + 165: 6(float) Load 37(r01) + 166: 7(fvec4) CompositeConstruct 165 165 165 165 + 167: 7(fvec4) FAdd 164 166 + 170: 11(ptr) AccessChain 102(r30) 50 169 + 171: 6(float) Load 170 + 172: 7(fvec4) CompositeConstruct 171 171 171 171 + 173: 7(fvec4) FAdd 167 172 + 174: 48(ptr) AccessChain 118(r31) 50 + 175: 7(fvec4) Load 174 + 176: 7(fvec4) FAdd 173 175 + 177: 11(ptr) AccessChain 133(r32) 50 169 + 178: 6(float) Load 177 + 179: 7(fvec4) CompositeConstruct 178 178 178 178 + 180: 7(fvec4) FAdd 176 179 + 181: 15 Load 146(r33) + 182: 16 Transpose 181 + 183: 7(fvec4) CompositeExtract 182 0 + 184: 7(fvec4) FAdd 180 183 + ReturnValue 184 FunctionEnd