From ad5cfcd290ca5afb12e2e9b38ebce223eb4cabd5 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 1 Oct 2018 18:27:44 +0100 Subject: [PATCH] Pass through and display VAO object in GL pipeline state --- .../PipelineState/GLPipelineStateViewer.cpp | 8 +- .../PipelineState/GLPipelineStateViewer.ui | 273 ++++++++++++------ renderdoc/api/replay/gl_pipestate.h | 3 + renderdoc/driver/gl/gl_replay.cpp | 4 + renderdoc/replay/renderdoc_serialise.inl | 5 +- 5 files changed, 198 insertions(+), 95 deletions(-) diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 0ae322903..5ab299e82 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -80,7 +80,8 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState const QIcon &action_hover = Icons::action_hover(); RDLabel *shaderLabels[] = { - ui->vsShader, ui->tcsShader, ui->tesShader, ui->gsShader, ui->fsShader, ui->csShader, + ui->vaoLabel, ui->vsShader, ui->tcsShader, ui->tesShader, + ui->gsShader, ui->fsShader, ui->csShader, }; QToolButton *viewButtons[] = { @@ -361,6 +362,7 @@ GLPipelineStateViewer::GLPipelineStateViewer(ICaptureContext &ctx, PipelineState m_Common.setMeshViewPixmap(ui->meshView); + ui->vaoLabel->setFont(Formatter::PreferredFont()); ui->viAttrs->setFont(Formatter::PreferredFont()); ui->viBuffers->setFont(Formatter::PreferredFont()); ui->xfbBuffers->setFont(Formatter::PreferredFont()); @@ -522,6 +524,8 @@ void GLPipelineStateViewer::clearState() m_VBNodes.clear(); m_EmptyNodes.clear(); + ui->vaoLabel->setText(QString()); + ui->viAttrs->clear(); ui->viBuffers->clear(); ui->topology->setText(QString()); @@ -1265,6 +1269,8 @@ void GLPipelineStateViewer::setState() m_VBNodes.clear(); m_EmptyNodes.clear(); + ui->vaoLabel->setText(ToQStr(state.vertexInput.vertexArrayObject)); + vs = ui->viBuffers->verticalScrollBar()->value(); ui->viBuffers->beginUpdate(); ui->viBuffers->clear(); diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui index c9a38bdb5..d2eb6b2e8 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.ui @@ -164,7 +164,7 @@ - 8 + 0 true @@ -219,68 +219,7 @@ 0 - - - - - 0 - 0 - - - - Vertex Attribute Formats - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - QFrame::Box - - - QFrame::Plain - - - QAbstractItemView::NoEditTriggers - - - false - - - 0 - - - false - - - false - - - true - - - false - - - false - - - - - - - + @@ -344,50 +283,68 @@ - - + + - + 0 0 - Mesh View + Vertex Attribute Formats - + + + 2 + + + 2 + + + 2 + + + 2 + - - - - 0 - 0 - + + + QFrame::Box - - - 75 - 75 - + + QFrame::Plain - - PointingHandCursor + + QAbstractItemView::NoEditTriggers - - View the mesh input data + + false - - :/wireframe_mesh.png + + 0 - + + false + + + false + + true + + false + + + false + - + @@ -457,6 +414,102 @@ + + + + + 0 + 0 + + + + Mesh View + + + + + + + 0 + 0 + + + + + 75 + 75 + + + + PointingHandCursor + + + View the mesh input data + + + :/wireframe_mesh.png + + + true + + + + + + + + + + Vertex Array Object + + + + 0 + + + 9 + + + 0 + + + 9 + + + 4 + + + + + + 250 + 20 + + + + QFrame::Box + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + @@ -903,6 +956,12 @@ QSizePolicy::MinimumExpanding + + + 0 + 0 + + @@ -1351,6 +1410,12 @@ QSizePolicy::MinimumExpanding + + + 0 + 0 + + @@ -1799,6 +1864,12 @@ QSizePolicy::MinimumExpanding + + + 0 + 0 + + @@ -2349,6 +2420,12 @@ QSizePolicy::MinimumExpanding + + + 0 + 0 + + @@ -3673,6 +3750,12 @@ QSizePolicy::MinimumExpanding + + + 0 + 0 + + @@ -4628,6 +4711,12 @@ QSizePolicy::MinimumExpanding + + + 0 + 0 + + @@ -4641,16 +4730,16 @@ - - RDTreeWidget - QTreeView -
Widgets/Extended/RDTreeWidget.h
-
RDLabel QLabel
Widgets/Extended/RDLabel.h
+ + RDTreeWidget + QTreeView +
Widgets/Extended/RDTreeWidget.h
+
PipelineFlowChart QFrame diff --git a/renderdoc/api/replay/gl_pipestate.h b/renderdoc/api/replay/gl_pipestate.h index dd29a184d..203f50296 100644 --- a/renderdoc/api/replay/gl_pipestate.h +++ b/renderdoc/api/replay/gl_pipestate.h @@ -125,6 +125,9 @@ struct VertexInput VertexInput() = default; VertexInput(const VertexInput &) = default; + DOCUMENT("The :class:`ResourceId` of the vertex array object that's bound."); + ResourceId vertexArrayObject; + DOCUMENT("A list of :class:`GLVertexAttribute` with the vertex attributes."); rdcarray attributes; diff --git a/renderdoc/driver/gl/gl_replay.cpp b/renderdoc/driver/gl/gl_replay.cpp index de2551586..3f19ce666 100644 --- a/renderdoc/driver/gl/gl_replay.cpp +++ b/renderdoc/driver/gl/gl_replay.cpp @@ -689,6 +689,10 @@ void GLReplay::SavePipelineState() ContextPair &ctx = drv.GetCtx(); + GLuint vao = 0; + drv.glGetIntegerv(eGL_VERTEX_ARRAY_BINDING, (GLint *)&vao); + pipe.vertexInput.vertexArrayObject = rm->GetOriginalID(rm->GetID(VertexArrayRes(ctx, vao))); + GLuint ibuffer = 0; drv.glGetIntegerv(eGL_ELEMENT_ARRAY_BUFFER_BINDING, (GLint *)&ibuffer); pipe.vertexInput.indexBuffer = rm->GetOriginalID(rm->GetID(BufferRes(ctx, ibuffer))); diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index 91f6611f0..e1c63a287 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -1491,6 +1491,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::VertexBuffer &el) template void DoSerialise(SerialiserType &ser, GLPipe::VertexInput &el) { + SERIALISE_MEMBER(vertexArrayObject); SERIALISE_MEMBER(attributes); SERIALISE_MEMBER(vertexBuffers); SERIALISE_MEMBER(indexBuffer); @@ -1498,7 +1499,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::VertexInput &el) SERIALISE_MEMBER(restartIndex); SERIALISE_MEMBER(provokingVertexLast); - SIZE_CHECK(56); + SIZE_CHECK(64); } template @@ -1755,7 +1756,7 @@ void DoSerialise(SerialiserType &ser, GLPipe::State &el) SERIALISE_MEMBER(hints); - SIZE_CHECK(1568); + SIZE_CHECK(1576); } #pragma endregion OpenGL pipeline state