Query which shader disassembly formats require a pipeline

* This allows us to be a bit more friendly in the UI when we don't have a
  particular pipeline associated with a shader.
This commit is contained in:
baldurk
2020-09-01 14:03:59 +01:00
parent 6b2f763bfa
commit 83f7a26ee9
19 changed files with 65 additions and 25 deletions
+35 -1
View File
@@ -385,7 +385,18 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
if(!me)
return;
rdcarray<rdcstr> targets = r->GetDisassemblyTargets();
rdcarray<rdcstr> targets = r->GetDisassemblyTargets(m_Pipeline != ResourceId());
if(m_Pipeline == ResourceId())
{
rdcarray<rdcstr> pipelineTargets = r->GetDisassemblyTargets(true);
if(pipelineTargets.size() > targets.size())
{
m_PipelineTargets = pipelineTargets;
m_PipelineTargets.removeIf([&targets](const rdcstr &t) { return targets.contains(t); });
}
}
rdcstr disasm = r->DisassembleShader(m_Pipeline, m_ShaderDetails, "");
@@ -410,6 +421,9 @@ void ShaderViewer::debugShader(const ShaderBindpointMapping *bind, const ShaderR
}
}
if(!m_PipelineTargets.empty())
targetNames << tr("More disassembly formats...");
m_DisassemblyType->clear();
m_DisassemblyType->addItems(targetNames);
m_DisassemblyType->setCurrentIndex(0);
@@ -1385,6 +1399,26 @@ void ShaderViewer::disassemble_typeChanged(int index)
}
}
if(targetStr == tr("More disassembly formats..."))
{
QString text;
text =
tr("; More disassembly formats are available with a pipeline. This shader view is not\n"
"; associated with any specific pipeline and shows only the shader itself.\n\n"
"; Viewing the shader from the pipeline state view with a pipeline bound will expose\n"
"; these other formats:\n\n");
for(const rdcstr &t : m_PipelineTargets)
text += QFormatStr("%1\n").arg(QString(t));
m_DisassemblyView->setReadOnly(false);
SetTextAndUpdateMargin0(m_DisassemblyView, text);
m_DisassemblyView->setReadOnly(true);
m_DisassemblyView->emptyUndoBuffer();
return;
}
QPointer<ShaderViewer> me(this);
m_Ctx.Replay().AsyncInvoke([me, this, target](IReplayController *r) {