SPV 1.4: Add support for OpCopyLogical, careful of Boolean differences.
This commit is contained in:
parent
1f4d04687b
commit
fbb6bdf046
9 changed files with 636 additions and 0 deletions
|
|
@ -3656,6 +3656,20 @@ void TGlslangToSpvTraverser::multiTypeStore(const glslang::TType& type, spv::Id
|
|||
// where the two types were the same type in GLSL. This requires member
|
||||
// by member copy, recursively.
|
||||
|
||||
// SPIR-V 1.4 added an instruction to do help do this.
|
||||
if (glslangIntermediate->getSpv().spv >= glslang::EShTargetSpv_1_4) {
|
||||
// However, bool in uniform space is changed to int, so
|
||||
// OpCopyLogical does not work for that.
|
||||
// TODO: It would be more robust to do a full recursive verification of the types satisfying SPIR-V rules.
|
||||
bool rBool = builder.containsType(builder.getTypeId(rValue), spv::OpTypeBool, 0);
|
||||
bool lBool = builder.containsType(lType, spv::OpTypeBool, 0);
|
||||
if (lBool == rBool) {
|
||||
spv::Id logicalCopy = builder.createUnaryOp(spv::OpCopyLogical, lType, rValue);
|
||||
accessChainStore(type, logicalCopy);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// If an array, copy element by element.
|
||||
if (type.isArray()) {
|
||||
glslang::TType glslangElementType(type, 0);
|
||||
|
|
|
|||
|
|
@ -1031,6 +1031,7 @@ const char* OpcodeString(int op)
|
|||
case 82: return "OpCompositeInsert";
|
||||
case 83: return "OpCopyObject";
|
||||
case 84: return "OpTranspose";
|
||||
case OpCopyLogical: return "OpCopyLogical";
|
||||
case 85: return "Bad";
|
||||
case 86: return "OpSampledImage";
|
||||
case 87: return "OpImageSampleImplicitLod";
|
||||
|
|
@ -1938,6 +1939,8 @@ void Parameterize()
|
|||
|
||||
InstructionDesc[OpTranspose].operands.push(OperandId, "'Matrix'");
|
||||
|
||||
InstructionDesc[OpCopyLogical].operands.push(OperandId, "'Operand'");
|
||||
|
||||
InstructionDesc[OpIsNan].operands.push(OperandId, "'x'");
|
||||
|
||||
InstructionDesc[OpIsInf].operands.push(OperandId, "'x'");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue