commit
d4e4d00353
34 changed files with 1245 additions and 305 deletions
|
|
@ -79,6 +79,7 @@ set(PUBLIC_HEADERS
|
|||
SPVRemapper.h)
|
||||
|
||||
add_library(SPIRV ${LIB_TYPE} ${SOURCES} ${HEADERS})
|
||||
add_library(glslang::SPIRV ALIAS SPIRV)
|
||||
set_target_properties(SPIRV PROPERTIES
|
||||
FOLDER glslang
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
|
|
@ -92,6 +93,7 @@ glslang_add_build_info_dependency(SPIRV)
|
|||
|
||||
if (ENABLE_SPVREMAPPER)
|
||||
add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS})
|
||||
add_library(glslang::SPVRemapper ALIAS SPVRemapper)
|
||||
set_target_properties(SPVRemapper PROPERTIES
|
||||
FOLDER glslang
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
|
|
|
|||
|
|
@ -41,5 +41,6 @@ static const char* const E_SPV_EXT_shader_atomic_float_min_max = "SPV_EXT_shader
|
|||
static const char* const E_SPV_EXT_shader_image_int64 = "SPV_EXT_shader_image_int64";
|
||||
static const char* const E_SPV_EXT_shader_tile_image = "SPV_EXT_shader_tile_image";
|
||||
static const char* const E_SPV_EXT_mesh_shader = "SPV_EXT_mesh_shader";
|
||||
static const char* const E_SPV_ARM_cooperative_matrix_layouts = "SPV_ARM_cooperative_matrix_layouts";
|
||||
|
||||
#endif // #ifndef GLSLextEXT_H
|
||||
|
|
|
|||
|
|
@ -62,5 +62,6 @@ static const char* const E_SPV_KHR_maximal_reconvergence = "SPV_KHR_maxim
|
|||
static const char* const E_SPV_KHR_subgroup_rotate = "SPV_KHR_subgroup_rotate";
|
||||
static const char* const E_SPV_KHR_expect_assume = "SPV_KHR_expect_assume";
|
||||
static const char* const E_SPV_EXT_replicated_composites = "SPV_EXT_replicated_composites";
|
||||
static const char* const E_SPV_KHR_relaxed_extended_instruction = "SPV_KHR_relaxed_extended_instruction";
|
||||
|
||||
#endif // #ifndef GLSLextKHR_H
|
||||
|
|
|
|||
|
|
@ -3705,6 +3705,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||
idImmOps.push_back(spv::IdImmediate(true, operands[1])); // buf
|
||||
if (node->getOp() == glslang::EOpCooperativeMatrixLoad) {
|
||||
idImmOps.push_back(spv::IdImmediate(true, operands[3])); // matrixLayout
|
||||
auto layout = builder.getConstantScalar(operands[3]);
|
||||
if (layout == spv::CooperativeMatrixLayoutRowBlockedInterleavedARM ||
|
||||
layout == spv::CooperativeMatrixLayoutColumnBlockedInterleavedARM) {
|
||||
builder.addExtension(spv::E_SPV_ARM_cooperative_matrix_layouts);
|
||||
builder.addCapability(spv::CapabilityCooperativeMatrixLayoutsARM);
|
||||
}
|
||||
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
|
||||
} else {
|
||||
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
|
||||
|
|
@ -3729,6 +3735,12 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
|||
idImmOps.push_back(spv::IdImmediate(true, operands[0])); // object
|
||||
if (node->getOp() == glslang::EOpCooperativeMatrixStore) {
|
||||
idImmOps.push_back(spv::IdImmediate(true, operands[3])); // matrixLayout
|
||||
auto layout = builder.getConstantScalar(operands[3]);
|
||||
if (layout == spv::CooperativeMatrixLayoutRowBlockedInterleavedARM ||
|
||||
layout == spv::CooperativeMatrixLayoutColumnBlockedInterleavedARM) {
|
||||
builder.addExtension(spv::E_SPV_ARM_cooperative_matrix_layouts);
|
||||
builder.addCapability(spv::CapabilityCooperativeMatrixLayoutsARM);
|
||||
}
|
||||
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
|
||||
} else {
|
||||
idImmOps.push_back(spv::IdImmediate(true, operands[2])); // stride
|
||||
|
|
|
|||
|
|
@ -182,6 +182,10 @@ Id Builder::makeForwardPointer(StorageClass storageClass)
|
|||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
if (emitNonSemanticShaderDebugInfo) {
|
||||
const Id debugResultId = makeForwardPointerDebugType(storageClass);
|
||||
debugId[type->getResultId()] = debugResultId;
|
||||
}
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
|
|
@ -204,6 +208,15 @@ Id Builder::makePointerFromForwardPointer(StorageClass storageClass, Id forwardP
|
|||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
// If we are emitting nonsemantic debuginfo, we need to patch the debug pointer type
|
||||
// that was emitted alongside the forward pointer, now that we have a pointee debug
|
||||
// type for it to point to.
|
||||
if (emitNonSemanticShaderDebugInfo) {
|
||||
Instruction *debugForwardPointer = module.getInstruction(debugId[forwardPointerType]);
|
||||
assert(debugId[pointee]);
|
||||
debugForwardPointer->setIdOperand(2, debugId[pointee]);
|
||||
}
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
|
|
@ -1045,6 +1058,29 @@ Id Builder::makePointerDebugType(StorageClass storageClass, Id const baseType)
|
|||
return type->getResultId();
|
||||
}
|
||||
|
||||
// Emit a OpExtInstWithForwardRefsKHR nonsemantic instruction for a pointer debug type
|
||||
// where we don't have the pointee yet. Since we don't have the pointee yet, it just
|
||||
// points to itself and we rely on patching it later.
|
||||
Id Builder::makeForwardPointerDebugType(StorageClass storageClass)
|
||||
{
|
||||
const Id scID = makeUintConstant(storageClass);
|
||||
|
||||
this->addExtension(spv::E_SPV_KHR_relaxed_extended_instruction);
|
||||
|
||||
Instruction *type = new Instruction(getUniqueId(), makeVoidType(), OpExtInstWithForwardRefsKHR);
|
||||
type->addIdOperand(nonSemanticShaderDebugInfo);
|
||||
type->addImmediateOperand(NonSemanticShaderDebugInfo100DebugTypePointer);
|
||||
type->addIdOperand(type->getResultId());
|
||||
type->addIdOperand(scID);
|
||||
type->addIdOperand(makeUintConstant(0));
|
||||
|
||||
groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypePointer].push_back(type);
|
||||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
Id Builder::makeDebugSource(const Id fileName) {
|
||||
if (debugSourceId.find(fileName) != debugSourceId.end())
|
||||
return debugSourceId[fileName];
|
||||
|
|
|
|||
|
|
@ -235,6 +235,7 @@ public:
|
|||
Id makeCompositeDebugType(std::vector<Id> const& memberTypes, char const*const name,
|
||||
NonSemanticShaderDebugInfo100DebugCompositeType const tag, bool const isOpaqueType = false);
|
||||
Id makePointerDebugType(StorageClass storageClass, Id const baseType);
|
||||
Id makeForwardPointerDebugType(StorageClass storageClass);
|
||||
Id makeDebugSource(const Id fileName);
|
||||
Id makeDebugCompilationUnit();
|
||||
Id createDebugGlobalVariable(Id const type, char const*const name, Id const variable);
|
||||
|
|
|
|||
|
|
@ -1035,6 +1035,8 @@ const char* CapabilityString(int info)
|
|||
case CapabilityTileImageDepthReadAccessEXT: return "TileImageDepthReadAccessEXT";
|
||||
case CapabilityTileImageStencilReadAccessEXT: return "TileImageStencilReadAccessEXT";
|
||||
|
||||
case CapabilityCooperativeMatrixLayoutsARM: return "CooperativeMatrixLayoutsARM";
|
||||
|
||||
case CapabilityFragmentShadingRateKHR: return "FragmentShadingRateKHR";
|
||||
|
||||
case CapabilityDemoteToHelperInvocationEXT: return "DemoteToHelperInvocationEXT";
|
||||
|
|
@ -1445,6 +1447,7 @@ const char* OpcodeString(int op)
|
|||
case 4429: return "OpSubgroupAnyKHR";
|
||||
case 4430: return "OpSubgroupAllEqualKHR";
|
||||
case 4432: return "OpSubgroupReadInvocationKHR";
|
||||
case 4433: return "OpExtInstWithForwardRefsKHR";
|
||||
|
||||
case OpGroupNonUniformQuadAllKHR: return "OpGroupNonUniformQuadAllKHR";
|
||||
case OpGroupNonUniformQuadAnyKHR: return "OpGroupNonUniformQuadAnyKHR";
|
||||
|
|
@ -1896,6 +1899,10 @@ void Parameterize()
|
|||
InstructionDesc[OpExtInst].operands.push(OperandLiteralNumber, "'Instruction'");
|
||||
InstructionDesc[OpExtInst].operands.push(OperandVariableIds, "'Operand 1', +\n'Operand 2', +\n...");
|
||||
|
||||
InstructionDesc[OpExtInstWithForwardRefsKHR].operands.push(OperandId, "'Set'");
|
||||
InstructionDesc[OpExtInstWithForwardRefsKHR].operands.push(OperandLiteralNumber, "'Instruction'");
|
||||
InstructionDesc[OpExtInstWithForwardRefsKHR].operands.push(OperandVariableIds, "'Operand 1', +\n'Operand 2', +\n...");
|
||||
|
||||
InstructionDesc[OpLoad].operands.push(OperandId, "'Pointer'");
|
||||
InstructionDesc[OpLoad].operands.push(OperandMemoryAccess, "", true);
|
||||
InstructionDesc[OpLoad].operands.push(OperandLiteralNumber, "", true);
|
||||
|
|
|
|||
|
|
@ -1002,6 +1002,7 @@ enum Capability {
|
|||
CapabilityTileImageColorReadAccessEXT = 4166,
|
||||
CapabilityTileImageDepthReadAccessEXT = 4167,
|
||||
CapabilityTileImageStencilReadAccessEXT = 4168,
|
||||
CapabilityCooperativeMatrixLayoutsARM = 4201,
|
||||
CapabilityFragmentShadingRateKHR = 4422,
|
||||
CapabilitySubgroupBallotKHR = 4423,
|
||||
CapabilityDrawParameters = 4427,
|
||||
|
|
@ -1302,6 +1303,8 @@ enum CooperativeMatrixOperandsMask {
|
|||
enum CooperativeMatrixLayout {
|
||||
CooperativeMatrixLayoutRowMajorKHR = 0,
|
||||
CooperativeMatrixLayoutColumnMajorKHR = 1,
|
||||
CooperativeMatrixLayoutRowBlockedInterleavedARM = 4202,
|
||||
CooperativeMatrixLayoutColumnBlockedInterleavedARM = 4203,
|
||||
CooperativeMatrixLayoutMax = 0x7fffffff,
|
||||
};
|
||||
|
||||
|
|
@ -1668,6 +1671,7 @@ enum Op {
|
|||
OpSubgroupAllEqualKHR = 4430,
|
||||
OpGroupNonUniformRotateKHR = 4431,
|
||||
OpSubgroupReadInvocationKHR = 4432,
|
||||
OpExtInstWithForwardRefsKHR = 4433,
|
||||
OpTraceRayKHR = 4445,
|
||||
OpExecuteCallableKHR = 4446,
|
||||
OpConvertUToAccelerationStructureKHR = 4447,
|
||||
|
|
@ -2395,6 +2399,7 @@ inline void HasResultAndType(Op opcode, bool *hasResult, bool *hasResultType) {
|
|||
case OpPtrEqual: *hasResult = true; *hasResultType = true; break;
|
||||
case OpPtrNotEqual: *hasResult = true; *hasResultType = true; break;
|
||||
case OpPtrDiff: *hasResult = true; *hasResultType = true; break;
|
||||
case OpExtInstWithForwardRefsKHR: *hasResult = true; *hasResultType = true; break;
|
||||
case OpColorAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpDepthAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
|
||||
case OpStencilAttachmentReadEXT: *hasResult = true; *hasResultType = true; break;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue