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;
|
break;
|
||||||
|
|
||||||
case glslang::EOpConvUintToInt:
|
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:
|
case glslang::EOpConvIntToUint:
|
||||||
if (builder.isInSpecConstCodeGenMode()) {
|
if (builder.isInSpecConstCodeGenMode()) {
|
||||||
// Build zero scalar or vector for OpIAdd.
|
// Build zero scalar or vector for OpIAdd.
|
||||||
if (zero == 0) {
|
zero = builder.makeUintConstant(0);
|
||||||
zero = builder.makeUintConstant(0);
|
zero = makeSmearedConstant(zero, vectorSize);
|
||||||
zero = makeSmearedConstant(zero, vectorSize);
|
|
||||||
}
|
|
||||||
// Use OpIAdd, instead of OpBitcast to do the conversion when
|
// Use OpIAdd, instead of OpBitcast to do the conversion when
|
||||||
// generating for OpSpecConstantOp instruction.
|
// generating for OpSpecConstantOp instruction.
|
||||||
return builder.createBinOp(spv::OpIAdd, destType, operand, zero);
|
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.
|
// generation mode.
|
||||||
if (generatingOpCodeForSpecConst) {
|
if (generatingOpCodeForSpecConst) {
|
||||||
std::vector<Id> operands(3);
|
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(
|
return createSpecConstantOp(
|
||||||
opCode, typeId, operands, std::vector<Id>());
|
opCode, typeId, operands, std::vector<Id>());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ Linked vertex stage:
|
|||||||
48: 41(int) Constant 1
|
48: 41(int) Constant 1
|
||||||
49: 41(int) SpecConstantOp 169 45 48 44
|
49: 41(int) SpecConstantOp 169 45 48 44
|
||||||
50: 41(int) SpecConstantOp 128 43 44
|
50: 41(int) SpecConstantOp 128 43 44
|
||||||
51: 6(int) SpecConstantOp 128 42 12
|
51: 6(int) SpecConstantOp 128 42 44
|
||||||
52: 6(int) SpecConstantOp 126 19
|
52: 6(int) SpecConstantOp 126 19
|
||||||
53: 6(int) SpecConstantOp 200 19
|
53: 6(int) SpecConstantOp 200 19
|
||||||
54: 6(int) SpecConstantOp 128 19 20
|
54: 6(int) SpecConstantOp 128 19 20
|
||||||
@@ -104,7 +104,7 @@ Linked vertex stage:
|
|||||||
102: 88(ivec4) ConstantComposite 48 48 48 48
|
102: 88(ivec4) ConstantComposite 48 48 48 48
|
||||||
103: 88(ivec4) SpecConstantOp 169 97 102 96
|
103: 88(ivec4) SpecConstantOp 169 97 102 96
|
||||||
104: 88(ivec4) SpecConstantOp 128 87 96
|
104: 88(ivec4) SpecConstantOp 128 87 96
|
||||||
105: 85(ivec4) SpecConstantOp 128 91 99
|
105: 85(ivec4) SpecConstantOp 128 91 96
|
||||||
106: 85(ivec4) SpecConstantOp 200 87
|
106: 85(ivec4) SpecConstantOp 200 87
|
||||||
107: 85(ivec4) SpecConstantOp 126 87
|
107: 85(ivec4) SpecConstantOp 126 87
|
||||||
108: 85(ivec4) ConstantComposite 20 20 20 20
|
108: 85(ivec4) ConstantComposite 20 20 20 20
|
||||||
|
|||||||
Reference in New Issue
Block a user