diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 5e432869..3d589bdd 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -108,6 +108,7 @@ protected: spv::Id handleUserFunctionCall(const glslang::TIntermAggregate*); spv::Id createBinaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id left, spv::Id right, glslang::TBasicType typeProxy, bool reduceComparison = true); + spv::Id createBinaryMatrixOperation(spv::Op, spv::Decoration precision, spv::Id typeId, spv::Id left, spv::Id right); spv::Id createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand,glslang::TBasicType typeProxy); spv::Id createConversion(glslang::TOperator op, spv::Decoration precision, spv::Id destTypeId, spv::Id operand); spv::Id makeSmearedConstant(spv::Id constant, int vectorSize); @@ -2122,26 +2123,17 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv break; case glslang::EOpVectorTimesMatrix: case glslang::EOpVectorTimesMatrixAssign: - assert(builder.isVector(left)); - assert(builder.isMatrix(right)); binOp = spv::OpVectorTimesMatrix; break; case glslang::EOpMatrixTimesVector: - assert(builder.isMatrix(left)); - assert(builder.isVector(right)); binOp = spv::OpMatrixTimesVector; break; case glslang::EOpMatrixTimesScalar: case glslang::EOpMatrixTimesScalarAssign: - if (builder.isMatrix(right)) - std::swap(left, right); - assert(builder.isScalar(right)); binOp = spv::OpMatrixTimesScalar; break; case glslang::EOpMatrixTimesMatrix: case glslang::EOpMatrixTimesMatrixAssign: - assert(builder.isMatrix(left)); - assert(builder.isMatrix(right)); binOp = spv::OpMatrixTimesMatrix; break; case glslang::EOpOuterProduct: @@ -2220,29 +2212,8 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv // handle mapped binary operations (should be non-comparison) if (binOp != spv::OpNop) { assert(comparison == false); - if (builder.isMatrix(left) || builder.isMatrix(right)) { - switch (binOp) { - case spv::OpMatrixTimesScalar: - case spv::OpVectorTimesMatrix: - case spv::OpMatrixTimesVector: - case spv::OpMatrixTimesMatrix: - break; - case spv::OpFDiv: - // turn it into a multiply... - assert(builder.isMatrix(left) && builder.isScalar(right)); - right = builder.createBinOp(spv::OpFDiv, builder.getTypeId(right), builder.makeFloatConstant(1.0F), right); - binOp = spv::OpFMul; - break; - default: - spv::MissingFunctionality("binary operation on matrix"); - break; - } - - spv::Id id = builder.createBinOp(binOp, typeId, left, right); - builder.setPrecision(id, precision); - - return id; - } + if (builder.isMatrix(left) || builder.isMatrix(right)) + return createBinaryMatrixOperation(binOp, precision, typeId, left, right); // No matrix involved; make both operands be the same number of components, if needed if (needMatchingVectors) @@ -2326,6 +2297,111 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv return 0; } +// +// Translate AST matrix operation to SPV operation, already having SPV-based operands/types. +// These can be any of: +// +// matrix * scalar +// scalar * matrix +// matrix * matrix linear algebraic +// matrix * vector +// vector * matrix +// matrix * matrix componentwise +// matrix op matrix op in {+, -, /} +// matrix op scalar op in {+, -, /} +// scalar op matrix op in {+, -, /} +// +spv::Id TGlslangToSpvTraverser::createBinaryMatrixOperation(spv::Op op, spv::Decoration precision, spv::Id typeId, spv::Id left, spv::Id right) +{ + bool firstClass = true; + + // First, handle first-class matrix operations (* and matrix/scalar) + switch (op) { + case spv::OpFDiv: + if (builder.isMatrix(left) && builder.isScalar(right)) { + // turn matrix / scalar into a multiply... + right = builder.createBinOp(spv::OpFDiv, builder.getTypeId(right), builder.makeFloatConstant(1.0F), right); + op = spv::OpMatrixTimesScalar; + } else + firstClass = false; + break; + case spv::OpMatrixTimesScalar: + if (builder.isMatrix(right)) + std::swap(left, right); + assert(builder.isScalar(right)); + break; + case spv::OpVectorTimesMatrix: + assert(builder.isVector(left)); + assert(builder.isMatrix(right)); + break; + case spv::OpMatrixTimesVector: + assert(builder.isMatrix(left)); + assert(builder.isVector(right)); + break; + case spv::OpMatrixTimesMatrix: + assert(builder.isMatrix(left)); + assert(builder.isMatrix(right)); + break; + default: + firstClass = false; + break; + } + + if (firstClass) { + spv::Id id = builder.createBinOp(op, typeId, left, right); + builder.setPrecision(id, precision); + + return id; + } + + // Handle component-wise +, -, *, and / for all combinations of type. + // The result type of all of them is the same type as the (a) matrix operand. + // The algorithm is to: + // - break the matrix(es) into vectors + // - smear any scalar to a vector + // - do vector operations + // - make a matrix out the vector results + switch (op) { + case spv::OpFAdd: + case spv::OpFSub: + case spv::OpFDiv: + case spv::OpFMul: + { + // one time set up... + bool leftMat = builder.isMatrix(left); + bool rightMat = builder.isMatrix(right); + unsigned int numCols = leftMat ? builder.getNumColumns(left) : builder.getNumColumns(right); + int numRows = leftMat ? builder.getNumRows(left) : builder.getNumRows(right); + spv::Id scalarType = builder.getScalarTypeId(typeId); + spv::Id vecType = builder.makeVectorType(scalarType, numRows); + std::vector results; + spv::Id smearVec = spv::NoResult; + if (builder.isScalar(left)) + smearVec = builder.smearScalar(precision, left, vecType); + else if (builder.isScalar(right)) + smearVec = builder.smearScalar(precision, right, vecType); + + // do each vector op + for (unsigned int c = 0; c < numCols; ++c) { + std::vector indexes; + indexes.push_back(c); + spv::Id leftVec = leftMat ? builder.createCompositeExtract( left, vecType, indexes) : smearVec; + spv::Id rightVec = rightMat ? builder.createCompositeExtract(right, vecType, indexes) : smearVec; + results.push_back(builder.createBinOp(op, vecType, leftVec, rightVec)); + builder.setPrecision(results.back(), precision); + } + + // put the pieces together + spv::Id id = builder.createCompositeConstruct(typeId, results); + builder.setPrecision(id, precision); + return id; + } + default: + assert(0); + return spv::NoResult; + } +} + spv::Id TGlslangToSpvTraverser::createUnaryOperation(glslang::TOperator op, spv::Decoration precision, spv::Id typeId, spv::Id operand, glslang::TBasicType typeProxy) { spv::Op unaryOp = spv::OpNop; diff --git a/Test/baseResults/spv.300layout.vert.out b/Test/baseResults/spv.300layout.vert.out index 541970b0..b62711cd 100644 --- a/Test/baseResults/spv.300layout.vert.out +++ b/Test/baseResults/spv.300layout.vert.out @@ -3,4 +3,244 @@ spv.300layout.vert Linked vertex stage: -Missing functionality: binary operation on matrix +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 165 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Vertex 4 "main" 101 11 121 9 99 109 129 163 164 + Source ESSL 300 + Name 4 "main" + Name 9 "pos" + Name 11 "p" + Name 17 "Transform" + MemberName 17(Transform) 0 "M1" + MemberName 17(Transform) 1 "M2" + MemberName 17(Transform) 2 "N1" + MemberName 17(Transform) 3 "iuin" + Name 19 "tblock" + Name 45 "T3" + MemberName 45(T3) 0 "M3" + MemberName 45(T3) 1 "M4" + MemberName 45(T3) 2 "N2" + MemberName 45(T3) 3 "uv3a" + Name 47 "" + Name 79 "T2" + MemberName 79(T2) 0 "b" + MemberName 79(T2) 1 "t2m" + Name 81 "" + Name 99 "color" + Name 101 "c" + Name 109 "iout" + Name 115 "uiuin" + Name 121 "aiv2" + Name 127 "S" + MemberName 127(S) 0 "c" + MemberName 127(S) 1 "f" + Name 129 "s" + Name 163 "gl_VertexID" + Name 164 "gl_InstanceID" + Decorate 11(p) Location 3 + MemberDecorate 17(Transform) 0 RowMajor + MemberDecorate 17(Transform) 0 Offset 0 + MemberDecorate 17(Transform) 0 MatrixStride 16 + MemberDecorate 17(Transform) 1 ColMajor + MemberDecorate 17(Transform) 1 Offset 64 + MemberDecorate 17(Transform) 1 MatrixStride 16 + MemberDecorate 17(Transform) 2 RowMajor + MemberDecorate 17(Transform) 2 Offset 128 + MemberDecorate 17(Transform) 2 MatrixStride 16 + MemberDecorate 17(Transform) 3 Offset 176 + Decorate 17(Transform) Block + MemberDecorate 45(T3) 0 ColMajor + MemberDecorate 45(T3) 1 RowMajor + MemberDecorate 45(T3) 2 ColMajor + Decorate 45(T3) GLSLShared + Decorate 45(T3) Block + MemberDecorate 79(T2) 1 RowMajor + Decorate 79(T2) GLSLShared + Decorate 79(T2) Block + Decorate 101(c) Location 7 + Decorate 109(iout) Flat + Decorate 121(aiv2) Location 9 + Decorate 163(gl_VertexID) BuiltIn VertexId + Decorate 164(gl_InstanceID) BuiltIn InstanceId + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Output 7(fvec4) + 9(pos): 8(ptr) Variable Output + 10: TypePointer Input 7(fvec4) + 11(p): 10(ptr) Variable Input + 13: TypeMatrix 7(fvec4) 4 + 14: TypeVector 6(float) 3 + 15: TypeMatrix 14(fvec3) 3 + 16: TypeInt 32 1 + 17(Transform): TypeStruct 13 13 15 16(int) + 18: TypePointer Uniform 17(Transform) + 19(tblock): 18(ptr) Variable Uniform + 20: 16(int) Constant 0 + 21: TypePointer Uniform 13 + 24: 16(int) Constant 1 + 40: TypeMatrix 14(fvec3) 2 + 41: TypeInt 32 0 + 42: TypeVector 41(int) 3 + 43: 41(int) Constant 4 + 44: TypeArray 42(ivec3) 43 + 45(T3): TypeStruct 13 13 40 44 + 46: TypePointer Uniform 45(T3) + 47: 46(ptr) Variable Uniform + 78: TypeBool + 79(T2): TypeStruct 78(bool) 13 + 80: TypePointer Uniform 79(T2) + 81: 80(ptr) Variable Uniform + 98: TypePointer Output 14(fvec3) + 99(color): 98(ptr) Variable Output + 100: TypePointer Input 14(fvec3) + 101(c): 100(ptr) Variable Input + 103: 16(int) Constant 2 + 104: TypePointer Uniform 15 + 108: TypePointer Output 16(int) + 109(iout): 108(ptr) Variable Output + 110: 16(int) Constant 3 + 111: TypePointer Uniform 16(int) + 114: TypePointer UniformConstant 41(int) + 115(uiuin): 114(ptr) Variable UniformConstant + 119: TypeVector 16(int) 2 + 120: TypePointer Input 119(ivec2) + 121(aiv2): 120(ptr) Variable Input + 122: 41(int) Constant 1 + 123: TypePointer Input 16(int) + 127(S): TypeStruct 14(fvec3) 6(float) + 128: TypePointer Output 127(S) + 129(s): 128(ptr) Variable Output + 132: 41(int) Constant 0 + 133: TypePointer Input 6(float) + 136: TypePointer Output 6(float) + 138: TypePointer Uniform 14(fvec3) + 141: 6(float) Constant 1065353216 + 142: 14(fvec3) ConstantComposite 141 141 141 + 143: TypeVector 78(bool) 3 + 149: TypePointer Uniform 42(ivec3) + 152: 41(int) Constant 5 + 153: 42(ivec3) ConstantComposite 152 152 152 +163(gl_VertexID): 123(ptr) Variable Input +164(gl_InstanceID): 123(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 12: 7(fvec4) Load 11(p) + 22: 21(ptr) AccessChain 19(tblock) 20 + 23: 13 Load 22 + 25: 21(ptr) AccessChain 19(tblock) 24 + 26: 13 Load 25 + 27: 7(fvec4) CompositeExtract 23 0 + 28: 7(fvec4) CompositeExtract 26 0 + 29: 7(fvec4) FAdd 27 28 + 30: 7(fvec4) CompositeExtract 23 1 + 31: 7(fvec4) CompositeExtract 26 1 + 32: 7(fvec4) FAdd 30 31 + 33: 7(fvec4) CompositeExtract 23 2 + 34: 7(fvec4) CompositeExtract 26 2 + 35: 7(fvec4) FAdd 33 34 + 36: 7(fvec4) CompositeExtract 23 3 + 37: 7(fvec4) CompositeExtract 26 3 + 38: 7(fvec4) FAdd 36 37 + 39: 13 CompositeConstruct 29 32 35 38 + 48: 21(ptr) AccessChain 47 24 + 49: 13 Load 48 + 50: 7(fvec4) CompositeExtract 39 0 + 51: 7(fvec4) CompositeExtract 49 0 + 52: 7(fvec4) FAdd 50 51 + 53: 7(fvec4) CompositeExtract 39 1 + 54: 7(fvec4) CompositeExtract 49 1 + 55: 7(fvec4) FAdd 53 54 + 56: 7(fvec4) CompositeExtract 39 2 + 57: 7(fvec4) CompositeExtract 49 2 + 58: 7(fvec4) FAdd 56 57 + 59: 7(fvec4) CompositeExtract 39 3 + 60: 7(fvec4) CompositeExtract 49 3 + 61: 7(fvec4) FAdd 59 60 + 62: 13 CompositeConstruct 52 55 58 61 + 63: 21(ptr) AccessChain 47 20 + 64: 13 Load 63 + 65: 7(fvec4) CompositeExtract 62 0 + 66: 7(fvec4) CompositeExtract 64 0 + 67: 7(fvec4) FAdd 65 66 + 68: 7(fvec4) CompositeExtract 62 1 + 69: 7(fvec4) CompositeExtract 64 1 + 70: 7(fvec4) FAdd 68 69 + 71: 7(fvec4) CompositeExtract 62 2 + 72: 7(fvec4) CompositeExtract 64 2 + 73: 7(fvec4) FAdd 71 72 + 74: 7(fvec4) CompositeExtract 62 3 + 75: 7(fvec4) CompositeExtract 64 3 + 76: 7(fvec4) FAdd 74 75 + 77: 13 CompositeConstruct 67 70 73 76 + 82: 21(ptr) AccessChain 81 24 + 83: 13 Load 82 + 84: 7(fvec4) CompositeExtract 77 0 + 85: 7(fvec4) CompositeExtract 83 0 + 86: 7(fvec4) FAdd 84 85 + 87: 7(fvec4) CompositeExtract 77 1 + 88: 7(fvec4) CompositeExtract 83 1 + 89: 7(fvec4) FAdd 87 88 + 90: 7(fvec4) CompositeExtract 77 2 + 91: 7(fvec4) CompositeExtract 83 2 + 92: 7(fvec4) FAdd 90 91 + 93: 7(fvec4) CompositeExtract 77 3 + 94: 7(fvec4) CompositeExtract 83 3 + 95: 7(fvec4) FAdd 93 94 + 96: 13 CompositeConstruct 86 89 92 95 + 97: 7(fvec4) VectorTimesMatrix 12 96 + Store 9(pos) 97 + 102: 14(fvec3) Load 101(c) + 105: 104(ptr) AccessChain 19(tblock) 103 + 106: 15 Load 105 + 107: 14(fvec3) VectorTimesMatrix 102 106 + Store 99(color) 107 + 112: 111(ptr) AccessChain 19(tblock) 110 + 113: 16(int) Load 112 + 116: 41(int) Load 115(uiuin) + 117: 16(int) Bitcast 116 + 118: 16(int) IAdd 113 117 + 124: 123(ptr) AccessChain 121(aiv2) 122 + 125: 16(int) Load 124 + 126: 16(int) IAdd 118 125 + Store 109(iout) 126 + 130: 14(fvec3) Load 101(c) + 131: 98(ptr) AccessChain 129(s) 20 + Store 131 130 + 134: 133(ptr) AccessChain 11(p) 132 + 135: 6(float) Load 134 + 137: 136(ptr) AccessChain 129(s) 24 + Store 137 135 + 139: 138(ptr) AccessChain 47 103 24 + 140: 14(fvec3) Load 139 + 144: 143(bvec3) FOrdNotEqual 140 142 + 145: 78(bool) Any 144 + 146: 78(bool) LogicalNot 145 + SelectionMerge 148 None + BranchConditional 146 147 148 + 147: Label + 150: 149(ptr) AccessChain 47 110 103 + 151: 42(ivec3) Load 150 + 154: 143(bvec3) INotEqual 151 153 + 155: 78(bool) Any 154 + Branch 148 + 148: Label + 156: 78(bool) Phi 145 5 155 147 + SelectionMerge 158 None + BranchConditional 156 157 158 + 157: Label + 159: 98(ptr) AccessChain 129(s) 20 + 160: 14(fvec3) Load 159 + 161: 14(fvec3) CompositeConstruct 141 141 141 + 162: 14(fvec3) FAdd 160 161 + Store 159 162 + Branch 158 + 158: Label + Return + FunctionEnd diff --git a/Test/baseResults/spv.deepRvalue.frag.out b/Test/baseResults/spv.deepRvalue.frag.out index 46804923..04d5d4ce 100644 --- a/Test/baseResults/spv.deepRvalue.frag.out +++ b/Test/baseResults/spv.deepRvalue.frag.out @@ -3,4 +3,206 @@ spv.deepRvalue.frag Linked fragment stage: -Missing functionality: binary operation on matrix +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 155 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" + ExecutionMode 4 OriginLowerLeft + Source GLSL 330 + Name 4 "main" + Name 9 "v1" + Name 15 "v2" + Name 21 "v3" + Name 27 "v4" + Name 35 "m" + Name 63 "mm" + Name 80 "f" + Name 87 "g" + Name 106 "h" + Name 107 "i" + Name 111 "samp2D" + Name 134 "str" + MemberName 134(str) 0 "a" + MemberName 134(str) 1 "b" + MemberName 134(str) 2 "c" + Name 136 "t" + Name 149 "gl_FragColor" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypePointer Private 7(fvec4) + 9(v1): 8(ptr) Variable Private + 10: 6(float) Constant 1073741824 + 11: 6(float) Constant 1077936128 + 12: 6(float) Constant 1084227584 + 13: 6(float) Constant 1088421888 + 14: 7(fvec4) ConstantComposite 10 11 12 13 + 15(v2): 8(ptr) Variable Private + 16: 6(float) Constant 1093664768 + 17: 6(float) Constant 1095761920 + 18: 6(float) Constant 1099431936 + 19: 6(float) Constant 1100480512 + 20: 7(fvec4) ConstantComposite 16 17 18 19 + 21(v3): 8(ptr) Variable Private + 22: 6(float) Constant 1102577664 + 23: 6(float) Constant 1105723392 + 24: 6(float) Constant 1106771968 + 25: 6(float) Constant 1108606976 + 26: 7(fvec4) ConstantComposite 22 23 24 25 + 27(v4): 8(ptr) Variable Private + 28: 6(float) Constant 1109655552 + 29: 6(float) Constant 1110179840 + 30: 6(float) Constant 1111228416 + 31: 6(float) Constant 1112801280 + 32: 7(fvec4) ConstantComposite 28 29 30 31 + 33: TypeMatrix 7(fvec4) 4 + 34: TypePointer Function 33 + 40: 6(float) Constant 1065353216 + 41: 6(float) Constant 0 + 79: TypePointer Function 6(float) + 81: TypeInt 32 1 + 82: 81(int) Constant 1 + 83: TypeInt 32 0 + 84: 83(int) Constant 3 + 103: 81(int) Constant 2 + 104: 83(int) Constant 1 + 108: TypeImage 6(float) 2D sampled format:Unknown + 109: TypeSampledImage 108 + 110: TypePointer UniformConstant 109 + 111(samp2D): 110(ptr) Variable UniformConstant + 113: TypeVector 6(float) 2 + 114: 6(float) Constant 1056964608 + 115: 113(fvec2) ConstantComposite 114 114 + 118: TypePointer Function 7(fvec4) + 121: 6(float) Constant 1036831949 + 122: TypeBool + 133: TypeArray 113(fvec2) 84 + 134(str): TypeStruct 81(int) 133 122(bool) + 135: TypePointer Function 134(str) + 137: 113(fvec2) ConstantComposite 10 11 + 138: 6(float) Constant 1082130432 + 139: 113(fvec2) ConstantComposite 138 12 + 140: 6(float) Constant 1086324736 + 141: 113(fvec2) ConstantComposite 140 13 + 142: 133 ConstantComposite 137 139 141 + 143: 122(bool) ConstantTrue + 144: 134(str) ConstantComposite 82 142 143 + 148: TypePointer Output 7(fvec4) +149(gl_FragColor): 148(ptr) Variable Output + 4(main): 2 Function None 3 + 5: Label + 35(m): 34(ptr) Variable Function + 63(mm): 34(ptr) Variable Function + 80(f): 79(ptr) Variable Function + 87(g): 79(ptr) Variable Function + 106(h): 79(ptr) Variable Function + 107(i): 79(ptr) Variable Function + 119: 118(ptr) Variable Function + 136(t): 135(ptr) Variable Function + Store 9(v1) 14 + Store 15(v2) 20 + Store 21(v3) 26 + Store 27(v4) 32 + 36: 7(fvec4) Load 9(v1) + 37: 7(fvec4) Load 15(v2) + 38: 7(fvec4) Load 21(v3) + 39: 7(fvec4) Load 27(v4) + 42: 6(float) CompositeExtract 36 0 + 43: 6(float) CompositeExtract 36 1 + 44: 6(float) CompositeExtract 36 2 + 45: 6(float) CompositeExtract 36 3 + 46: 6(float) CompositeExtract 37 0 + 47: 6(float) CompositeExtract 37 1 + 48: 6(float) CompositeExtract 37 2 + 49: 6(float) CompositeExtract 37 3 + 50: 6(float) CompositeExtract 38 0 + 51: 6(float) CompositeExtract 38 1 + 52: 6(float) CompositeExtract 38 2 + 53: 6(float) CompositeExtract 38 3 + 54: 6(float) CompositeExtract 39 0 + 55: 6(float) CompositeExtract 39 1 + 56: 6(float) CompositeExtract 39 2 + 57: 6(float) CompositeExtract 39 3 + 58: 7(fvec4) CompositeConstruct 42 43 44 45 + 59: 7(fvec4) CompositeConstruct 46 47 48 49 + 60: 7(fvec4) CompositeConstruct 50 51 52 53 + 61: 7(fvec4) CompositeConstruct 54 55 56 57 + 62: 33 CompositeConstruct 58 59 60 61 + Store 35(m) 62 + 64: 33 Load 35(m) + 65: 33 Load 35(m) + 66: 7(fvec4) CompositeExtract 64 0 + 67: 7(fvec4) CompositeExtract 65 0 + 68: 7(fvec4) FMul 66 67 + 69: 7(fvec4) CompositeExtract 64 1 + 70: 7(fvec4) CompositeExtract 65 1 + 71: 7(fvec4) FMul 69 70 + 72: 7(fvec4) CompositeExtract 64 2 + 73: 7(fvec4) CompositeExtract 65 2 + 74: 7(fvec4) FMul 72 73 + 75: 7(fvec4) CompositeExtract 64 3 + 76: 7(fvec4) CompositeExtract 65 3 + 77: 7(fvec4) FMul 75 76 + 78: 33 CompositeConstruct 68 71 74 77 + Store 63(mm) 78 + 85: 79(ptr) AccessChain 63(mm) 82 84 + 86: 6(float) Load 85 + Store 80(f) 86 + 88: 33 Load 35(m) + 89: 33 Load 35(m) + 90: 7(fvec4) CompositeExtract 88 0 + 91: 7(fvec4) CompositeExtract 89 0 + 92: 7(fvec4) FMul 90 91 + 93: 7(fvec4) CompositeExtract 88 1 + 94: 7(fvec4) CompositeExtract 89 1 + 95: 7(fvec4) FMul 93 94 + 96: 7(fvec4) CompositeExtract 88 2 + 97: 7(fvec4) CompositeExtract 89 2 + 98: 7(fvec4) FMul 96 97 + 99: 7(fvec4) CompositeExtract 88 3 + 100: 7(fvec4) CompositeExtract 89 3 + 101: 7(fvec4) FMul 99 100 + 102: 33 CompositeConstruct 92 95 98 101 + 105: 6(float) CompositeExtract 102 2 1 + Store 87(g) 105 + Store 106(h) 12 + 112: 109 Load 111(samp2D) + 116: 7(fvec4) ImageSampleImplicitLod 112 115 + 117: 6(float) CompositeExtract 116 1 + Store 107(i) 117 + 120: 6(float) Load 107(i) + 123: 122(bool) FOrdGreaterThan 120 121 + SelectionMerge 125 None + BranchConditional 123 124 127 + 124: Label + 126: 7(fvec4) Load 9(v1) + Store 119 126 + Branch 125 + 127: Label + 128: 7(fvec4) Load 15(v2) + Store 119 128 + Branch 125 + 125: Label + 129: 79(ptr) AccessChain 119 84 + 130: 6(float) Load 129 + 131: 6(float) Load 107(i) + 132: 6(float) FAdd 131 130 + Store 107(i) 132 + Store 136(t) 144 + 145: 6(float) CompositeExtract 144 1 2 1 + 146: 6(float) Load 107(i) + 147: 6(float) FAdd 146 145 + Store 107(i) 147 + 150: 6(float) Load 80(f) + 151: 6(float) Load 87(g) + 152: 6(float) Load 106(h) + 153: 6(float) Load 107(i) + 154: 7(fvec4) CompositeConstruct 150 151 152 153 + Store 149(gl_FragColor) 154 + Return + FunctionEnd diff --git a/Test/baseResults/spv.matrix.frag.out b/Test/baseResults/spv.matrix.frag.out index e9496067..511be17b 100644 --- a/Test/baseResults/spv.matrix.frag.out +++ b/Test/baseResults/spv.matrix.frag.out @@ -3,4 +3,284 @@ spv.matrix.frag Linked fragment stage: -Missing functionality: Composite comparison of non-vectors +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 240 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 12 14 28 148 140 166 + ExecutionMode 4 OriginLowerLeft + Source GLSL 130 + Name 4 "main" + Name 10 "sum34" + Name 12 "m1" + Name 14 "m2" + Name 28 "f" + Name 138 "sum3" + Name 140 "v4" + Name 145 "sum4" + Name 148 "v3" + Name 153 "m43" + Name 158 "m4" + Name 166 "color" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeMatrix 7(fvec4) 3 + 9: TypePointer Function 8 + 11: TypePointer Input 8 + 12(m1): 11(ptr) Variable Input + 14(m2): 11(ptr) Variable Input + 27: TypePointer Input 6(float) + 28(f): 27(ptr) Variable Input + 81: 6(float) Constant 1065353216 + 136: TypeVector 6(float) 3 + 137: TypePointer Function 136(fvec3) + 139: TypePointer Input 7(fvec4) + 140(v4): 139(ptr) Variable Input + 144: TypePointer Function 7(fvec4) + 147: TypePointer Input 136(fvec3) + 148(v3): 147(ptr) Variable Input + 151: TypeMatrix 136(fvec3) 4 + 152: TypePointer Function 151 + 156: TypeMatrix 7(fvec4) 4 + 157: TypePointer Function 156 + 165: TypePointer Output 7(fvec4) + 166(color): 165(ptr) Variable Output + 187: 6(float) Constant 0 + 4(main): 2 Function None 3 + 5: Label + 10(sum34): 9(ptr) Variable Function + 138(sum3): 137(ptr) Variable Function + 145(sum4): 144(ptr) Variable Function + 153(m43): 152(ptr) Variable Function + 158(m4): 157(ptr) Variable Function + 13: 8 Load 12(m1) + 15: 8 Load 14(m2) + 16: 7(fvec4) CompositeExtract 13 0 + 17: 7(fvec4) CompositeExtract 15 0 + 18: 7(fvec4) FSub 16 17 + 19: 7(fvec4) CompositeExtract 13 1 + 20: 7(fvec4) CompositeExtract 15 1 + 21: 7(fvec4) FSub 19 20 + 22: 7(fvec4) CompositeExtract 13 2 + 23: 7(fvec4) CompositeExtract 15 2 + 24: 7(fvec4) FSub 22 23 + 25: 8 CompositeConstruct 18 21 24 + Store 10(sum34) 25 + 26: 8 Load 12(m1) + 29: 6(float) Load 28(f) + 30: 8 MatrixTimesScalar 26 29 + 31: 8 Load 10(sum34) + 32: 7(fvec4) CompositeExtract 31 0 + 33: 7(fvec4) CompositeExtract 30 0 + 34: 7(fvec4) FAdd 32 33 + 35: 7(fvec4) CompositeExtract 31 1 + 36: 7(fvec4) CompositeExtract 30 1 + 37: 7(fvec4) FAdd 35 36 + 38: 7(fvec4) CompositeExtract 31 2 + 39: 7(fvec4) CompositeExtract 30 2 + 40: 7(fvec4) FAdd 38 39 + 41: 8 CompositeConstruct 34 37 40 + Store 10(sum34) 41 + 42: 6(float) Load 28(f) + 43: 8 Load 12(m1) + 44: 8 MatrixTimesScalar 43 42 + 45: 8 Load 10(sum34) + 46: 7(fvec4) CompositeExtract 45 0 + 47: 7(fvec4) CompositeExtract 44 0 + 48: 7(fvec4) FAdd 46 47 + 49: 7(fvec4) CompositeExtract 45 1 + 50: 7(fvec4) CompositeExtract 44 1 + 51: 7(fvec4) FAdd 49 50 + 52: 7(fvec4) CompositeExtract 45 2 + 53: 7(fvec4) CompositeExtract 44 2 + 54: 7(fvec4) FAdd 52 53 + 55: 8 CompositeConstruct 48 51 54 + Store 10(sum34) 55 + 56: 8 Load 12(m1) + 57: 8 Load 14(m2) + 58: 7(fvec4) CompositeExtract 56 0 + 59: 7(fvec4) CompositeExtract 57 0 + 60: 7(fvec4) FMul 58 59 + 61: 7(fvec4) CompositeExtract 56 1 + 62: 7(fvec4) CompositeExtract 57 1 + 63: 7(fvec4) FMul 61 62 + 64: 7(fvec4) CompositeExtract 56 2 + 65: 7(fvec4) CompositeExtract 57 2 + 66: 7(fvec4) FMul 64 65 + 67: 8 CompositeConstruct 60 63 66 + 68: 8 Load 10(sum34) + 69: 7(fvec4) CompositeExtract 68 0 + 70: 7(fvec4) CompositeExtract 67 0 + 71: 7(fvec4) FDiv 69 70 + 72: 7(fvec4) CompositeExtract 68 1 + 73: 7(fvec4) CompositeExtract 67 1 + 74: 7(fvec4) FDiv 72 73 + 75: 7(fvec4) CompositeExtract 68 2 + 76: 7(fvec4) CompositeExtract 67 2 + 77: 7(fvec4) FDiv 75 76 + 78: 8 CompositeConstruct 71 74 77 + Store 10(sum34) 78 + 79: 8 Load 12(m1) + 80: 6(float) Load 28(f) + 82: 6(float) FDiv 81 80 + 83: 8 MatrixTimesScalar 79 82 + 84: 8 Load 10(sum34) + 85: 7(fvec4) CompositeExtract 84 0 + 86: 7(fvec4) CompositeExtract 83 0 + 87: 7(fvec4) FAdd 85 86 + 88: 7(fvec4) CompositeExtract 84 1 + 89: 7(fvec4) CompositeExtract 83 1 + 90: 7(fvec4) FAdd 88 89 + 91: 7(fvec4) CompositeExtract 84 2 + 92: 7(fvec4) CompositeExtract 83 2 + 93: 7(fvec4) FAdd 91 92 + 94: 8 CompositeConstruct 87 90 93 + Store 10(sum34) 94 + 95: 6(float) Load 28(f) + 96: 8 Load 12(m1) + 97: 7(fvec4) CompositeConstruct 95 95 95 95 + 98: 7(fvec4) CompositeExtract 96 0 + 99: 7(fvec4) FDiv 97 98 + 100: 7(fvec4) CompositeExtract 96 1 + 101: 7(fvec4) FDiv 97 100 + 102: 7(fvec4) CompositeExtract 96 2 + 103: 7(fvec4) FDiv 97 102 + 104: 8 CompositeConstruct 99 101 103 + 105: 8 Load 10(sum34) + 106: 7(fvec4) CompositeExtract 105 0 + 107: 7(fvec4) CompositeExtract 104 0 + 108: 7(fvec4) FAdd 106 107 + 109: 7(fvec4) CompositeExtract 105 1 + 110: 7(fvec4) CompositeExtract 104 1 + 111: 7(fvec4) FAdd 109 110 + 112: 7(fvec4) CompositeExtract 105 2 + 113: 7(fvec4) CompositeExtract 104 2 + 114: 7(fvec4) FAdd 112 113 + 115: 8 CompositeConstruct 108 111 114 + Store 10(sum34) 115 + 116: 6(float) Load 28(f) + 117: 8 Load 10(sum34) + 118: 7(fvec4) CompositeConstruct 116 116 116 116 + 119: 7(fvec4) CompositeExtract 117 0 + 120: 7(fvec4) FAdd 119 118 + 121: 7(fvec4) CompositeExtract 117 1 + 122: 7(fvec4) FAdd 121 118 + 123: 7(fvec4) CompositeExtract 117 2 + 124: 7(fvec4) FAdd 123 118 + 125: 8 CompositeConstruct 120 122 124 + Store 10(sum34) 125 + 126: 6(float) Load 28(f) + 127: 8 Load 10(sum34) + 128: 7(fvec4) CompositeConstruct 126 126 126 126 + 129: 7(fvec4) CompositeExtract 127 0 + 130: 7(fvec4) FSub 129 128 + 131: 7(fvec4) CompositeExtract 127 1 + 132: 7(fvec4) FSub 131 128 + 133: 7(fvec4) CompositeExtract 127 2 + 134: 7(fvec4) FSub 133 128 + 135: 8 CompositeConstruct 130 132 134 + Store 10(sum34) 135 + 141: 7(fvec4) Load 140(v4) + 142: 8 Load 14(m2) + 143: 136(fvec3) VectorTimesMatrix 141 142 + Store 138(sum3) 143 + 146: 8 Load 14(m2) + 149: 136(fvec3) Load 148(v3) + 150: 7(fvec4) MatrixTimesVector 146 149 + Store 145(sum4) 150 + 154: 8 Load 10(sum34) + 155: 151 Transpose 154 + Store 153(m43) 155 + 159: 8 Load 12(m1) + 160: 151 Load 153(m43) + 161: 156 MatrixTimesMatrix 159 160 + Store 158(m4) 161 + 162: 7(fvec4) Load 140(v4) + 163: 156 Load 158(m4) + 164: 7(fvec4) VectorTimesMatrix 162 163 + Store 145(sum4) 164 + 167: 7(fvec4) Load 145(sum4) + Store 166(color) 167 + 168: 8 Load 10(sum34) + 169: 7(fvec4) CompositeConstruct 81 81 81 81 + 170: 7(fvec4) CompositeExtract 168 0 + 171: 7(fvec4) FAdd 170 169 + 172: 7(fvec4) CompositeExtract 168 1 + 173: 7(fvec4) FAdd 172 169 + 174: 7(fvec4) CompositeExtract 168 2 + 175: 7(fvec4) FAdd 174 169 + 176: 8 CompositeConstruct 171 173 175 + Store 10(sum34) 176 + 177: 8 Load 10(sum34) + 178: 7(fvec4) CompositeConstruct 81 81 81 81 + 179: 7(fvec4) CompositeExtract 177 0 + 180: 7(fvec4) FSub 179 178 + 181: 7(fvec4) CompositeExtract 177 1 + 182: 7(fvec4) FSub 181 178 + 183: 7(fvec4) CompositeExtract 177 2 + 184: 7(fvec4) FSub 183 178 + 185: 8 CompositeConstruct 180 182 184 + Store 10(sum34) 185 + 186: 6(float) Load 28(f) + 188: 7(fvec4) CompositeConstruct 186 187 187 187 + 189: 7(fvec4) CompositeConstruct 187 186 187 187 + 190: 7(fvec4) CompositeConstruct 187 187 186 187 + 191: 8 CompositeConstruct 188 189 190 + 192: 8 Load 10(sum34) + 193: 7(fvec4) CompositeExtract 192 0 + 194: 7(fvec4) CompositeExtract 191 0 + 195: 7(fvec4) FAdd 193 194 + 196: 7(fvec4) CompositeExtract 192 1 + 197: 7(fvec4) CompositeExtract 191 1 + 198: 7(fvec4) FAdd 196 197 + 199: 7(fvec4) CompositeExtract 192 2 + 200: 7(fvec4) CompositeExtract 191 2 + 201: 7(fvec4) FAdd 199 200 + 202: 8 CompositeConstruct 195 198 201 + Store 10(sum34) 202 + 203: 136(fvec3) Load 148(v3) + 204: 6(float) Load 28(f) + 205: 136(fvec3) Load 148(v3) + 206: 6(float) Load 28(f) + 207: 136(fvec3) Load 148(v3) + 208: 6(float) Load 28(f) + 209: 6(float) CompositeExtract 203 0 + 210: 6(float) CompositeExtract 203 1 + 211: 6(float) CompositeExtract 203 2 + 212: 6(float) CompositeExtract 205 0 + 213: 6(float) CompositeExtract 205 1 + 214: 6(float) CompositeExtract 205 2 + 215: 6(float) CompositeExtract 207 0 + 216: 6(float) CompositeExtract 207 1 + 217: 6(float) CompositeExtract 207 2 + 218: 7(fvec4) CompositeConstruct 209 210 211 204 + 219: 7(fvec4) CompositeConstruct 212 213 214 206 + 220: 7(fvec4) CompositeConstruct 215 216 217 208 + 221: 8 CompositeConstruct 218 219 220 + 222: 8 Load 10(sum34) + 223: 7(fvec4) CompositeExtract 222 0 + 224: 7(fvec4) CompositeExtract 221 0 + 225: 7(fvec4) FAdd 223 224 + 226: 7(fvec4) CompositeExtract 222 1 + 227: 7(fvec4) CompositeExtract 221 1 + 228: 7(fvec4) FAdd 226 227 + 229: 7(fvec4) CompositeExtract 222 2 + 230: 7(fvec4) CompositeExtract 221 2 + 231: 7(fvec4) FAdd 229 230 + 232: 8 CompositeConstruct 225 228 231 + Store 10(sum34) 232 + 233: 136(fvec3) Load 138(sum3) + 234: 151 Load 153(m43) + 235: 7(fvec4) VectorTimesMatrix 233 234 + 236: 7(fvec4) Load 145(sum4) + 237: 7(fvec4) FAdd 235 236 + 238: 7(fvec4) Load 166(color) + 239: 7(fvec4) FAdd 238 237 + Store 166(color) 239 + Return + FunctionEnd diff --git a/Test/baseResults/spv.matrix2.frag.out b/Test/baseResults/spv.matrix2.frag.out index 1772387f..957f3bdf 100644 --- a/Test/baseResults/spv.matrix2.frag.out +++ b/Test/baseResults/spv.matrix2.frag.out @@ -1,10 +1,265 @@ spv.matrix2.frag -WARNING: 0:4: varying deprecated in version 130; may be removed in future release -WARNING: 0:13: varying deprecated in version 130; may be removed in future release -WARNING: 0:15: varying deprecated in version 130; may be removed in future release - Linked fragment stage: -Missing functionality: binary operation on matrix +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 213 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 210 38 211 212 87 65 150 173 139 12 16 37 + ExecutionMode 4 OriginLowerLeft + Source GLSL 150 + Name 4 "main" + Name 10 "m34" + Name 12 "v" + Name 16 "u" + Name 37 "FragColor" + Name 38 "Color" + Name 63 "m44" + Name 65 "un34" + Name 87 "um43" + Name 139 "um4" + Name 148 "inv" + Name 150 "um2" + Name 171 "inv3" + Name 173 "um3" + Name 182 "inv4" + Name 210 "colorTransform" + Name 211 "m" + Name 212 "n" + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeFloat 32 + 7: TypeVector 6(float) 4 + 8: TypeMatrix 7(fvec4) 3 + 9: TypePointer Function 8 + 11: TypePointer Input 7(fvec4) + 12(v): 11(ptr) Variable Input + 14: TypeVector 6(float) 3 + 15: TypePointer Input 14(fvec3) + 16(u): 15(ptr) Variable Input + 19: 6(float) Constant 1082759578 + 20: 6(float) Constant 0 + 21: 7(fvec4) ConstantComposite 19 20 20 20 + 22: 7(fvec4) ConstantComposite 20 19 20 20 + 23: 7(fvec4) ConstantComposite 20 20 19 20 + 24: 8 ConstantComposite 21 22 23 + 36: TypePointer Output 7(fvec4) + 37(FragColor): 36(ptr) Variable Output + 38(Color): 15(ptr) Variable Input + 40: 6(float) Constant 1065353216 + 54: TypeInt 32 0 + 55: 54(int) Constant 0 + 56: TypePointer Input 6(float) + 61: TypeMatrix 7(fvec4) 4 + 62: TypePointer Function 61 + 64: TypePointer Input 8 + 65(un34): 64(ptr) Variable Input + 85: TypeMatrix 14(fvec3) 4 + 86: TypePointer Input 85 + 87(um43): 86(ptr) Variable Input + 138: TypePointer Input 61 + 139(um4): 138(ptr) Variable Input + 145: TypeVector 6(float) 2 + 146: TypeMatrix 145(fvec2) 2 + 147: TypePointer Function 146 + 149: TypePointer Input 146 + 150(um2): 149(ptr) Variable Input + 153: TypeInt 32 1 + 154: 153(int) Constant 0 + 155: TypePointer Function 6(float) + 158: 153(int) Constant 1 + 161: 54(int) Constant 1 + 169: TypeMatrix 14(fvec3) 3 + 170: TypePointer Function 169 + 172: TypePointer Input 169 + 173(um3): 172(ptr) Variable Input + 176: 153(int) Constant 2 + 202: 54(int) Constant 3 + 203: TypePointer Output 6(float) +210(colorTransform): 172(ptr) Variable Input + 211(m): 138(ptr) Variable Input + 212(n): 138(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 10(m34): 9(ptr) Variable Function + 63(m44): 62(ptr) Variable Function + 148(inv): 147(ptr) Variable Function + 171(inv3): 170(ptr) Variable Function + 182(inv4): 62(ptr) Variable Function + 13: 7(fvec4) Load 12(v) + 17: 14(fvec3) Load 16(u) + 18: 8 OuterProduct 13 17 + Store 10(m34) 18 + 25: 8 Load 10(m34) + 26: 7(fvec4) CompositeExtract 25 0 + 27: 7(fvec4) CompositeExtract 24 0 + 28: 7(fvec4) FAdd 26 27 + 29: 7(fvec4) CompositeExtract 25 1 + 30: 7(fvec4) CompositeExtract 24 1 + 31: 7(fvec4) FAdd 29 30 + 32: 7(fvec4) CompositeExtract 25 2 + 33: 7(fvec4) CompositeExtract 24 2 + 34: 7(fvec4) FAdd 32 33 + 35: 8 CompositeConstruct 28 31 34 + Store 10(m34) 35 + 39: 14(fvec3) Load 38(Color) + 41: 6(float) CompositeExtract 39 0 + 42: 6(float) CompositeExtract 39 1 + 43: 6(float) CompositeExtract 39 2 + 44: 7(fvec4) CompositeConstruct 41 42 43 40 + Store 37(FragColor) 44 + 45: 7(fvec4) Load 37(FragColor) + 46: 8 Load 10(m34) + 47: 14(fvec3) VectorTimesMatrix 45 46 + 48: 6(float) CompositeExtract 47 0 + 49: 6(float) CompositeExtract 47 1 + 50: 6(float) CompositeExtract 47 2 + 51: 7(fvec4) CompositeConstruct 48 49 50 40 + 52: 7(fvec4) Load 37(FragColor) + 53: 7(fvec4) FMul 52 51 + Store 37(FragColor) 53 + 57: 56(ptr) AccessChain 12(v) 55 + 58: 6(float) Load 57 + 59: 8 Load 10(m34) + 60: 8 MatrixTimesScalar 59 58 + Store 10(m34) 60 + 66: 8 Load 65(un34) + 67: 6(float) CompositeExtract 66 0 0 + 68: 6(float) CompositeExtract 66 0 1 + 69: 6(float) CompositeExtract 66 0 2 + 70: 6(float) CompositeExtract 66 0 3 + 71: 6(float) CompositeExtract 66 1 0 + 72: 6(float) CompositeExtract 66 1 1 + 73: 6(float) CompositeExtract 66 1 2 + 74: 6(float) CompositeExtract 66 1 3 + 75: 6(float) CompositeExtract 66 2 0 + 76: 6(float) CompositeExtract 66 2 1 + 77: 6(float) CompositeExtract 66 2 2 + 78: 6(float) CompositeExtract 66 2 3 + 79: 7(fvec4) CompositeConstruct 67 68 69 70 + 80: 7(fvec4) CompositeConstruct 71 72 73 74 + 81: 7(fvec4) CompositeConstruct 75 76 77 78 + 82: 7(fvec4) CompositeConstruct 20 20 20 40 + 83: 61 CompositeConstruct 79 80 81 82 + Store 63(m44) 83 + 84: 8 Load 10(m34) + 88: 85 Load 87(um43) + 89: 61 MatrixTimesMatrix 84 88 + 90: 61 Load 63(m44) + 91: 7(fvec4) CompositeExtract 90 0 + 92: 7(fvec4) CompositeExtract 89 0 + 93: 7(fvec4) FAdd 91 92 + 94: 7(fvec4) CompositeExtract 90 1 + 95: 7(fvec4) CompositeExtract 89 1 + 96: 7(fvec4) FAdd 94 95 + 97: 7(fvec4) CompositeExtract 90 2 + 98: 7(fvec4) CompositeExtract 89 2 + 99: 7(fvec4) FAdd 97 98 + 100: 7(fvec4) CompositeExtract 90 3 + 101: 7(fvec4) CompositeExtract 89 3 + 102: 7(fvec4) FAdd 100 101 + 103: 61 CompositeConstruct 93 96 99 102 + Store 63(m44) 103 + 104: 61 Load 63(m44) + 105: 61 FNegate 104 + 106: 7(fvec4) Load 12(v) + 107: 7(fvec4) MatrixTimesVector 105 106 + 108: 7(fvec4) Load 37(FragColor) + 109: 7(fvec4) FAdd 108 107 + Store 37(FragColor) 109 + 110: 61 Load 63(m44) + 111: 61 Load 63(m44) + 112: 7(fvec4) CompositeExtract 110 0 + 113: 7(fvec4) CompositeExtract 111 0 + 114: 7(fvec4) FMul 112 113 + 115: 7(fvec4) CompositeExtract 110 1 + 116: 7(fvec4) CompositeExtract 111 1 + 117: 7(fvec4) FMul 115 116 + 118: 7(fvec4) CompositeExtract 110 2 + 119: 7(fvec4) CompositeExtract 111 2 + 120: 7(fvec4) FMul 118 119 + 121: 7(fvec4) CompositeExtract 110 3 + 122: 7(fvec4) CompositeExtract 111 3 + 123: 7(fvec4) FMul 121 122 + 124: 61 CompositeConstruct 114 117 120 123 + 125: 7(fvec4) Load 37(FragColor) + 126: 7(fvec4) VectorTimesMatrix 125 124 + Store 37(FragColor) 126 + 127: 85 Load 87(um43) + 128: 8 Transpose 127 + Store 10(m34) 128 + 129: 7(fvec4) Load 37(FragColor) + 130: 8 Load 10(m34) + 131: 14(fvec3) VectorTimesMatrix 129 130 + 132: 6(float) CompositeExtract 131 0 + 133: 6(float) CompositeExtract 131 1 + 134: 6(float) CompositeExtract 131 2 + 135: 7(fvec4) CompositeConstruct 132 133 134 40 + 136: 7(fvec4) Load 37(FragColor) + 137: 7(fvec4) FMul 136 135 + Store 37(FragColor) 137 + 140: 61 Load 139(um4) + 141: 6(float) ExtInst 1(GLSL.std.450) 33(Determinant) 140 + 142: 7(fvec4) CompositeConstruct 141 141 141 141 + 143: 7(fvec4) Load 37(FragColor) + 144: 7(fvec4) FMul 143 142 + Store 37(FragColor) 144 + 151: 146 Load 150(um2) + 152: 146 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 151 + Store 148(inv) 152 + 156: 155(ptr) AccessChain 148(inv) 154 55 + 157: 6(float) Load 156 + 159: 155(ptr) AccessChain 148(inv) 158 55 + 160: 6(float) Load 159 + 162: 155(ptr) AccessChain 148(inv) 154 161 + 163: 6(float) Load 162 + 164: 155(ptr) AccessChain 148(inv) 158 161 + 165: 6(float) Load 164 + 166: 7(fvec4) CompositeConstruct 157 160 163 165 + 167: 7(fvec4) Load 37(FragColor) + 168: 7(fvec4) FMul 167 166 + Store 37(FragColor) 168 + 174: 169 Load 173(um3) + 175: 169 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 174 + Store 171(inv3) 175 + 177: 155(ptr) AccessChain 171(inv3) 176 161 + 178: 6(float) Load 177 + 179: 7(fvec4) CompositeConstruct 178 178 178 178 + 180: 7(fvec4) Load 37(FragColor) + 181: 7(fvec4) FMul 180 179 + Store 37(FragColor) 181 + 183: 61 Load 139(um4) + 184: 61 ExtInst 1(GLSL.std.450) 34(MatrixInverse) 183 + Store 182(inv4) 184 + 185: 61 Load 182(inv4) + 186: 7(fvec4) Load 37(FragColor) + 187: 7(fvec4) VectorTimesMatrix 186 185 + Store 37(FragColor) 187 + 188: 7(fvec4) Load 37(FragColor) + 189: 8 Load 65(un34) + 190: 8 Load 65(un34) + 191: 7(fvec4) CompositeExtract 189 0 + 192: 7(fvec4) CompositeExtract 190 0 + 193: 7(fvec4) FMul 191 192 + 194: 7(fvec4) CompositeExtract 189 1 + 195: 7(fvec4) CompositeExtract 190 1 + 196: 7(fvec4) FMul 194 195 + 197: 7(fvec4) CompositeExtract 189 2 + 198: 7(fvec4) CompositeExtract 190 2 + 199: 7(fvec4) FMul 197 198 + 200: 8 CompositeConstruct 193 196 199 + 201: 14(fvec3) VectorTimesMatrix 188 200 + 204: 203(ptr) AccessChain 37(FragColor) 202 + 205: 6(float) Load 204 + 206: 6(float) CompositeExtract 201 0 + 207: 6(float) CompositeExtract 201 1 + 208: 6(float) CompositeExtract 201 2 + 209: 7(fvec4) CompositeConstruct 206 207 208 205 + Store 37(FragColor) 209 + Return + FunctionEnd diff --git a/Test/spv.300layout.vert b/Test/spv.300layout.vert index f5bb587f..38ff374c 100644 --- a/Test/spv.300layout.vert +++ b/Test/spv.300layout.vert @@ -7,7 +7,7 @@ out vec4 pos; out vec3 color; flat out int iout; -layout(shared, column_major, row_major) uniform; // default is now shared and row_major +layout(row_major) uniform; // default is now row_major layout(std140) uniform Transform { // layout of this block is std140 mat4 M1; // row_major diff --git a/Test/spv.matrix.frag b/Test/spv.matrix.frag index 381d3834..095bc83f 100644 --- a/Test/spv.matrix.frag +++ b/Test/spv.matrix.frag @@ -1,34 +1,45 @@ #version 130 -uniform mat3 colorTransform; -in vec3 Color; -uniform mat4 m, n; +in mat3x4 m1; +in mat3x4 m2; +in float f; +in vec3 v3; +in vec4 v4; -uniform mat4x3 um43; -uniform mat3x4 un34; - -in vec4 v; - -in vec3 u; +out vec4 color; void main() { - gl_FragColor = vec4(un34[1]); - gl_FragColor += vec4(Color * colorTransform, 1.0); + mat3x4 sum34; + vec3 sum3; + vec4 sum4; - if (m != n) - gl_FragColor += v; - else { - gl_FragColor += m * v; - gl_FragColor += v * (m - n); - } + sum34 = m1 - m2; + sum34 += m1 * f; + sum34 += f * m1; + sum34 /= matrixCompMult(m1, m2); + sum34 += m1 / f; + sum34 += f / m1; + sum34 += f; + sum34 -= f; - mat3x4 m34 = outerProduct(v, u); - m34 += mat3x4(v.x); - m34 += mat3x4(u, u.x, u, u.x, u, u.x); + sum3 = v4 * m2; + sum4 = m2 * v3; - if (m34 == un34) - gl_FragColor += m34 * u; - else - gl_FragColor += (un34 * um43) * v; + mat4x3 m43 = transpose(sum34); + mat4 m4 = m1 * m43; + + sum4 = v4 * m4; + + color = sum4; + +//spv if (m1 != sum34) + ++sum34; +// else + --sum34; + + sum34 += mat3x4(f); + sum34 += mat3x4(v3, f, v3, f, v3, f); + + color += sum3 * m43 + sum4; } diff --git a/Test/spv.matrix2.frag b/Test/spv.matrix2.frag index eb2c53c2..7fb6dd86 100644 --- a/Test/spv.matrix2.frag +++ b/Test/spv.matrix2.frag @@ -1,18 +1,18 @@ #version 150 -uniform mat3 colorTransform; -varying vec3 Color; -uniform mat4 m, n; +in mat3 colorTransform; +in vec3 Color; +in mat4 m, n; -uniform mat4x3 um43; -uniform mat3x4 un34; -uniform mat2 um2; -uniform mat3 um3; -uniform mat4 um4; +in mat4x3 um43; +in mat3x4 un34; +in mat2 um2; +in mat3 um3; +in mat4 um4; -varying vec4 v; +in vec4 v; -varying vec3 u; +in vec3 u; out vec4 FragColor; diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index a35b8be6..99a414a3 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -3,4 +3,4 @@ // For the date, it uses the current date (when then script is run). #define GLSLANG_REVISION "SPIRV99.841" -#define GLSLANG_DATE "11-Dec-2015" +#define GLSLANG_DATE "12-Dec-2015"