Fix nonsemantic debuginfo line attribution for cooperative matrix
* Generate debuginfo for coopmat types, treating them as an opaque composite. Restore the debug source location after calling convertGlslangToSpvType, fixes the line info in this unit test * Add a cooperative matrix test case, based on the shader from https://github.com/jeffbolznv/vk_cooperative_matrix_perf/blob/master/shaders/shmem.comp
This commit is contained in:
parent
46ef757e04
commit
ca04c2a16a
9 changed files with 797 additions and 18 deletions
|
|
@ -439,6 +439,43 @@ Id Builder::makeCooperativeMatrixTypeKHR(Id component, Id scope, Id rows, Id col
|
|||
constantsTypesGlobals.push_back(std::unique_ptr<Instruction>(type));
|
||||
module.mapInstruction(type);
|
||||
|
||||
if (emitNonSemanticShaderDebugInfo)
|
||||
{
|
||||
// Find a name for one of the parameters. It can either come from debuginfo for another
|
||||
// type, or an OpName from a constant.
|
||||
auto const findName = [&](Id id) {
|
||||
Id id2 = debugId[id];
|
||||
for (auto &t : groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic]) {
|
||||
if (t->getResultId() == id2) {
|
||||
for (auto &s : strings) {
|
||||
if (s->getResultId() == t->getIdOperand(2)) {
|
||||
return s->getNameString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto &t : names) {
|
||||
if (t->getIdOperand(0) == id) {
|
||||
return t->getNameString();
|
||||
}
|
||||
}
|
||||
return "unknown";
|
||||
};
|
||||
std::string debugName = "coopmat<";
|
||||
debugName += std::string(findName(component)) + ", ";
|
||||
if (isConstantScalar(scope)) {
|
||||
debugName += std::string("gl_Scope") + std::string(spv::ScopeToString((spv::Scope)getConstantScalar(scope))) + ", ";
|
||||
} else {
|
||||
debugName += std::string(findName(scope)) + ", ";
|
||||
}
|
||||
debugName += std::string(findName(rows)) + ", ";
|
||||
debugName += std::string(findName(cols)) + ">";
|
||||
// There's no nonsemantic debug info instruction for cooperative matrix types,
|
||||
// use opaque composite instead.
|
||||
auto const debugResultId = makeCompositeDebugType({}, debugName.c_str(), NonSemanticShaderDebugInfo100Structure, true);
|
||||
debugId[type->getResultId()] = debugResultId;
|
||||
}
|
||||
|
||||
return type->getResultId();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue