diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 52edbf2dd..80edef422 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -61,6 +61,13 @@ CaptureContext::CaptureContext(QString paramFilename, QString remoteHost, uint32 memset(&m_APIProps, 0, sizeof(m_APIProps)); + m_CurD3D11PipelineState = &m_DummyD3D11; + m_CurD3D12PipelineState = &m_DummyD3D12; + m_CurGLPipelineState = &m_DummyGL; + m_CurVulkanPipelineState = &m_DummyVK; + + m_StructuredFile = &m_DummySDFile; + qApp->setApplicationVersion(QString::fromLatin1(RENDERDOC_GetVersionString())); m_Icon = new QIcon(); @@ -252,6 +259,8 @@ void CaptureContext::LoadLogfileThreaded(const QString &logFile, const QString & m_X11Display = QX11Info::display(); #endif + m_StructuredFile = &r->GetStructuredFile(); + m_BufferList = r->GetBuffers(); for(BufferDescription &b : m_BufferList) m_Buffers[b.ID] = &b; @@ -532,12 +541,13 @@ void CaptureContext::CloseLogfile() m_Drawcalls.clear(); m_FirstDrawcall = m_LastDrawcall = NULL; - m_CurD3D11PipelineState = NULL; - m_CurD3D12PipelineState = NULL; - m_CurGLPipelineState = NULL; - m_CurVulkanPipelineState = NULL; - m_CurPipelineState.SetStates(m_APIProps, m_CurD3D11PipelineState, m_CurD3D12PipelineState, - m_CurGLPipelineState, m_CurVulkanPipelineState); + m_CurD3D11PipelineState = &m_DummyD3D11; + m_CurD3D12PipelineState = &m_DummyD3D12; + m_CurGLPipelineState = &m_DummyGL; + m_CurVulkanPipelineState = &m_DummyVK; + m_CurPipelineState.SetStates(m_APIProps, NULL, NULL, NULL, NULL); + + m_StructuredFile = &m_DummySDFile; m_DebugMessages.clear(); m_UnreadMessageCount = 0; diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 56cfae48c..bacde7097 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -117,7 +117,7 @@ public: { return GetDrawcall(m_Drawcalls, eventID); } - + const SDFile &GetStructuredFile() override { return *m_StructuredFile; } WindowingSystem CurWindowingSystem() override { return m_CurWinSystem; } void *FillWindowingData(uintptr_t winId) override; @@ -205,6 +205,11 @@ private: const VKPipe::State *m_CurVulkanPipelineState; CommonPipelineState m_CurPipelineState; + D3D11Pipe::State m_DummyD3D11; + D3D12Pipe::State m_DummyD3D12; + GLPipe::State m_DummyGL; + VKPipe::State m_DummyVK; + PersistantConfig &m_Config; QVector m_LogViewers; @@ -261,6 +266,9 @@ private: QMap m_Buffers; rdcarray m_BufferList; + const SDFile *m_StructuredFile; + SDFile m_DummySDFile; + rdcarray m_WinSystems; WindowingSystem m_CurWinSystem; diff --git a/qrenderdoc/Code/Interface/QRDInterface.h b/qrenderdoc/Code/Interface/QRDInterface.h index a365e3f9c..6c5893b47 100644 --- a/qrenderdoc/Code/Interface/QRDInterface.h +++ b/qrenderdoc/Code/Interface/QRDInterface.h @@ -1054,6 +1054,13 @@ more information for how this differs. )"); virtual const DrawcallDescription *GetDrawcall(uint32_t eventID) = 0; + DOCUMENT(R"(Retrieve the :class:`~renderdoc.SDFile` for the currently open capture. + +:return: The structured file. +:rtype: ~renderdoc.SDFile +)"); + virtual const SDFile &GetStructuredFile() = 0; + DOCUMENT(R"(Retrieve the current windowing system in use. :return: The active windowing system. @@ -1127,7 +1134,7 @@ as well as messages generated during replay and analysis. )"); virtual ITextureViewer *GetTextureViewer() = 0; - DOCUMENT(R"(Retrieve the current singleton :class:`BufferViewer`. + DOCUMENT(R"(Retrieve the current singleton :class:`BufferViewer` configured for mesh viewing. :return: The current window, which is created (but not shown) it there wasn't one open. :rtype: BufferViewer diff --git a/qrenderdoc/Windows/APIInspector.cpp b/qrenderdoc/Windows/APIInspector.cpp index d4723402c..f350a81fa 100644 --- a/qrenderdoc/Windows/APIInspector.cpp +++ b/qrenderdoc/Windows/APIInspector.cpp @@ -23,7 +23,6 @@ ******************************************************************************/ #include "APIInspector.h" -#include #include "ui_APIInspector.h" Q_DECLARE_METATYPE(APIEvent); @@ -132,47 +131,40 @@ void APIInspector::fillAPIView() ui->apiEvents->setUpdatesEnabled(false); ui->apiEvents->clear(); - QRegularExpression rgxopen(lit("^\\s*{")); - QRegularExpression rgxclose(lit("^\\s*}")); + const SDFile &file = m_Ctx.GetStructuredFile(); + const DrawcallDescription *draw = m_Ctx.CurSelectedDrawcall(); - m_Ctx.Replay().AsyncInvoke([this](IReplayController *r) { - const SDFile &file = r->GetStructuredFile(); + if(draw != NULL && !draw->events.isEmpty()) + { + for(const APIEvent &ev : draw->events) + { + RDTreeWidgetItem *root = new RDTreeWidgetItem({QString::number(ev.eventID), QString()}); - GUIInvoke::call([this, &file]() { - const DrawcallDescription *draw = m_Ctx.CurSelectedDrawcall(); - - if(draw != NULL && !draw->events.isEmpty()) + if(ev.chunkIndex < file.chunks.size()) { - for(const APIEvent &ev : draw->events) - { - RDTreeWidgetItem *root = new RDTreeWidgetItem({QString::number(ev.eventID), QString()}); + SDChunk *chunk = file.chunks[ev.chunkIndex]; - if(ev.chunkIndex < file.chunks.size()) - { - SDChunk *chunk = file.chunks[ev.chunkIndex]; + root->setText(1, chunk->name); - root->setText(1, chunk->name); - - addObjects(root, chunk->data.children, false); - } - else - { - root->setText(1, tr("Invalid chunk index %1").arg(ev.chunkIndex)); - } - - if(ev.eventID == draw->eventID) - root->setBold(true); - - root->setTag(QVariant::fromValue(ev)); - - ui->apiEvents->addTopLevelItem(root); - - ui->apiEvents->setSelectedItem(root); - } + addObjects(root, chunk->data.children, false); } - ui->apiEvents->setUpdatesEnabled(true); - }); - }); + else + { + root->setText(1, tr("Invalid chunk index %1").arg(ev.chunkIndex)); + } + + if(ev.eventID == draw->eventID) + root->setBold(true); + + root->setTag(QVariant::fromValue(ev)); + + ui->apiEvents->addTopLevelItem(root); + + ui->apiEvents->setSelectedItem(root); + } + } + + ui->apiEvents->setUpdatesEnabled(true); } void APIInspector::addObjects(RDTreeWidgetItem *parent, const StructuredObjectList &objs, diff --git a/qrenderdoc/Windows/PythonShell.cpp b/qrenderdoc/Windows/PythonShell.cpp index e7e36ecdf..9d009ee7b 100644 --- a/qrenderdoc/Windows/PythonShell.cpp +++ b/qrenderdoc/Windows/PythonShell.cpp @@ -85,6 +85,7 @@ struct CaptureContextInvoker : ICaptureContext { return m_Ctx.GetDrawcall(eventID); } + virtual const SDFile &GetStructuredFile() override { return m_Ctx.GetStructuredFile(); } virtual WindowingSystem CurWindowingSystem() override { return m_Ctx.CurWindowingSystem(); } virtual void *FillWindowingData(uintptr_t winId) override {