Default to D3D11 pipeline state at the last minute

* If we default to D3D11 at construction time, if we have persist data (very
  likely) and it's for another API then we'll have to destroy the D3D11 viewer
  and recreate the other API's viewer.
This commit is contained in:
baldurk
2020-09-04 15:02:04 +01:00
parent acd755324e
commit 311dcb989b
2 changed files with 12 additions and 2 deletions
@@ -94,8 +94,6 @@ PipelineStateViewer::PipelineStateViewer(ICaptureContext &ctx, QWidget *parent)
for(size_t i = 0; i < ARRAY_COUNT(editMenus); i++)
editMenus[i] = new QMenu(this);
setToD3D11();
m_Ctx.AddCaptureViewer(this);
}
@@ -648,6 +646,16 @@ void PipelineStateViewer::MakeShaderVariablesHLSL(bool cbufferContents,
}
}
void PipelineStateViewer::showEvent(QShowEvent *event)
{
// we didn't set any default pipeline state in case it would be overridden by the persist data.
// But if we don't have any persist data and we're about to show, default to D3D11.
if(m_Current == NULL)
{
setToD3D11();
}
}
QString PipelineStateViewer::GenerateHLSLStub(const ShaderBindpointMapping &bindpointMapping,
const ShaderReflection *shaderDetails,
const QString &entryFunc)
@@ -86,6 +86,8 @@ public slots:
void shaderEdit_clicked();
private:
void showEvent(QShowEvent *event) override;
Ui::PipelineStateViewer *ui;
ICaptureContext &m_Ctx;