зеркало из https://github.com/stride3d/xkslang.git
glslang -> SPV: swap arguments as needed for OpVectorTimesScalar and OpMatrixTimesScalar, and check for correct types for those as well as OpMatrixTimesVector, OpVectorTimesMatrix, and OpMatrixTimesMatrix.
git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@31486 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
Родитель
8d64d44c3f
Коммит
e5e0f6e37a
|
@ -1684,9 +1684,10 @@ spv::Id TGlslangToSpvTraverser::handleUserFunctionCall(const glslang::TIntermAgg
|
|||
return result;
|
||||
}
|
||||
|
||||
// Translate AST operation to SPV operation, already having SPV-based operands/types.
|
||||
spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv::Decoration precision,
|
||||
spv::Id typeId, spv::Id left, spv::Id right,
|
||||
glslang::TBasicType typeProxy, bool reduceComparison)
|
||||
spv::Id typeId, spv::Id left, spv::Id right,
|
||||
glslang::TBasicType typeProxy, bool reduceComparison)
|
||||
{
|
||||
bool isUnsigned = typeProxy == glslang::EbtUint;
|
||||
bool isFloat = typeProxy == glslang::EbtFloat || typeProxy == glslang::EbtDouble;
|
||||
|
@ -1719,22 +1720,34 @@ spv::Id TGlslangToSpvTraverser::createBinaryOperation(glslang::TOperator op, spv
|
|||
break;
|
||||
case glslang::EOpVectorTimesScalar:
|
||||
case glslang::EOpVectorTimesScalarAssign:
|
||||
if (builder.isVector(right))
|
||||
std::swap(left, right);
|
||||
assert(builder.isScalar(right));
|
||||
binOp = spv::OpVectorTimesScalar;
|
||||
needsPromotion = false;
|
||||
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:
|
||||
|
|
|
@ -73,7 +73,7 @@ Linked fragment stage:
|
|||
39: 16(int) Load 18(z)
|
||||
40: 7(float) ConvertSToF 39
|
||||
41: 35(fvec4) CompositeConstruct 40 40 40 40
|
||||
42: 35(fvec4) VectorTimesScalar 38 41
|
||||
42: 35(fvec4) VectorTimesScalar 41 38
|
||||
43: 7(float) FunctionCall 9(foo()
|
||||
44: 35(fvec4) CompositeConstruct 43 43 43 43
|
||||
45: 35(fvec4) FAdd 42 44
|
||||
|
|
|
@ -127,12 +127,12 @@ Linked geometry stage:
|
|||
EmitVertex
|
||||
55: 20(ptr) AccessChain 19(fromV) 13 13
|
||||
56: 8(fvec3) Load 55
|
||||
57: 8(fvec3) VectorTimesScalar 54 56
|
||||
57: 8(fvec3) VectorTimesScalar 56 54
|
||||
58: 23(ptr) AccessChain 11 13
|
||||
Store 58 57
|
||||
59: 35(ptr) AccessChain 34(gl_in) 13 13
|
||||
60: 25(fvec4) Load 59
|
||||
61: 25(fvec4) VectorTimesScalar 54 60
|
||||
61: 25(fvec4) VectorTimesScalar 60 54
|
||||
62: 38(ptr) AccessChain 30 13
|
||||
Store 62 61
|
||||
63: 42(ptr) AccessChain 34(gl_in) 41 40
|
||||
|
|
|
@ -145,7 +145,7 @@ Linked fragment stage:
|
|||
Store 74(v) 91
|
||||
94: 11(float) Load 67(z)
|
||||
95: 72(fvec4) Load 74(v)
|
||||
96: 72(fvec4) VectorTimesScalar 94 95
|
||||
96: 72(fvec4) VectorTimesScalar 95 94
|
||||
Store 93(gl_FragColor) 96
|
||||
Branch 6
|
||||
6: Label
|
||||
|
|
|
@ -90,7 +90,7 @@ Linked fragment stage:
|
|||
41: 38 Load 40(sampler)
|
||||
45: 42(fvec2) Load 44(coord)
|
||||
46: 30(fvec4) TextureSample 41 45
|
||||
47: 30(fvec4) VectorTimesScalar 37 46
|
||||
47: 30(fvec4) VectorTimesScalar 46 37
|
||||
Store 32(gl_FragColor) 47
|
||||
Branch 6
|
||||
6: Label
|
||||
|
|
|
@ -185,7 +185,7 @@ Linked fragment stage:
|
|||
114: 111 Load 113(sampler)
|
||||
115: 60(fvec2) Load 62(coord)
|
||||
116: 95(fvec4) TextureSample 114 115
|
||||
117: 95(fvec4) VectorTimesScalar 110 116
|
||||
117: 95(fvec4) VectorTimesScalar 116 110
|
||||
Store 97(gl_FragColor) 117
|
||||
Branch 6
|
||||
6: Label
|
||||
|
|
|
@ -97,7 +97,7 @@ Linked fragment stage:
|
|||
52: 49 Load 51(sampler)
|
||||
56: 53(fvec2) Load 55(coord)
|
||||
57: 17(fvec4) TextureSample 52 56
|
||||
58: 17(fvec4) VectorTimesScalar 48 57
|
||||
58: 17(fvec4) VectorTimesScalar 57 48
|
||||
Store 47(gl_FragColor) 58
|
||||
Branch 6
|
||||
6: Label
|
||||
|
|
|
@ -118,7 +118,7 @@ Linked fragment stage:
|
|||
60: 57 Load 59(sampler)
|
||||
64: 61(fvec2) Load 63(coord)
|
||||
65: 53(fvec4) TextureSample 60 64
|
||||
66: 53(fvec4) VectorTimesScalar 56 65
|
||||
66: 53(fvec4) VectorTimesScalar 65 56
|
||||
Store 55(gl_FragColor) 66
|
||||
70: 61(fvec2) Load 63(coord)
|
||||
71: 13(float) Load 31(scale)
|
||||
|
|
Загрузка…
Ссылка в новой задаче