Add a per-shader debuggable flag to allow finer grained status

* E.g. on D3D12 we can debug DXBC shaders but not DXIL shaders. On vulkan this
  will allow us to have the UI work better when encountering shaders with
  unsupported capabilities or extensions.
This commit is contained in:
baldurk
2020-06-18 15:10:47 +01:00
parent 885e2b619c
commit d4ddb565d0
23 changed files with 308 additions and 94 deletions
+31 -2
View File
@@ -716,6 +716,29 @@ void PixelHistoryView::startDebug(EventTag tag)
{
m_Ctx.SetEventID({this}, tag.eventId, tag.eventId);
const ShaderReflection *shaderDetails =
m_Ctx.CurPipelineState().GetShaderReflection(ShaderStage::Pixel);
if(!m_Ctx.APIProps().shaderDebugging)
{
RDDialog::critical(this, tr("Can't debug pixel"),
tr("This API does not support shader debugging"));
return;
}
else if(!shaderDetails)
{
RDDialog::critical(this, tr("Can't debug pixel"),
tr("No pixel shader bound at event %1").arg(tag.eventId));
return;
}
else if(!shaderDetails->debugInfo.debuggable)
{
RDDialog::critical(
this, tr("Can't debug pixel"),
tr("This shader doesn't support debugging: %1").arg(shaderDetails->debugInfo.debugStatus));
return;
}
bool done = false;
ShaderDebugTrace *trace = NULL;
@@ -748,8 +771,6 @@ void PixelHistoryView::startDebug(EventTag tag)
return;
}
const ShaderReflection *shaderDetails =
m_Ctx.CurPipelineState().GetShaderReflection(ShaderStage::Pixel);
const ShaderBindpointMapping &bindMapping =
m_Ctx.CurPipelineState().GetBindpointMapping(ShaderStage::Pixel);
ResourceId pipeline = m_Ctx.CurPipelineState().GetGraphicsPipelineObject();
@@ -832,6 +853,14 @@ void PixelHistoryView::on_events_customContextMenuRequested(const QPoint &pos)
contextMenu.addAction(&debugAction);
if(!m_Ctx.APIProps().shaderDebugging)
{
debugAction.setToolTip(tr("This API does not support shader debugging"));
debugAction.setEnabled(false);
}
// can't check if the shader supports debugging here because we don't have its details.
QObject::connect(&jumpAction, &QAction::triggered, [this, tag]() { jumpToPrimitive(tag); });
QObject::connect(&debugAction, &QAction::triggered, [this, tag]() { startDebug(tag); });