Refine the code and address comments
This commit is contained in:
@@ -3306,22 +3306,11 @@ spv::Id TGlslangToSpvTraverser::createConversion(glslang::TOperator op, spv::Dec
|
||||
break;
|
||||
|
||||
case glslang::EOpConvUintToInt:
|
||||
if (builder.isInSpecConstCodeGenMode()) {
|
||||
// Build zero scalar or vector for OpIAdd to do the conversion when
|
||||
// generating for OpSpecConstantOp instruction.
|
||||
zero = builder.makeIntConstant(0);
|
||||
zero = makeSmearedConstant(zero, vectorSize);
|
||||
}
|
||||
// Don't 'break' here as this case should be grouped together with
|
||||
// EOpConvIntToUint when generating normal run-time conversion
|
||||
// instruction.
|
||||
case glslang::EOpConvIntToUint:
|
||||
if (builder.isInSpecConstCodeGenMode()) {
|
||||
// Build zero scalar or vector for OpIAdd.
|
||||
if (zero == 0) {
|
||||
zero = builder.makeUintConstant(0);
|
||||
zero = makeSmearedConstant(zero, vectorSize);
|
||||
}
|
||||
zero = builder.makeUintConstant(0);
|
||||
zero = makeSmearedConstant(zero, vectorSize);
|
||||
// Use OpIAdd, instead of OpBitcast to do the conversion when
|
||||
// generating for OpSpecConstantOp instruction.
|
||||
return builder.createBinOp(spv::OpIAdd, destType, operand, zero);
|
||||
|
||||
@@ -1216,7 +1216,9 @@ Id Builder::createTriOp(Op opCode, Id typeId, Id op1, Id op2, Id op3)
|
||||
// generation mode.
|
||||
if (generatingOpCodeForSpecConst) {
|
||||
std::vector<Id> operands(3);
|
||||
operands[0] = op1; operands[1] = op2; operands[2] = op3;
|
||||
operands[0] = op1;
|
||||
operands[1] = op2;
|
||||
operands[2] = op3;
|
||||
return createSpecConstantOp(
|
||||
opCode, typeId, operands, std::vector<Id>());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user