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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user