Skip to content

Commit 81268dc

Browse files
committed
Try to preserve selected pipeline stage as much as possible
* When switching between mesh/normal pipeline keep the same stage selected if it's a common stage even if the index has changed.
1 parent d8535c6 commit 81268dc

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed

qrenderdoc/Widgets/PipelineFlowChart.cpp

+44-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ PipelineFlowChart::~PipelineFlowChart()
3838

3939
void PipelineFlowChart::setStages(const QStringList &abbrevs, const QStringList &names)
4040
{
41+
int prev = -1;
42+
QString prevAbbrev;
43+
44+
if(!m_StageNames.empty() && names.count() != m_StageNames.count())
45+
{
46+
prev = m_SelectedStage;
47+
prevAbbrev = m_StageAbbrevs[prev];
48+
}
49+
4150
m_StageNames = names;
4251
m_StageAbbrevs = abbrevs;
4352
m_StageFlows.reserve(m_StageNames.count());
@@ -51,7 +60,41 @@ void PipelineFlowChart::setStages(const QStringList &abbrevs, const QStringList
5160
}
5261

5362
update();
54-
setSelectedStage(selectedStage());
63+
64+
if(prev >= 0)
65+
{
66+
int exact = m_StageAbbrevs.indexOf(prevAbbrev);
67+
68+
if(exact >= 0)
69+
{
70+
setSelectedStage(exact);
71+
}
72+
else
73+
{
74+
// this is most likely a change between mesh/vertex pipeline, default to either the mesh
75+
// shader or vertex shader if we can find it. Fortunately those names are identical
76+
int vert = m_StageNames.indexOf(tr("Vertex Shader"));
77+
int mesh = m_StageNames.indexOf(tr("Mesh Shader"));
78+
79+
if(vert >= 0)
80+
{
81+
setSelectedStage(vert);
82+
}
83+
else if(mesh >= 0)
84+
{
85+
setSelectedStage(mesh);
86+
}
87+
else
88+
{
89+
qWarning() << "Couldn't find default stage when names changed";
90+
setSelectedStage(selectedStage());
91+
}
92+
}
93+
}
94+
else
95+
{
96+
setSelectedStage(selectedStage());
97+
}
5598
}
5699

57100
void PipelineFlowChart::setStageName(int index, const QString &abbrev, const QString &name)

qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -1794,6 +1794,8 @@ void VulkanPipelineStateViewer::setState()
17941794
raster = false;
17951795
}
17961796

1797+
setOldMeshPipeFlow();
1798+
17971799
if(state.geometryShader.resourceId == ResourceId() && xfbActive)
17981800
{
17991801
ui->pipeFlow->setStageName(4, lit("XFB"), tr("Transform Feedback"));
@@ -1803,7 +1805,6 @@ void VulkanPipelineStateViewer::setState()
18031805
ui->pipeFlow->setStageName(4, lit("GS"), tr("Geometry Shader"));
18041806
}
18051807

1806-
setOldMeshPipeFlow();
18071808
ui->pipeFlow->setStagesEnabled(
18081809
{true, true, state.tessControlShader.resourceId != ResourceId(),
18091810
state.tessEvalShader.resourceId != ResourceId(),

0 commit comments

Comments
 (0)