diff --git a/qrenderdoc/Code/CaptureContext.cpp b/qrenderdoc/Code/CaptureContext.cpp index 9e2057772..6da7067e6 100644 --- a/qrenderdoc/Code/CaptureContext.cpp +++ b/qrenderdoc/Code/CaptureContext.cpp @@ -61,13 +61,13 @@ CaptureContext::CaptureContext(QString paramFilename, QString remoteHost, uint32 m_Icon = new QIcon(); m_Icon->addFile(QStringLiteral(":/icon.ico"), QSize(), QIcon::Normal, QIcon::Off); - m_MainWindow = new MainWindow(this); + m_MainWindow = new MainWindow(*this); m_MainWindow->show(); if(remoteIdent != 0) { m_MainWindow->ShowLiveCapture( - new LiveCapture(this, remoteHost, remoteIdent, m_MainWindow, m_MainWindow)); + new LiveCapture(*this, remoteHost, remoteIdent, m_MainWindow, m_MainWindow)); } if(!paramFilename.isEmpty()) @@ -397,7 +397,7 @@ EventBrowser *CaptureContext::eventBrowser() if(m_EventBrowser) return m_EventBrowser; - m_EventBrowser = new EventBrowser(this, m_MainWindow); + m_EventBrowser = new EventBrowser(*this, m_MainWindow); m_EventBrowser->setObjectName("eventBrowser"); setupDockWindow(m_EventBrowser); @@ -409,7 +409,7 @@ APIInspector *CaptureContext::apiInspector() if(m_APIInspector) return m_APIInspector; - m_APIInspector = new APIInspector(this, m_MainWindow); + m_APIInspector = new APIInspector(*this, m_MainWindow); m_APIInspector->setObjectName("apiInspector"); setupDockWindow(m_APIInspector); @@ -421,7 +421,7 @@ TextureViewer *CaptureContext::textureViewer() if(m_TextureViewer) return m_TextureViewer; - m_TextureViewer = new TextureViewer(this, m_MainWindow); + m_TextureViewer = new TextureViewer(*this, m_MainWindow); m_TextureViewer->setObjectName("textureViewer"); setupDockWindow(m_TextureViewer); @@ -433,7 +433,7 @@ BufferViewer *CaptureContext::meshPreview() if(m_MeshPreview) return m_MeshPreview; - m_MeshPreview = new BufferViewer(this, true, m_MainWindow); + m_MeshPreview = new BufferViewer(*this, true, m_MainWindow); m_MeshPreview->setObjectName("meshPreview"); setupDockWindow(m_MeshPreview); @@ -445,7 +445,7 @@ PipelineStateViewer *CaptureContext::pipelineViewer() if(m_PipelineViewer) return m_PipelineViewer; - m_PipelineViewer = new PipelineStateViewer(this, m_MainWindow); + m_PipelineViewer = new PipelineStateViewer(*this, m_MainWindow); m_PipelineViewer->setObjectName("pipelineViewer"); setupDockWindow(m_PipelineViewer); @@ -458,7 +458,7 @@ CaptureDialog *CaptureContext::captureDialog() return m_CaptureDialog; m_CaptureDialog = new CaptureDialog( - this, + *this, [this](const QString &exe, const QString &workingDir, const QString &cmdLine, const QList &env, CaptureOptions opts) { return m_MainWindow->OnCaptureTrigger(exe, workingDir, cmdLine, env, opts); @@ -477,7 +477,7 @@ DebugMessageView *CaptureContext::debugMessageView() if(m_DebugMessageView) return m_DebugMessageView; - m_DebugMessageView = new DebugMessageView(this, m_MainWindow); + m_DebugMessageView = new DebugMessageView(*this, m_MainWindow); m_DebugMessageView->setObjectName("debugMessageView"); setupDockWindow(m_DebugMessageView); @@ -489,7 +489,7 @@ StatisticsViewer *CaptureContext::statisticsViewer() if(m_StatisticsViewer) return m_StatisticsViewer; - m_StatisticsViewer = new StatisticsViewer(this, m_MainWindow); + m_StatisticsViewer = new StatisticsViewer(*this, m_MainWindow); m_StatisticsViewer->setObjectName("statisticsViewer"); setupDockWindow(m_StatisticsViewer); diff --git a/qrenderdoc/Code/CaptureContext.h b/qrenderdoc/Code/CaptureContext.h index 1df17ac93..0736e6b14 100644 --- a/qrenderdoc/Code/CaptureContext.h +++ b/qrenderdoc/Code/CaptureContext.h @@ -103,7 +103,7 @@ public: ////////////////////////////////////////////////////////////////////////////// // Accessors - RenderManager *Renderer() { return &m_Renderer; } + RenderManager &Renderer() { return m_Renderer; } bool LogLoaded() { return m_LogLoaded; } bool IsLogLocal() { return m_LogLocal; } bool LogLoading() { return m_LoadInProgress; } diff --git a/qrenderdoc/Code/RenderManager.h b/qrenderdoc/Code/RenderManager.h index 613ab558d..4d7b579c7 100644 --- a/qrenderdoc/Code/RenderManager.h +++ b/qrenderdoc/Code/RenderManager.h @@ -42,7 +42,7 @@ class RemoteHost; // simple helper for the common case of 'we just need to run this on the render thread #define INVOKE_MEMFN(function) \ - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { function(r); }); + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { function(r); }); struct EnvironmentModification { diff --git a/qrenderdoc/Widgets/CustomPaintWidget.cpp b/qrenderdoc/Widgets/CustomPaintWidget.cpp index 461f91c67..47a1395ed 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.cpp +++ b/qrenderdoc/Widgets/CustomPaintWidget.cpp @@ -90,7 +90,7 @@ void CustomPaintWidget::paintEvent(QPaintEvent *e) if(m_Ctx) { if(m_Output != NULL) - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { m_Output->Display(); }); + m_Ctx->Renderer().AsyncInvoke([this](IReplayRenderer *r) { m_Output->Display(); }); } else if(m_Dark == m_Light) { diff --git a/qrenderdoc/Widgets/ResourcePreview.cpp b/qrenderdoc/Widgets/ResourcePreview.cpp index cd0ffbdbc..1f1e2dc31 100644 --- a/qrenderdoc/Widgets/ResourcePreview.cpp +++ b/qrenderdoc/Widgets/ResourcePreview.cpp @@ -26,12 +26,12 @@ #include #include "ui_ResourcePreview.h" -ResourcePreview::ResourcePreview(CaptureContext *c, IReplayOutput *output, QWidget *parent) +ResourcePreview::ResourcePreview(CaptureContext &c, IReplayOutput *output, QWidget *parent) : QFrame(parent), ui(new Ui::ResourcePreview) { ui->setupUi(this); - CustomPaintWidget *thumb = new CustomPaintWidget(c, this); + CustomPaintWidget *thumb = new CustomPaintWidget(&c, this); thumb->setOutput(output); thumb->setObjectName(ui->thumbnail->objectName()); thumb->setSizePolicy(ui->thumbnail->sizePolicy()); diff --git a/qrenderdoc/Widgets/ResourcePreview.h b/qrenderdoc/Widgets/ResourcePreview.h index 0e604ad50..2c61c63f6 100644 --- a/qrenderdoc/Widgets/ResourcePreview.h +++ b/qrenderdoc/Widgets/ResourcePreview.h @@ -39,7 +39,7 @@ class ResourcePreview : public QFrame Q_OBJECT public: - explicit ResourcePreview(CaptureContext *c, IReplayOutput *output, QWidget *parent = 0); + explicit ResourcePreview(CaptureContext &c, IReplayOutput *output, QWidget *parent = 0); ~ResourcePreview(); signals: diff --git a/qrenderdoc/Windows/APIInspector.cpp b/qrenderdoc/Windows/APIInspector.cpp index c29ee4a4d..903da6984 100644 --- a/qrenderdoc/Windows/APIInspector.cpp +++ b/qrenderdoc/Windows/APIInspector.cpp @@ -28,7 +28,7 @@ Q_DECLARE_METATYPE(FetchAPIEvent); -APIInspector::APIInspector(CaptureContext *ctx, QWidget *parent) +APIInspector::APIInspector(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::APIInspector), m_Ctx(ctx) { ui->setupUi(this); @@ -39,13 +39,13 @@ APIInspector::APIInspector(CaptureContext *ctx, QWidget *parent) ui->splitter->setCollapsible(1, true); ui->splitter->setSizes({1, 0}); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); } APIInspector::~APIInspector() { - m_Ctx->windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.windowClosed(this); + m_Ctx.RemoveLogViewer(this); delete ui; } @@ -92,7 +92,7 @@ void APIInspector::on_apiEvents_itemSelectionChanged() if(ev.callstack.count > 0) { - m_Ctx->Renderer()->AsyncInvoke([this, ev](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this, ev](IReplayRenderer *r) { rdctype::array trace; r->GetResolve(ev.callstack.elems, ev.callstack.count, &trace); @@ -116,7 +116,7 @@ void APIInspector::fillAPIView() QRegularExpression rgxopen("^\\s*{"); QRegularExpression rgxclose("^\\s*}"); - const FetchDrawcall *draw = m_Ctx->CurSelectedDrawcall(); + const FetchDrawcall *draw = m_Ctx.CurSelectedDrawcall(); if(draw != NULL && draw->events.count > 0) { diff --git a/qrenderdoc/Windows/APIInspector.h b/qrenderdoc/Windows/APIInspector.h index 4a697055d..beff3ab05 100644 --- a/qrenderdoc/Windows/APIInspector.h +++ b/qrenderdoc/Windows/APIInspector.h @@ -37,7 +37,7 @@ class APIInspector : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit APIInspector(CaptureContext *ctx, QWidget *parent = 0); + explicit APIInspector(CaptureContext &ctx, QWidget *parent = 0); ~APIInspector(); void OnLogfileLoaded(); @@ -49,7 +49,7 @@ public slots: private: Ui::APIInspector *ui; - CaptureContext *m_Ctx = NULL; + CaptureContext &m_Ctx; void addCallstack(rdctype::array calls); void fillAPIView(); diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index 21dc5be74..dd138d8ae 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -582,7 +582,7 @@ private: } }; -BufferViewer::BufferViewer(CaptureContext *ctx, bool meshview, QWidget *parent) +BufferViewer::BufferViewer(CaptureContext &ctx, bool meshview, QWidget *parent) : QFrame(parent), ui(new Ui::BufferViewer), m_Ctx(ctx) { ui->setupUi(this); @@ -664,7 +664,7 @@ BufferViewer::BufferViewer(CaptureContext *ctx, bool meshview, QWidget *parent) Reset(); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); } void BufferViewer::SetupRawView() @@ -766,9 +766,9 @@ BufferViewer::~BufferViewer() delete m_Flycam; if(m_MeshView) - m_Ctx->windowClosed(this); + m_Ctx.windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.RemoveLogViewer(this); delete ui; } @@ -781,8 +781,8 @@ void BufferViewer::OnLogfileLoaded() WId renderID = ui->render->winId(); - m_Ctx->Renderer()->BlockInvoke([renderID, this](IReplayRenderer *r) { - m_Output = r->CreateOutput(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(renderID), + m_Ctx.Renderer().BlockInvoke([renderID, this](IReplayRenderer *r) { + m_Output = r->CreateOutput(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(renderID), eOutputType_MeshDisplay); ui->render->setOutput(m_Output); @@ -828,7 +828,7 @@ void BufferViewer::OnEventChanged(uint32_t eventID) m_ModelVSOut->beginReset(); m_ModelGSOut->beginReset(); - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); ui->instance->setEnabled(draw && draw->numInstances > 1); if(!ui->instance->isEnabled()) @@ -840,7 +840,7 @@ void BufferViewer::OnEventChanged(uint32_t eventID) if(m_MeshView) ConfigureMeshColumns(); - m_Ctx->Renderer()->AsyncInvoke([this, vsinHoriz, vsoutHoriz, gsoutHoriz](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this, vsinHoriz, vsoutHoriz, gsoutHoriz](IReplayRenderer *r) { if(m_MeshView) { @@ -909,13 +909,13 @@ void BufferViewer::OnEventChanged(uint32_t eventID) void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) { - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); ResourceId ib; uint64_t ioffset = 0; - m_Ctx->CurPipelineState.GetIBuffer(ib, ioffset); + m_Ctx.CurPipelineState.GetIBuffer(ib, ioffset); - QVector vbs = m_Ctx->CurPipelineState.GetVBuffers(); + QVector vbs = m_Ctx.CurPipelineState.GetVBuffers(); rdctype::array idata; if(ib != ResourceId() && draw) @@ -1078,9 +1078,9 @@ void BufferViewer::RT_FetchMeshData(IReplayRenderer *r) void BufferViewer::ConfigureMeshColumns() { - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); - QVector vinputs = m_Ctx->CurPipelineState.GetVertexInputs(); + QVector vinputs = m_Ctx.CurPipelineState.GetVertexInputs(); m_ModelVSIn->columns.reserve(vinputs.count()); @@ -1102,13 +1102,13 @@ void BufferViewer::ConfigureMeshColumns() else m_ModelVSIn->numRows = draw->numIndices; - QVector vbs = m_Ctx->CurPipelineState.GetVBuffers(); + QVector vbs = m_Ctx.CurPipelineState.GetVBuffers(); ResourceId ib; uint64_t ioffset = 0; - m_Ctx->CurPipelineState.GetIBuffer(ib, ioffset); + m_Ctx.CurPipelineState.GetIBuffer(ib, ioffset); - Viewport vp = m_Ctx->CurPipelineState.GetViewport(0); + Viewport vp = m_Ctx.CurPipelineState.GetViewport(0); m_Config.fov = ui->fovGuess->value(); m_Config.aspect = vp.width / vp.height; @@ -1153,7 +1153,7 @@ void BufferViewer::ConfigureMeshColumns() m_VSIn.compType = vinputs[0].Format.compType; } - ShaderReflection *vs = m_Ctx->CurPipelineState.GetShaderReflection(eShaderStage_Vertex); + ShaderReflection *vs = m_Ctx.CurPipelineState.GetShaderReflection(eShaderStage_Vertex); m_ModelVSOut->columns.clear(); @@ -1194,7 +1194,7 @@ void BufferViewer::ConfigureMeshColumns() uint numComps = sig.compCount; uint elemSize = sig.compType == eCompType_Double ? 8U : 4U; - if(m_Ctx->CurPipelineState.HasAlignedPostVSData()) + if(m_Ctx.CurPipelineState.HasAlignedPostVSData()) { if(numComps == 2) offset = AlignUp(offset, 2U * elemSize); @@ -1246,7 +1246,7 @@ void BufferViewer::UpdateMeshConfig() void BufferViewer::render_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; if(m_CurrentCamera) @@ -1260,16 +1260,16 @@ void BufferViewer::render_mouseMove(QMouseEvent *e) void BufferViewer::render_clicked(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QPoint curpos = e->pos(); if((e->buttons() & Qt::RightButton) && m_Output) { - m_Ctx->Renderer()->AsyncInvoke([this, curpos](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this, curpos](IReplayRenderer *r) { uint32_t instanceSelected = 0; - uint32_t vertSelected = m_Output->PickVertex(m_Ctx->CurEvent(), (uint32_t)curpos.x(), + uint32_t vertSelected = m_Output->PickVertex(m_Ctx.CurEvent(), (uint32_t)curpos.x(), (uint32_t)curpos.y(), &instanceSelected); if(vertSelected != ~0U) @@ -1309,7 +1309,7 @@ void BufferViewer::ScrollToRow(BufferItemModel *model, int row) void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId id, const QString &format) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; m_IsBuffer = true; @@ -1317,7 +1317,7 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId m_ByteSize = byteSize; m_BufferID = id; - FetchBuffer *buf = m_Ctx->GetBuffer(id); + FetchBuffer *buf = m_Ctx.GetBuffer(id); if(buf) setWindowTitle(ToQStr(buf->name) + " - Contents"); @@ -1326,7 +1326,7 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId void BufferViewer::ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, const QString &format) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; m_IsBuffer = false; @@ -1334,7 +1334,7 @@ void BufferViewer::ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, c m_TexMip = mip; m_BufferID = id; - FetchTexture *tex = m_Ctx->GetTexture(id); + FetchTexture *tex = m_Ctx.GetTexture(id); if(tex) setWindowTitle(ToQStr(tex->name) + " - Contents"); @@ -1407,7 +1407,7 @@ bool BufferViewer::isCurrentRasterOut() } else if(m_CurStage == eMeshDataStage_VSOut) { - if(m_Ctx->LogLoaded() && m_Ctx->CurPipelineState.IsTessellationEnabled()) + if(m_Ctx.LogLoaded() && m_Ctx.CurPipelineState.IsTessellationEnabled()) return false; return true; @@ -1426,10 +1426,10 @@ void BufferViewer::Reset() ClearModels(); - CaptureContext *ctx = m_Ctx; + CaptureContext *ctx = &m_Ctx; // while a log is loaded, pass NULL into the widget - if(!ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) ctx = NULL; { @@ -1589,7 +1589,7 @@ void BufferViewer::camGuess_changed(double value) m_Config.aspect = 1.0f; // take a guess for the aspect ratio, for if the user hasn't overridden it - Viewport vp = m_Ctx->CurPipelineState.GetViewport(0); + Viewport vp = m_Ctx.CurPipelineState.GetViewport(0); m_Config.aspect = vp.width / vp.height; if(ui->aspectGuess->value() > 0.0) @@ -1637,7 +1637,7 @@ void BufferViewer::processFormat(const QString &format) ui->formatSpecifier->setErrors(errors); - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void BufferViewer::SyncViews(RDTableView *primary, bool selection, bool scroll) @@ -1828,7 +1828,7 @@ void BufferViewer::on_camSpeed_valueChanged(double value) void BufferViewer::on_instance_valueChanged(int value) { m_Config.curInstance = value; - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void BufferViewer::on_rowOffset_valueChanged(int value) diff --git a/qrenderdoc/Windows/BufferViewer.h b/qrenderdoc/Windows/BufferViewer.h index 97bfccc56..5d02a7e84 100644 --- a/qrenderdoc/Windows/BufferViewer.h +++ b/qrenderdoc/Windows/BufferViewer.h @@ -43,7 +43,7 @@ class BufferViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit BufferViewer(CaptureContext *ctx, bool meshview, QWidget *parent = 0); + explicit BufferViewer(CaptureContext &ctx, bool meshview, QWidget *parent = 0); ~BufferViewer(); void ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId id, const QString &format = ""); @@ -89,7 +89,7 @@ private slots: private: Ui::BufferViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; IReplayOutput *m_Output; diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp index bd5440fef..3f09ff016 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.cpp +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.cpp @@ -28,7 +28,7 @@ QList ConstantBufferPreviewer::m_Previews; -ConstantBufferPreviewer::ConstantBufferPreviewer(CaptureContext *ctx, const ShaderStageType stage, +ConstantBufferPreviewer::ConstantBufferPreviewer(CaptureContext &ctx, const ShaderStageType stage, uint32_t slot, uint32_t idx, QWidget *parent) : QFrame(parent), ui(new Ui::ConstantBufferPreviewer), m_Ctx(ctx) { @@ -57,12 +57,12 @@ ConstantBufferPreviewer::ConstantBufferPreviewer(CaptureContext *ctx, const Shad ui->variables->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); m_Previews.push_back(this); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); } ConstantBufferPreviewer::~ConstantBufferPreviewer() { - m_Ctx->RemoveLogViewer(this); + m_Ctx.RemoveLogViewer(this); m_Previews.removeOne(this); delete ui; } @@ -95,11 +95,11 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID) { uint64_t offs = 0; uint64_t size = 0; - m_Ctx->CurPipelineState.GetConstantBuffer(m_stage, m_slot, m_arrayIdx, m_cbuffer, offs, size); + m_Ctx.CurPipelineState.GetConstantBuffer(m_stage, m_slot, m_arrayIdx, m_cbuffer, offs, size); - m_shader = m_Ctx->CurPipelineState.GetShader(m_stage); - QString entryPoint = m_Ctx->CurPipelineState.GetShaderEntryPoint(m_stage); - ShaderReflection *reflection = m_Ctx->CurPipelineState.GetShaderReflection(m_stage); + m_shader = m_Ctx.CurPipelineState.GetShader(m_stage); + QString entryPoint = m_Ctx.CurPipelineState.GetShaderEntryPoint(m_stage); + ShaderReflection *reflection = m_Ctx.CurPipelineState.GetShaderReflection(m_stage); updateLabels(); @@ -111,7 +111,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID) if(!m_formatOverride.empty()) { - m_Ctx->Renderer()->AsyncInvoke([this, offs, size](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this, offs, size](IReplayRenderer *r) { rdctype::array data; r->GetBufferData(m_cbuffer, offs, size, &data); rdctype::array vars = applyFormatOverride(data); @@ -120,7 +120,7 @@ void ConstantBufferPreviewer::OnEventChanged(uint32_t eventID) } else { - m_Ctx->Renderer()->AsyncInvoke([this, entryPoint, offs](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this, entryPoint, offs](IReplayRenderer *r) { rdctype::array vars; r->GetCBufferVariableContents(m_shader, entryPoint.toUtf8().data(), m_slot, m_cbuffer, offs, &vars); @@ -165,7 +165,7 @@ void ConstantBufferPreviewer::processFormat(const QString &format) ui->formatSpecifier->setErrors(errors); } - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void ConstantBufferPreviewer::addVariables(QTreeWidgetItem *root, @@ -211,7 +211,7 @@ void ConstantBufferPreviewer::updateLabels() bool needName = true; - FetchBuffer *buf = m_Ctx ? m_Ctx->GetBuffer(m_cbuffer) : NULL; + FetchBuffer *buf = m_Ctx.GetBuffer(m_cbuffer); if(buf) { bufName = buf->name; @@ -219,7 +219,7 @@ void ConstantBufferPreviewer::updateLabels() needName = false; } - ShaderReflection *reflection = m_Ctx ? m_Ctx->CurPipelineState.GetShaderReflection(m_stage) : NULL; + ShaderReflection *reflection = m_Ctx.CurPipelineState.GetShaderReflection(m_stage); if(reflection != NULL) { @@ -230,14 +230,12 @@ void ConstantBufferPreviewer::updateLabels() ui->nameLabel->setText(bufName); - GraphicsAPI pipeType = eGraphicsAPI_D3D11; - if(m_Ctx != NULL) - pipeType = m_Ctx->APIProps().pipelineType; + GraphicsAPI pipeType = m_Ctx.APIProps().pipelineType; QString title = QString("%1 %2 %3").arg(ToQStr(m_stage, pipeType)).arg(IsD3D(pipeType) ? "CB" : "UBO").arg(m_slot); - if(m_Ctx != NULL && m_Ctx->CurPipelineState.SupportsResourceArrays()) + if(m_Ctx.CurPipelineState.SupportsResourceArrays()) title += QString(" [%1]").arg(m_arrayIdx); ui->slotLabel->setText(title); diff --git a/qrenderdoc/Windows/ConstantBufferPreviewer.h b/qrenderdoc/Windows/ConstantBufferPreviewer.h index 0b333bb34..13cbc7ade 100644 --- a/qrenderdoc/Windows/ConstantBufferPreviewer.h +++ b/qrenderdoc/Windows/ConstantBufferPreviewer.h @@ -39,7 +39,7 @@ class ConstantBufferPreviewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit ConstantBufferPreviewer(CaptureContext *ctx, const ShaderStageType stage, uint32_t slot, + explicit ConstantBufferPreviewer(CaptureContext &ctx, const ShaderStageType stage, uint32_t slot, uint32_t idx, QWidget *parent = 0); ~ConstantBufferPreviewer(); @@ -60,7 +60,7 @@ private slots: private: Ui::ConstantBufferPreviewer *ui; - CaptureContext *m_Ctx = NULL; + CaptureContext &m_Ctx; ResourceId m_cbuffer; ResourceId m_shader; diff --git a/qrenderdoc/Windows/DebugMessageView.cpp b/qrenderdoc/Windows/DebugMessageView.cpp index 4eca2e886..e0b5f6b17 100644 --- a/qrenderdoc/Windows/DebugMessageView.cpp +++ b/qrenderdoc/Windows/DebugMessageView.cpp @@ -32,9 +32,9 @@ static const int EIDRole = Qt::UserRole + 1; class DebugMessageItemModel : public QAbstractItemModel { public: - DebugMessageItemModel(CaptureContext *ctx, QObject *parent) : QAbstractItemModel(parent) + DebugMessageItemModel(CaptureContext &ctx, QObject *parent) + : QAbstractItemModel(parent), m_Ctx(ctx) { - m_Ctx = ctx; } void refresh() @@ -54,7 +54,7 @@ public: QModelIndex parent(const QModelIndex &index) const override { return QModelIndex(); } int rowCount(const QModelIndex &parent = QModelIndex()) const override { - return m_Ctx->DebugMessages.count(); + return m_Ctx.DebugMessages.count(); } int columnCount(const QModelIndex &parent = QModelIndex()) const override { return 6; } Qt::ItemFlags flags(const QModelIndex &index) const override @@ -93,7 +93,7 @@ public: if(col >= 0 && col < columnCount() && row < rowCount()) { - const DebugMessage &msg = m_Ctx->DebugMessages[row]; + const DebugMessage &msg = m_Ctx.DebugMessages[row]; switch(col) { @@ -109,22 +109,22 @@ public: } if(index.isValid() && role == EIDRole && index.row() >= 0 && - index.row() < m_Ctx->DebugMessages.count()) - return m_Ctx->DebugMessages[index.row()].eventID; + index.row() < m_Ctx.DebugMessages.count()) + return m_Ctx.DebugMessages[index.row()].eventID; return QVariant(); } private: - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; }; class DebugMessageFilterModel : public QSortFilterProxyModel { public: - DebugMessageFilterModel(CaptureContext *ctx, QObject *parent) : QSortFilterProxyModel(parent) + DebugMessageFilterModel(CaptureContext &ctx, QObject *parent) + : QSortFilterProxyModel(parent), m_Ctx(ctx) { - m_Ctx = ctx; } typedef QPair, uint32_t> DebugMessageType; @@ -164,7 +164,7 @@ protected: bool isVisibleRow(int sourceRow) const { - const DebugMessage &msg = m_Ctx->DebugMessages[sourceRow]; + const DebugMessage &msg = m_Ctx.DebugMessages[sourceRow]; if(m_HiddenSources.contains(msg.source)) return false; @@ -183,8 +183,8 @@ protected: bool lessThan(const QModelIndex &left, const QModelIndex &right) const override { - const DebugMessage &leftMsg = m_Ctx->DebugMessages[left.row()]; - const DebugMessage &rightMsg = m_Ctx->DebugMessages[right.row()]; + const DebugMessage &leftMsg = m_Ctx.DebugMessages[left.row()]; + const DebugMessage &rightMsg = m_Ctx.DebugMessages[right.row()]; if(leftMsg.eventID < rightMsg.eventID) return true; @@ -205,16 +205,14 @@ protected: } private: - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; }; -DebugMessageView::DebugMessageView(CaptureContext *ctx, QWidget *parent) - : QFrame(parent), ui(new Ui::DebugMessageView) +DebugMessageView::DebugMessageView(CaptureContext &ctx, QWidget *parent) + : QFrame(parent), ui(new Ui::DebugMessageView), m_Ctx(ctx) { ui->setupUi(this); - m_Ctx = ctx; - m_ItemModel = new DebugMessageItemModel(m_Ctx, this); m_FilterModel = new DebugMessageFilterModel(m_Ctx, this); @@ -225,7 +223,7 @@ DebugMessageView::DebugMessageView(CaptureContext *ctx, QWidget *parent) QObject::connect(ui->messages, &QWidget::customContextMenuRequested, this, &DebugMessageView::messages_contextMenu); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); m_ContextMenu = new QMenu(this); @@ -256,9 +254,9 @@ DebugMessageView::DebugMessageView(CaptureContext *ctx, QWidget *parent) DebugMessageView::~DebugMessageView() { - m_Ctx->windowClosed(this); + m_Ctx.windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.RemoveLogViewer(this); delete ui; } @@ -280,8 +278,8 @@ void DebugMessageView::RefreshMessageList() ui->messages->resizeColumnsToContents(); - if(m_Ctx->UnreadMessageCount > 0) - setWindowTitle(tr("(%1) Errors and Warnings").arg(m_Ctx->UnreadMessageCount)); + if(m_Ctx.UnreadMessageCount > 0) + setWindowTitle(tr("(%1) Errors and Warnings").arg(m_Ctx.UnreadMessageCount)); else setWindowTitle(tr("Errors and Warnings")); } @@ -293,7 +291,7 @@ void DebugMessageView::on_messages_doubleClicked(const QModelIndex &index) if(var.isValid()) { uint32_t eid = var.toUInt(); - m_Ctx->SetEventID({}, eid, eid); + m_Ctx.SetEventID({}, eid, eid); } } @@ -341,7 +339,7 @@ void DebugMessageView::messages_toggled() void DebugMessageView::messages_contextMenu(const QPoint &pos) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QModelIndex index = ui->messages->indexAt(pos); @@ -350,7 +348,7 @@ void DebugMessageView::messages_contextMenu(const QPoint &pos) { index = m_FilterModel->mapToSource(index); - const DebugMessage &msg = m_Ctx->DebugMessages[index.row()]; + const DebugMessage &msg = m_Ctx.DebugMessages[index.row()]; QString hide = tr("Hide"); QString show = tr("Show"); @@ -377,9 +375,9 @@ void DebugMessageView::messages_contextMenu(const QPoint &pos) void DebugMessageView::paintEvent(QPaintEvent *e) { - if(m_Ctx->UnreadMessageCount > 0) + if(m_Ctx.UnreadMessageCount > 0) { - m_Ctx->UnreadMessageCount = 0; + m_Ctx.UnreadMessageCount = 0; RefreshMessageList(); } diff --git a/qrenderdoc/Windows/DebugMessageView.h b/qrenderdoc/Windows/DebugMessageView.h index f5c9b8ff4..306b1069e 100644 --- a/qrenderdoc/Windows/DebugMessageView.h +++ b/qrenderdoc/Windows/DebugMessageView.h @@ -42,7 +42,7 @@ class DebugMessageView : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit DebugMessageView(CaptureContext *ctx, QWidget *parent = 0); + explicit DebugMessageView(CaptureContext &ctx, QWidget *parent = 0); ~DebugMessageView(); void OnLogfileLoaded(); @@ -62,7 +62,7 @@ private slots: private: void paintEvent(QPaintEvent *e); Ui::DebugMessageView *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; QVector m_Messages; DebugMessageItemModel *m_ItemModel; diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp index cbbaaa83a..812699dd9 100644 --- a/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.cpp @@ -110,7 +110,7 @@ void CaptureSettings::fromJSON(const QVariantMap &data) Options.DebugOutputMute = opts["DebugOutputMute"].toBool(); } -CaptureDialog::CaptureDialog(CaptureContext *ctx, OnCaptureMethod captureCallback, +CaptureDialog::CaptureDialog(CaptureContext &ctx, OnCaptureMethod captureCallback, OnInjectMethod injectCallback, QWidget *parent) : QFrame(parent), ui(new Ui::CaptureDialog), m_Ctx(ctx) { @@ -170,7 +170,7 @@ CaptureDialog::CaptureDialog(CaptureContext *ctx, OnCaptureMethod captureCallbac CaptureDialog::~CaptureDialog() { - m_Ctx->windowClosed(this); + m_Ctx.windowClosed(this); if(ui->toggleGlobal->isChecked()) { @@ -208,7 +208,7 @@ void CaptureDialog::setInjectMode(bool inject) QSizePolicy::Expanding); ui->verticalLayout->invalidate(); - ui->globalGroup->setVisible(m_Ctx->Config.AllowGlobalHook); + ui->globalGroup->setVisible(m_Ctx.Config.AllowGlobalHook); ui->launch->setText("Launch"); this->setWindowTitle("Capture Executable"); @@ -259,7 +259,7 @@ void CaptureDialog::on_exePath_textChanged(const QString &text) { QString path = dir.absolutePath(); - if(!m_Ctx->Renderer()->remote()) + if(!m_Ctx.Renderer().remote()) path = QDir::toNativeSeparators(path); // match the path separators from the path @@ -299,16 +299,16 @@ void CaptureDialog::on_exePathBrowse_clicked() { initDir = dir.absolutePath(); } - else if(m_Ctx->Config.LastCapturePath != "") + else if(m_Ctx.Config.LastCapturePath != "") { - initDir = m_Ctx->Config.LastCapturePath; - if(m_Ctx->Config.LastCaptureExe != "") - file = m_Ctx->Config.LastCaptureExe; + initDir = m_Ctx.Config.LastCapturePath; + if(m_Ctx.Config.LastCaptureExe != "") + file = m_Ctx.Config.LastCaptureExe; } QString filename; - if(m_Ctx->Renderer()->remote()) + if(m_Ctx.Renderer().remote()) { VirtualFileDialog vfd(m_Ctx, this); RDDialog::show(&vfd); @@ -336,13 +336,13 @@ void CaptureDialog::on_workDirBrowse_clicked() QDir dir = QFileInfo(ui->exePath->text()).dir(); if(dir.exists()) initDir = dir.absolutePath(); - else if(m_Ctx->Config.LastCapturePath != "") - initDir = m_Ctx->Config.LastCapturePath; + else if(m_Ctx.Config.LastCapturePath != "") + initDir = m_Ctx.Config.LastCapturePath; } QString dir; - if(m_Ctx->Renderer()->remote()) + if(m_Ctx.Renderer().remote()) { VirtualFileDialog vfd(m_Ctx, this); vfd.setDirBrowse(); @@ -384,7 +384,7 @@ void CaptureDialog::on_saveSettings_clicked() if(dirinfo.exists()) { saveSettings(filename); - PersistantConfig::AddRecentFile(m_Ctx->Config.RecentCaptureSettings, filename, 10); + PersistantConfig::AddRecentFile(m_Ctx.Config.RecentCaptureSettings, filename, 10); } } } @@ -397,7 +397,7 @@ void CaptureDialog::on_loadSettings_clicked() if(filename != "" && QFileInfo::exists(filename)) { loadSettings(filename); - PersistantConfig::AddRecentFile(m_Ctx->Config.RecentCaptureSettings, filename, 10); + PersistantConfig::AddRecentFile(m_Ctx.Config.RecentCaptureSettings, filename, 10); } } @@ -505,15 +505,15 @@ void CaptureDialog::fillProcessList() void CaptureDialog::setExecutableFilename(QString filename) { - if(!m_Ctx->Renderer()->remote()) + if(!m_Ctx.Renderer().remote()) filename = QDir::toNativeSeparators(QFileInfo(filename).absoluteFilePath()); ui->exePath->setText(filename); - if(!m_Ctx->Renderer()->remote()) + if(!m_Ctx.Renderer().remote()) { - m_Ctx->Config.LastCapturePath = QFileInfo(filename).absolutePath(); - m_Ctx->Config.LastCaptureExe = QFileInfo(filename).completeBaseName(); + m_Ctx.Config.LastCapturePath = QFileInfo(filename).absolutePath(); + m_Ctx.Config.LastCaptureExe = QFileInfo(filename).completeBaseName(); } } @@ -546,7 +546,7 @@ void CaptureDialog::loadSettings(QString filename) void CaptureDialog::updateGlobalHook() { - ui->globalGroup->setVisible(!injectMode() && m_Ctx->Config.AllowGlobalHook); + ui->globalGroup->setVisible(!injectMode() && m_Ctx.Config.AllowGlobalHook); if(ui->exePath->text().length() >= 4) { @@ -609,7 +609,7 @@ void CaptureDialog::triggerCapture() QString exe = ui->exePath->text(); // for non-remote captures, check the executable locally - if(!m_Ctx->Renderer()->remote()) + if(!m_Ctx.Renderer().remote()) { if(!QFileInfo::exists(exe)) { @@ -622,7 +622,7 @@ void CaptureDialog::triggerCapture() QString workingDir = ""; // for non-remote captures, check the directory locally - if(m_Ctx->Renderer()->remote()) + if(m_Ctx.Renderer().remote()) { workingDir = ui->workDirPath->text(); } diff --git a/qrenderdoc/Windows/Dialogs/CaptureDialog.h b/qrenderdoc/Windows/Dialogs/CaptureDialog.h index f26f03e07..c02ae8baa 100644 --- a/qrenderdoc/Windows/Dialogs/CaptureDialog.h +++ b/qrenderdoc/Windows/Dialogs/CaptureDialog.h @@ -64,7 +64,7 @@ public: const QString &name, CaptureOptions opts)> OnInjectMethod; - explicit CaptureDialog(CaptureContext *ctx, OnCaptureMethod captureCallback, + explicit CaptureDialog(CaptureContext &ctx, OnCaptureMethod captureCallback, OnInjectMethod injectCallback, QWidget *parent = 0); ~CaptureDialog(); @@ -100,7 +100,7 @@ private slots: private: Ui::CaptureDialog *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; QStandardItemModel *m_ProcessModel; diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp index 62a16273e..51e5ba7a8 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.cpp +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.cpp @@ -40,7 +40,7 @@ static const int PIDRole = Qt::UserRole + 1; static const int IdentRole = Qt::UserRole + 2; static const int LogPtrRole = Qt::UserRole + 3; -LiveCapture::LiveCapture(CaptureContext *ctx, const QString &hostname, uint32_t ident, +LiveCapture::LiveCapture(CaptureContext &ctx, const QString &hostname, uint32_t ident, MainWindow *main, QWidget *parent) : QFrame(parent), ui(new Ui::LiveCapture), @@ -141,7 +141,7 @@ void LiveCapture::QueueCapture(int frameNumber) void LiveCapture::showEvent(QShowEvent *event) { - if(m_ConnectThread == NULL) + if(!m_ConnectThread) { m_ConnectThread = new LambdaThread([this]() { this->connectionThreadEntry(); }); m_ConnectThread->start(); @@ -244,7 +244,7 @@ void LiveCapture::openNewWindow_triggered() { CaptureLog *log = GetLog(ui->captures->selectedItems()[0]); - QString temppath = m_Ctx->TempLogFilename(log->exe); + QString temppath = m_Ctx.TempLogFilename(log->exe); if(!log->local) { @@ -289,7 +289,7 @@ void LiveCapture::deleteCapture_triggered() if(!log->saved) { - if(log->path == m_Ctx->LogFilename()) + if(log->path == m_Ctx.LogFilename()) { m_Main->takeLogOwnership(); m_Main->CloseLogfile(); @@ -304,7 +304,7 @@ void LiveCapture::deleteCapture_triggered() } else { - m_Ctx->Renderer()->DeleteCapture(log->path, log->local); + m_Ctx.Renderer().DeleteCapture(log->path, log->local); } } } @@ -562,10 +562,10 @@ bool LiveCapture::checkAllowClose() // we either have to save or delete the log. Make sure that if it's remote that we are able // to by having an active connection or replay context on that host. - if(suppressRemoteWarning == false && (m_Connection == NULL || !m_Connection->Connected()) && + if(suppressRemoteWarning == false && (!m_Connection || !m_Connection->Connected()) && !log->local && - (m_Ctx->Renderer()->remote() == NULL || m_Ctx->Renderer()->remote()->Hostname != m_Hostname || - !m_Ctx->Renderer()->remote()->Connected)) + (!m_Ctx.Renderer().remote() || m_Ctx.Renderer().remote()->Hostname != m_Hostname || + !m_Ctx.Renderer().remote()->Connected)) { QMessageBox::StandardButton res2 = RDDialog::question( this, tr("No active replay context"), @@ -610,9 +610,8 @@ void LiveCapture::openCapture(CaptureLog *log) { log->opened = true; - if(!log->local && - (m_Ctx->Renderer()->remote() == NULL || m_Ctx->Renderer()->remote()->Hostname != m_Hostname || - !m_Ctx->Renderer()->remote()->Connected)) + if(!log->local && (!m_Ctx.Renderer().remote() || m_Ctx.Renderer().remote()->Hostname != m_Hostname || + !m_Ctx.Renderer().remote()->Connected)) { RDDialog::critical( this, tr("No active replay context"), @@ -665,8 +664,8 @@ bool LiveCapture::saveCapture(CaptureLog *log) } else { - if(m_Ctx->Renderer()->remote() == NULL || m_Ctx->Renderer()->remote()->Hostname != m_Hostname || - !m_Ctx->Renderer()->remote()->Connected) + if(!m_Ctx.Renderer().remote() || m_Ctx.Renderer().remote()->Hostname != m_Hostname || + !m_Ctx.Renderer().remote()->Connected) { RDDialog::critical(this, tr("No active replay context"), tr("This capture is on remote host %1 and there is no active replay " @@ -677,7 +676,7 @@ bool LiveCapture::saveCapture(CaptureLog *log) return false; } - m_Ctx->Renderer()->CopyCaptureFromRemote(log->path, path, this); + m_Ctx.Renderer().CopyCaptureFromRemote(log->path, path, this); if(!QFile::exists(path)) { @@ -686,12 +685,12 @@ bool LiveCapture::saveCapture(CaptureLog *log) return false; } - m_Ctx->Renderer()->DeleteCapture(log->path, false); + m_Ctx.Renderer().DeleteCapture(log->path, false); } log->saved = true; log->path = path; - PersistantConfig::AddRecentFile(m_Ctx->Config.RecentLogFiles, path, 10); + PersistantConfig::AddRecentFile(m_Ctx.Config.RecentLogFiles, path, 10); m_Main->PopulateRecentFiles(); return true; } @@ -707,7 +706,7 @@ void LiveCapture::cleanItems() if(!log->saved) { - if(log->path == m_Ctx->LogFilename()) + if(log->path == m_Ctx.LogFilename()) { m_Main->takeLogOwnership(); } @@ -721,7 +720,7 @@ void LiveCapture::cleanItems() } else { - m_Ctx->Renderer()->DeleteCapture(log->path, log->local); + m_Ctx.Renderer().DeleteCapture(log->path, log->local); } } } @@ -819,7 +818,7 @@ void LiveCapture::captureCopied(uint32_t ID, const QString &localPath) QListWidgetItem *item = ui->captures->item(i); CaptureLog *log = GetLog(ui->captures->item(i)); - if(log != NULL && log->remoteID == ID) + if(log && log->remoteID == ID) { log->local = true; log->path = localPath; @@ -875,9 +874,8 @@ void LiveCapture::connectionClosed() // to this machine as a remote context if(!log->local) { - if(m_Ctx->Renderer()->remote() == NULL || - m_Ctx->Renderer()->remote()->Hostname != m_Hostname || - !m_Ctx->Renderer()->remote()->Connected) + if(!m_Ctx.Renderer().remote() || m_Ctx.Renderer().remote()->Hostname != m_Hostname || + !m_Ctx.Renderer().remote()->Connected) return; } @@ -919,7 +917,7 @@ void LiveCapture::connectionThreadEntry() m_Connection = RENDERDOC_CreateTargetControl(m_Hostname.toUtf8().data(), m_RemoteIdent, GetSystemUsername().toUtf8().data(), true); - if(m_Connection == NULL || !m_Connection->Connected()) + if(!m_Connection || !m_Connection->Connected()) { GUIInvoke::call([this]() { setTitle("Connection failed"); diff --git a/qrenderdoc/Windows/Dialogs/LiveCapture.h b/qrenderdoc/Windows/Dialogs/LiveCapture.h index c8a44acb8..3efb745b4 100644 --- a/qrenderdoc/Windows/Dialogs/LiveCapture.h +++ b/qrenderdoc/Windows/Dialogs/LiveCapture.h @@ -47,7 +47,7 @@ class LiveCapture : public QFrame Q_OBJECT public: - explicit LiveCapture(CaptureContext *ctx, const QString &hostname, uint32_t ident, + explicit LiveCapture(CaptureContext &ctx, const QString &runCommand, uint32_t ident, MainWindow *main, QWidget *parent = 0); ~LiveCapture(); @@ -129,7 +129,7 @@ private: void deleteCaptureUnprompted(QListWidgetItem *item); Ui::LiveCapture *ui; - CaptureContext *m_Ctx = NULL; + CaptureContext &m_Ctx; QString m_Hostname; uint32_t m_RemoteIdent; MainWindow *m_Main; diff --git a/qrenderdoc/Windows/Dialogs/RemoteManager.cpp b/qrenderdoc/Windows/Dialogs/RemoteManager.cpp index 590168349..47377a307 100644 --- a/qrenderdoc/Windows/Dialogs/RemoteManager.cpp +++ b/qrenderdoc/Windows/Dialogs/RemoteManager.cpp @@ -80,7 +80,7 @@ static void setItalic(QTreeWidgetItem *node, bool italic) node->setFont(1, f); } -RemoteManager::RemoteManager(CaptureContext *ctx, MainWindow *main) +RemoteManager::RemoteManager(CaptureContext &ctx, MainWindow *main) : QDialog(NULL), ui(new Ui::RemoteManager), m_Ctx(ctx), m_Main(main) { ui->setupUi(this); @@ -108,9 +108,9 @@ RemoteManager::RemoteManager(CaptureContext *ctx, MainWindow *main) vertical->addWidget(lookupsProgressFlow); vertical->addWidget(ui->bottomLayout->parentWidget()); - m_Ctx->Config.AddAndroidHosts(); + m_Ctx.Config.AddAndroidHosts(); - for(RemoteHost *h : m_Ctx->Config.RemoteHosts) + for(RemoteHost *h : m_Ctx.Config.RemoteHosts) addHost(h); on_hosts_itemClicked(ui->hosts->topLevelItem(0), 0); @@ -355,9 +355,9 @@ void RemoteManager::addNewHost() { bool found = false; - for(int i = 0; i < m_Ctx->Config.RemoteHosts.count(); i++) + for(int i = 0; i < m_Ctx.Config.RemoteHosts.count(); i++) { - if(m_Ctx->Config.RemoteHosts[i]->Hostname.compare(host, Qt::CaseInsensitive) == 0) + if(m_Ctx.Config.RemoteHosts[i]->Hostname.compare(host, Qt::CaseInsensitive) == 0) { found = true; break; @@ -370,8 +370,8 @@ void RemoteManager::addNewHost() h->Hostname = host; h->RunCommand = ui->runCommand->text().trimmed(); - m_Ctx->Config.RemoteHosts.push_back(h); - m_Ctx->Config.Save(); + m_Ctx.Config.RemoteHosts.push_back(h); + m_Ctx.Config.Save(); addHost(h); } @@ -390,7 +390,7 @@ void RemoteManager::setRunCommand() if(h) { h->RunCommand = ui->runCommand->text().trimmed(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } } @@ -597,7 +597,7 @@ void RemoteManager::on_connect_clicked() // shut down if(host->Connected) { - m_Ctx->Renderer()->ShutdownServer(); + m_Ctx.Renderer().ShutdownServer(); setRemoteServerLive(node, false, false); } else @@ -660,9 +660,9 @@ void RemoteManager::on_deleteHost_clicked() if(res == QMessageBox::Yes) { - int idx = m_Ctx->Config.RemoteHosts.indexOf(host); - delete m_Ctx->Config.RemoteHosts.takeAt(idx); - m_Ctx->Config.Save(); + int idx = m_Ctx.Config.RemoteHosts.indexOf(host); + delete m_Ctx.Config.RemoteHosts.takeAt(idx); + m_Ctx.Config.Save(); deleteChildren(item); diff --git a/qrenderdoc/Windows/Dialogs/RemoteManager.h b/qrenderdoc/Windows/Dialogs/RemoteManager.h index 1f23c6424..16d6b7f17 100644 --- a/qrenderdoc/Windows/Dialogs/RemoteManager.h +++ b/qrenderdoc/Windows/Dialogs/RemoteManager.h @@ -42,7 +42,7 @@ class RemoteManager : public QDialog Q_OBJECT public: - explicit RemoteManager(CaptureContext *ctx, MainWindow *main); + explicit RemoteManager(CaptureContext &ctx, MainWindow *main); ~RemoteManager(); private slots: @@ -61,7 +61,7 @@ private slots: private: Ui::RemoteManager *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; MainWindow *m_Main; QWidget *lookupsProgressFlow; diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp index 994f22332..60c352d3c 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.cpp @@ -30,11 +30,9 @@ #include "CaptureDialog.h" #include "ui_SettingsDialog.h" -SettingsDialog::SettingsDialog(CaptureContext *ctx, QWidget *parent) - : QDialog(parent), ui(new Ui::SettingsDialog) +SettingsDialog::SettingsDialog(CaptureContext &ctx, QWidget *parent) + : QDialog(parent), ui(new Ui::SettingsDialog), m_Ctx(ctx) { - m_Ctx = ctx; - ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); @@ -55,41 +53,41 @@ SettingsDialog::SettingsDialog(CaptureContext *ctx, QWidget *parent) ui->pages->setItemSelected(ui->pages->item(0), true); ui->tabWidget->setCurrentIndex(0); - ui->saveDirectory->setText(m_Ctx->Config.DefaultCaptureSaveDirectory); - ui->tempDirectory->setText(m_Ctx->Config.TemporaryCaptureDirectory); + ui->saveDirectory->setText(m_Ctx.Config.DefaultCaptureSaveDirectory); + ui->tempDirectory->setText(m_Ctx.Config.TemporaryCaptureDirectory); // TODO external disassembler /* - ui->ExternalDisassemblerEnabled->setChecked(m_Ctx->Config.ExternalDisassemblerEnabled); - ui->externalDisassemblerArgs->setText(m_Ctx->Config.GetDefaultExternalDisassembler().args); - ui->externalDisassemblePath->setText(m_Ctx->Config.GetDefaultExternalDisassembler().executable); + ui->ExternalDisassemblerEnabled->setChecked(m_Ctx.Config.ExternalDisassemblerEnabled); + ui->externalDisassemblerArgs->setText(m_Ctx.Config.GetDefaultExternalDisassembler().args); + ui->externalDisassemblePath->setText(m_Ctx.Config.GetDefaultExternalDisassembler().executable); */ - ui->Android_AdbExecutablePath->setText(m_Ctx->Config.Android_AdbExecutablePath); - ui->Android_MaxConnectTimeout->setValue(m_Ctx->Config.Android_MaxConnectTimeout); + ui->Android_AdbExecutablePath->setText(m_Ctx.Config.Android_AdbExecutablePath); + ui->Android_MaxConnectTimeout->setValue(m_Ctx.Config.Android_MaxConnectTimeout); - ui->TextureViewer_ResetRange->setChecked(m_Ctx->Config.TextureViewer_ResetRange); - ui->TextureViewer_PerTexSettings->setChecked(m_Ctx->Config.TextureViewer_PerTexSettings); - ui->ShaderViewer_FriendlyNaming->setChecked(m_Ctx->Config.ShaderViewer_FriendlyNaming); - ui->CheckUpdate_AllowChecks->setChecked(m_Ctx->Config.CheckUpdate_AllowChecks); - ui->Font_PreferMonospaced->setChecked(m_Ctx->Config.Font_PreferMonospaced); + ui->TextureViewer_ResetRange->setChecked(m_Ctx.Config.TextureViewer_ResetRange); + ui->TextureViewer_PerTexSettings->setChecked(m_Ctx.Config.TextureViewer_PerTexSettings); + ui->ShaderViewer_FriendlyNaming->setChecked(m_Ctx.Config.ShaderViewer_FriendlyNaming); + ui->CheckUpdate_AllowChecks->setChecked(m_Ctx.Config.CheckUpdate_AllowChecks); + ui->Font_PreferMonospaced->setChecked(m_Ctx.Config.Font_PreferMonospaced); - ui->AlwaysReplayLocally->setChecked(m_Ctx->Config.AlwaysReplayLocally); + ui->AlwaysReplayLocally->setChecked(m_Ctx.Config.AlwaysReplayLocally); - ui->AllowGlobalHook->setChecked(m_Ctx->Config.AllowGlobalHook); + ui->AllowGlobalHook->setChecked(m_Ctx.Config.AllowGlobalHook); - ui->EventBrowser_TimeUnit->setCurrentIndex((int)m_Ctx->Config.EventBrowser_TimeUnit); - ui->EventBrowser_HideEmpty->setChecked(m_Ctx->Config.EventBrowser_HideEmpty); - ui->EventBrowser_HideAPICalls->setChecked(m_Ctx->Config.EventBrowser_HideAPICalls); - ui->EventBrowser_ApplyColours->setChecked(m_Ctx->Config.EventBrowser_ApplyColours); - ui->EventBrowser_ColourEventRow->setChecked(m_Ctx->Config.EventBrowser_ColourEventRow); + ui->EventBrowser_TimeUnit->setCurrentIndex((int)m_Ctx.Config.EventBrowser_TimeUnit); + ui->EventBrowser_HideEmpty->setChecked(m_Ctx.Config.EventBrowser_HideEmpty); + ui->EventBrowser_HideAPICalls->setChecked(m_Ctx.Config.EventBrowser_HideAPICalls); + ui->EventBrowser_ApplyColours->setChecked(m_Ctx.Config.EventBrowser_ApplyColours); + ui->EventBrowser_ColourEventRow->setChecked(m_Ctx.Config.EventBrowser_ColourEventRow); // disable sub-checkbox ui->EventBrowser_ColourEventRow->setEnabled(ui->EventBrowser_ApplyColours->isChecked()); - ui->Formatter_MinFigures->setValue(m_Ctx->Config.Formatter_MinFigures); - ui->Formatter_MaxFigures->setValue(m_Ctx->Config.Formatter_MaxFigures); - ui->Formatter_NegExp->setValue(m_Ctx->Config.Formatter_NegExp); - ui->Formatter_PosExp->setValue(m_Ctx->Config.Formatter_PosExp); + ui->Formatter_MinFigures->setValue(m_Ctx.Config.Formatter_MinFigures); + ui->Formatter_MaxFigures->setValue(m_Ctx.Config.Formatter_MaxFigures); + ui->Formatter_NegExp->setValue(m_Ctx.Config.Formatter_NegExp); + ui->Formatter_PosExp->setValue(m_Ctx.Config.Formatter_PosExp); m_Init = false; @@ -131,76 +129,76 @@ void SettingsDialog::on_okButton_accepted() // general void SettingsDialog::formatter_valueChanged(int val) { - m_Ctx->Config.Formatter_MinFigures = ui->Formatter_MinFigures->value(); - m_Ctx->Config.Formatter_MaxFigures = ui->Formatter_MaxFigures->value(); - m_Ctx->Config.Formatter_NegExp = ui->Formatter_NegExp->value(); - m_Ctx->Config.Formatter_PosExp = ui->Formatter_PosExp->value(); + m_Ctx.Config.Formatter_MinFigures = ui->Formatter_MinFigures->value(); + m_Ctx.Config.Formatter_MaxFigures = ui->Formatter_MaxFigures->value(); + m_Ctx.Config.Formatter_NegExp = ui->Formatter_NegExp->value(); + m_Ctx.Config.Formatter_PosExp = ui->Formatter_PosExp->value(); - m_Ctx->Config.SetupFormatting(); + m_Ctx.Config.SetupFormatting(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_tempDirectory_textEdited(const QString &dir) { if(QDir(dir).exists()) - m_Ctx->Config.TemporaryCaptureDirectory = dir; + m_Ctx.Config.TemporaryCaptureDirectory = dir; else - m_Ctx->Config.TemporaryCaptureDirectory = ""; + m_Ctx.Config.TemporaryCaptureDirectory = ""; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_saveDirectory_textEdited(const QString &dir) { if(QDir(dir).exists() || dir == "") - m_Ctx->Config.DefaultCaptureSaveDirectory = dir; + m_Ctx.Config.DefaultCaptureSaveDirectory = dir; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_browseSaveCaptureDirectory_clicked() { QString dir = RDDialog::getExistingDirectory(this, "Choose default directory for saving captures", - m_Ctx->Config.DefaultCaptureSaveDirectory); + m_Ctx.Config.DefaultCaptureSaveDirectory); if(dir != "") - m_Ctx->Config.DefaultCaptureSaveDirectory = dir; + m_Ctx.Config.DefaultCaptureSaveDirectory = dir; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_AllowGlobalHook_toggled(bool checked) { - m_Ctx->Config.AllowGlobalHook = ui->AllowGlobalHook->isChecked(); + m_Ctx.Config.AllowGlobalHook = ui->AllowGlobalHook->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); - if(m_Ctx->hasCaptureDialog()) - m_Ctx->captureDialog()->updateGlobalHook(); + if(m_Ctx.hasCaptureDialog()) + m_Ctx.captureDialog()->updateGlobalHook(); } void SettingsDialog::on_CheckUpdate_AllowChecks_toggled(bool checked) { - m_Ctx->Config.CheckUpdate_AllowChecks = ui->CheckUpdate_AllowChecks->isChecked(); + m_Ctx.Config.CheckUpdate_AllowChecks = ui->CheckUpdate_AllowChecks->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_Font_PreferMonospaced_toggled(bool checked) { - m_Ctx->Config.Font_PreferMonospaced = ui->Font_PreferMonospaced->isChecked(); + m_Ctx.Config.Font_PreferMonospaced = ui->Font_PreferMonospaced->isChecked(); - m_Ctx->Config.SetupFormatting(); + m_Ctx.Config.SetupFormatting(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_AlwaysReplayLocally_toggled(bool checked) { - m_Ctx->Config.AlwaysReplayLocally = ui->AlwaysReplayLocally->isChecked(); + m_Ctx.Config.AlwaysReplayLocally = ui->AlwaysReplayLocally->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } // core @@ -209,44 +207,44 @@ void SettingsDialog::on_chooseSearchPaths_clicked() OrderedListEditor listEd(tr("Shader debug info search paths"), tr("Search Path"), BrowseMode::Folder, this); - listEd.setItems(m_Ctx->Config.GetConfigSetting("shader.debug.searchPaths") + listEd.setItems(m_Ctx.Config.GetConfigSetting("shader.debug.searchPaths") .split(QChar(';'), QString::SkipEmptyParts)); int res = RDDialog::show(&listEd); if(res) - m_Ctx->Config.SetConfigSetting("shader.debug.searchPaths", listEd.getItems().join(QChar(';'))); + m_Ctx.Config.SetConfigSetting("shader.debug.searchPaths", listEd.getItems().join(QChar(';'))); } // texture viewer void SettingsDialog::on_TextureViewer_PerTexSettings_toggled(bool checked) { - m_Ctx->Config.TextureViewer_PerTexSettings = ui->TextureViewer_PerTexSettings->isChecked(); + m_Ctx.Config.TextureViewer_PerTexSettings = ui->TextureViewer_PerTexSettings->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_TextureViewer_ResetRange_toggled(bool checked) { - m_Ctx->Config.TextureViewer_ResetRange = ui->TextureViewer_ResetRange->isChecked(); + m_Ctx.Config.TextureViewer_ResetRange = ui->TextureViewer_ResetRange->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } // shader viewer void SettingsDialog::on_ShaderViewer_FriendlyNaming_toggled(bool checked) { - m_Ctx->Config.ShaderViewer_FriendlyNaming = ui->ShaderViewer_FriendlyNaming->isChecked(); + m_Ctx.Config.ShaderViewer_FriendlyNaming = ui->ShaderViewer_FriendlyNaming->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_ExternalDisassemblerEnabled_toggled(bool checked) { // TODO external disassembler - // m_Ctx->Config.ExternalDisassemblerEnabled = ui->ExternalDisassemblerEnabled->isChecked(); + // m_Ctx.Config.ExternalDisassemblerEnabled = ui->ExternalDisassemblerEnabled->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_browseExtDisasemble_clicked() @@ -258,14 +256,14 @@ void SettingsDialog::on_externalDisassemblePath_textEdited(const QString &disasm { // TODO external disassembler - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_externalDisassemblerArgs_textEdited(const QString &args) { // TODO external disassembler - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } // event browser @@ -274,75 +272,75 @@ void SettingsDialog::on_EventBrowser_TimeUnit_currentIndexChanged(int index) if(m_Init) return; - m_Ctx->Config.EventBrowser_TimeUnit = + m_Ctx.Config.EventBrowser_TimeUnit = (PersistantConfig::TimeUnit)ui->EventBrowser_TimeUnit->currentIndex(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_EventBrowser_HideEmpty_toggled(bool checked) { - m_Ctx->Config.EventBrowser_HideEmpty = ui->EventBrowser_HideEmpty->isChecked(); + m_Ctx.Config.EventBrowser_HideEmpty = ui->EventBrowser_HideEmpty->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_EventBrowser_HideAPICalls_toggled(bool checked) { - m_Ctx->Config.EventBrowser_HideAPICalls = ui->EventBrowser_HideAPICalls->isChecked(); + m_Ctx.Config.EventBrowser_HideAPICalls = ui->EventBrowser_HideAPICalls->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_EventBrowser_ApplyColours_toggled(bool checked) { - m_Ctx->Config.EventBrowser_ApplyColours = ui->EventBrowser_ApplyColours->isChecked(); + m_Ctx.Config.EventBrowser_ApplyColours = ui->EventBrowser_ApplyColours->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_EventBrowser_ColourEventRow_toggled(bool checked) { - m_Ctx->Config.EventBrowser_ColourEventRow = ui->EventBrowser_ColourEventRow->isChecked(); + m_Ctx.Config.EventBrowser_ColourEventRow = ui->EventBrowser_ColourEventRow->isChecked(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } // android void SettingsDialog::on_browseTempCaptureDirectory_clicked() { QString dir = RDDialog::getExistingDirectory(this, "Choose directory for temporary captures", - m_Ctx->Config.TemporaryCaptureDirectory); + m_Ctx.Config.TemporaryCaptureDirectory); if(dir != "") - m_Ctx->Config.TemporaryCaptureDirectory = dir; + m_Ctx.Config.TemporaryCaptureDirectory = dir; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_browseAdbPath_clicked() { QString adb = RDDialog::getExecutableFileName( this, "Locate adb executable", - QFileInfo(m_Ctx->Config.Android_AdbExecutablePath).absoluteDir().path()); + QFileInfo(m_Ctx.Config.Android_AdbExecutablePath).absoluteDir().path()); if(adb != "") - m_Ctx->Config.Android_AdbExecutablePath = adb; + m_Ctx.Config.Android_AdbExecutablePath = adb; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_Android_MaxConnectTimeout_valueChanged(double timeout) { - m_Ctx->Config.Android_MaxConnectTimeout = ui->Android_MaxConnectTimeout->value(); + m_Ctx.Config.Android_MaxConnectTimeout = ui->Android_MaxConnectTimeout->value(); - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } void SettingsDialog::on_Android_AdbExecutablePath_textEdited(const QString &adb) { if(QFileInfo::exists(adb)) - m_Ctx->Config.Android_AdbExecutablePath = adb; + m_Ctx.Config.Android_AdbExecutablePath = adb; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } diff --git a/qrenderdoc/Windows/Dialogs/SettingsDialog.h b/qrenderdoc/Windows/Dialogs/SettingsDialog.h index 9b281ba57..96fca8f78 100644 --- a/qrenderdoc/Windows/Dialogs/SettingsDialog.h +++ b/qrenderdoc/Windows/Dialogs/SettingsDialog.h @@ -40,7 +40,7 @@ class SettingsDialog : public QDialog Q_OBJECT public: - explicit SettingsDialog(CaptureContext *ctx, QWidget *parent = 0); + explicit SettingsDialog(CaptureContext &ctx, QWidget *parent = 0); ~SettingsDialog(); private slots: @@ -93,6 +93,6 @@ private slots: private: Ui::SettingsDialog *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; bool m_Init = false; }; diff --git a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp index 842edf400..78493978d 100644 --- a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp +++ b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.cpp @@ -47,8 +47,8 @@ public: FileNameRole, }; - RemoteFileModel(RenderManager *r, QObject *parent = NULL) - : Renderer(*r), QAbstractItemModel(parent) + RemoteFileModel(RenderManager &r, QObject *parent = NULL) + : Renderer(r), QAbstractItemModel(parent) { makeIconStates(fileIcon, QString::fromUtf8(":/page_white_database.png")); makeIconStates(exeIcon, QString::fromUtf8(":/page_white_code.png")); @@ -550,14 +550,14 @@ protected: } }; -VirtualFileDialog::VirtualFileDialog(CaptureContext *ctx, QWidget *parent) +VirtualFileDialog::VirtualFileDialog(CaptureContext &ctx, QWidget *parent) : QDialog(parent), ui(new Ui::VirtualFileDialog) { ui->setupUi(this); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); - m_Model = new RemoteFileModel(ctx->Renderer(), this); + m_Model = new RemoteFileModel(ctx.Renderer(), this); m_DirProxy = new RemoteFileProxy(this); m_DirProxy->setSourceModel(m_Model); diff --git a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.h b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.h index dc13311d2..1db1b427b 100644 --- a/qrenderdoc/Windows/Dialogs/VirtualFileDialog.h +++ b/qrenderdoc/Windows/Dialogs/VirtualFileDialog.h @@ -40,7 +40,7 @@ class VirtualFileDialog : public QDialog Q_OBJECT public: - explicit VirtualFileDialog(CaptureContext *ctx, QWidget *parent = 0); + explicit VirtualFileDialog(CaptureContext &ctx, QWidget *parent = 0); ~VirtualFileDialog(); QString chosenPath() { return m_ChosenPath; } diff --git a/qrenderdoc/Windows/EventBrowser.cpp b/qrenderdoc/Windows/EventBrowser.cpp index 25e47c859..f61e026c5 100644 --- a/qrenderdoc/Windows/EventBrowser.cpp +++ b/qrenderdoc/Windows/EventBrowser.cpp @@ -40,12 +40,12 @@ enum COL_LAST_EID, }; -EventBrowser::EventBrowser(CaptureContext *ctx, QWidget *parent) +EventBrowser::EventBrowser(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::EventBrowser), m_Ctx(ctx) { ui->setupUi(this); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); ui->events->header()->resizeSection(COL_EID, 45); @@ -84,8 +84,8 @@ EventBrowser::EventBrowser(CaptureContext *ctx, QWidget *parent) EventBrowser::~EventBrowser() { - m_Ctx->windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.windowClosed(this); + m_Ctx.RemoveLogViewer(this); delete ui; delete m_SizeDelegate; } @@ -94,7 +94,7 @@ void EventBrowser::OnLogfileLoaded() { QTreeWidgetItem *frame = new QTreeWidgetItem( (QTreeWidget *)NULL, - QStringList{QString("Frame #%1").arg(m_Ctx->FrameInfo().frameNumber), "", ""}); + QStringList{QString("Frame #%1").arg(m_Ctx.FrameInfo().frameNumber), "", ""}); QTreeWidgetItem *framestart = new QTreeWidgetItem(frame, QStringList{"Frame Start", "0", ""}); framestart->setData(COL_EID, Qt::UserRole, QVariant(0)); @@ -103,7 +103,7 @@ void EventBrowser::OnLogfileLoaded() framestart->setData(COL_BOOKMARK, Qt::UserRole, QVariant(false)); framestart->setData(COL_LAST_EID, Qt::UserRole, QVariant(0)); - uint lastEID = AddDrawcalls(frame, m_Ctx->CurDrawcalls()); + uint lastEID = AddDrawcalls(frame, m_Ctx.CurDrawcalls()); frame->setData(COL_EID, Qt::UserRole, QVariant(0)); frame->setData(COL_LAST_EID, Qt::UserRole, QVariant(lastEID)); @@ -111,7 +111,7 @@ void EventBrowser::OnLogfileLoaded() ui->events->expandItem(frame); - m_Ctx->SetEventID({this}, lastEID, lastEID); + m_Ctx.SetEventID({this}, lastEID, lastEID); } void EventBrowser::OnLogfileClosed() @@ -220,7 +220,7 @@ void EventBrowser::on_toolButton_clicked() void EventBrowser::on_timeDraws_clicked() { - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { uint32_t counters[] = {eCounter_EventGPUDuration}; @@ -249,7 +249,7 @@ void EventBrowser::on_events_currentItemChanged(QTreeWidgetItem *current, QTreeW uint EID = current->data(COL_EID, Qt::UserRole).toUInt(); uint lastEID = current->data(COL_LAST_EID, Qt::UserRole).toUInt(); - m_Ctx->SetEventID({this}, EID, lastEID); + m_Ctx.SetEventID({this}, EID, lastEID); } void EventBrowser::on_HideFindJump() @@ -379,7 +379,7 @@ void EventBrowser::ExpandNode(QTreeWidgetItem *node) bool EventBrowser::SelectEvent(uint32_t eventID) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return false; QTreeWidgetItem *found = NULL; @@ -413,7 +413,7 @@ void EventBrowser::ClearFindIcons(QTreeWidgetItem *parent) void EventBrowser::ClearFindIcons() { - if(m_Ctx->LogLoaded()) + if(m_Ctx.LogLoaded()) ClearFindIcons(ui->events->topLevelItem(0)); } @@ -507,7 +507,7 @@ int EventBrowser::FindEvent(QTreeWidgetItem *parent, QString filter, uint32_t af int EventBrowser::FindEvent(QString filter, uint32_t after, bool forward) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return 0; return FindEvent(ui->events->topLevelItem(0), filter, after, forward); @@ -518,7 +518,7 @@ void EventBrowser::Find(bool forward) if(ui->findEvent->text().isEmpty()) return; - uint32_t curEID = m_Ctx->CurEvent(); + uint32_t curEID = m_Ctx.CurEvent(); if(!ui->events->selectedItems().isEmpty()) curEID = ui->events->selectedItems()[0]->data(COL_LAST_EID, Qt::UserRole).toUInt(); diff --git a/qrenderdoc/Windows/EventBrowser.h b/qrenderdoc/Windows/EventBrowser.h index a15b5ebb2..ff6776e6a 100644 --- a/qrenderdoc/Windows/EventBrowser.h +++ b/qrenderdoc/Windows/EventBrowser.h @@ -43,7 +43,7 @@ private: Q_OBJECT public: - explicit EventBrowser(CaptureContext *ctx, QWidget *parent = 0); + explicit EventBrowser(CaptureContext &ctx, QWidget *parent = 0); ~EventBrowser(); void OnLogfileLoaded(); @@ -98,5 +98,5 @@ private: void RefreshIcon(QTreeWidgetItem *item); Ui::EventBrowser *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; }; diff --git a/qrenderdoc/Windows/MainWindow.cpp b/qrenderdoc/Windows/MainWindow.cpp index 5b4654fad..d7779863f 100644 --- a/qrenderdoc/Windows/MainWindow.cpp +++ b/qrenderdoc/Windows/MainWindow.cpp @@ -67,7 +67,7 @@ struct Version static bool isMismatched() { return RENDERDOC_GetVersionString() != bareString(); } }; -MainWindow::MainWindow(CaptureContext *ctx) : QMainWindow(NULL), ui(new Ui::MainWindow), m_Ctx(ctx) +MainWindow::MainWindow(CaptureContext &ctx) : QMainWindow(NULL), ui(new Ui::MainWindow), m_Ctx(ctx) { ui->setupUi(this); @@ -165,9 +165,8 @@ MainWindow::MainWindow(CaptureContext *ctx) : QMainWindow(NULL), ui(new Ui::Main PopulateRecentCaptures(); ui->toolWindowManager->setRubberBandLineWidth(50); - ui->toolWindowManager->setToolWindowCreateCallback([this](const QString &objectName) -> QWidget * { - return m_Ctx->createToolWindow(objectName); - }); + ui->toolWindowManager->setToolWindowCreateCallback( + [this](const QString &objectName) -> QWidget * { return m_Ctx.createToolWindow(objectName); }); ui->action_Resolve_Symbols->setEnabled(false); ui->action_Resolve_Symbols->setText(tr("Resolve Symbols")); @@ -175,8 +174,8 @@ MainWindow::MainWindow(CaptureContext *ctx) : QMainWindow(NULL), ui(new Ui::Main bool loaded = LoadLayout(0); LambdaThread *th = new LambdaThread([this]() { - m_Ctx->Config.AddAndroidHosts(); - for(RemoteHost *host : m_Ctx->Config.RemoteHosts) + m_Ctx.Config.AddAndroidHosts(); + for(RemoteHost *host : m_Ctx.Config.RemoteHosts) host->CheckStatus(); }); th->selfDelete(true); @@ -185,36 +184,36 @@ MainWindow::MainWindow(CaptureContext *ctx) : QMainWindow(NULL), ui(new Ui::Main // create default layout if layout failed to load if(!loaded) { - EventBrowser *eventBrowser = m_Ctx->eventBrowser(); + EventBrowser *eventBrowser = m_Ctx.eventBrowser(); ui->toolWindowManager->addToolWindow(eventBrowser, ToolWindowManager::EmptySpace); - TextureViewer *textureViewer = m_Ctx->textureViewer(); + TextureViewer *textureViewer = m_Ctx.textureViewer(); ui->toolWindowManager->addToolWindow( textureViewer, ToolWindowManager::AreaReference(ToolWindowManager::RightOf, ui->toolWindowManager->areaOf(eventBrowser), 0.75f)); - PipelineStateViewer *pipe = m_Ctx->pipelineViewer(); + PipelineStateViewer *pipe = m_Ctx.pipelineViewer(); ui->toolWindowManager->addToolWindow( pipe, ToolWindowManager::AreaReference(ToolWindowManager::AddTo, ui->toolWindowManager->areaOf(textureViewer))); - BufferViewer *mesh = m_Ctx->meshPreview(); + BufferViewer *mesh = m_Ctx.meshPreview(); ui->toolWindowManager->addToolWindow( mesh, ToolWindowManager::AreaReference(ToolWindowManager::AddTo, ui->toolWindowManager->areaOf(textureViewer))); - CaptureDialog *capDialog = m_Ctx->captureDialog(); + CaptureDialog *capDialog = m_Ctx.captureDialog(); ui->toolWindowManager->addToolWindow( capDialog, ToolWindowManager::AreaReference(ToolWindowManager::AddTo, ui->toolWindowManager->areaOf(textureViewer))); - APIInspector *apiInspector = m_Ctx->apiInspector(); + APIInspector *apiInspector = m_Ctx.apiInspector(); ui->toolWindowManager->addToolWindow( apiInspector, @@ -222,7 +221,7 @@ MainWindow::MainWindow(CaptureContext *ctx) : QMainWindow(NULL), ui(new Ui::Main ui->toolWindowManager->areaOf(eventBrowser), 0.3f)); } - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); } MainWindow::~MainWindow() @@ -240,7 +239,7 @@ QString MainWindow::GetLayoutPath(int layout) if(layout > 0) filename = QString("Layout%1.config").arg(layout); - return m_Ctx->ConfigFile(filename); + return m_Ctx.ConfigFile(filename); } void MainWindow::on_action_Exit_triggered() @@ -254,7 +253,7 @@ void MainWindow::on_action_Open_Log_triggered() return; QString filename = - RDDialog::getOpenFileName(this, "Select Logfile to open", m_Ctx->Config.LastLogPath, + RDDialog::getOpenFileName(this, "Select Logfile to open", m_Ctx.Config.LastLogPath, "Log Files (*.rdc);;Image Files (*.dds *.hdr *.exr *.bmp *.jpg " "*.jpeg *.png *.tga *.gif *.psd;;All Files (*.*)"); @@ -294,9 +293,9 @@ LiveCapture *MainWindow::OnCaptureTrigger(const QString &exe, const QString &wor if(!PromptCloseLog()) return NULL; - QString logfile = m_Ctx->TempLogFilename(QFileInfo(exe).baseName()); + QString logfile = m_Ctx.TempLogFilename(QFileInfo(exe).baseName()); - uint32_t ret = m_Ctx->Renderer()->ExecuteAndInject(exe, workingDir, cmdLine, env, logfile, opts); + uint32_t ret = m_Ctx.Renderer().ExecuteAndInject(exe, workingDir, cmdLine, env, logfile, opts); if(ret == 0) { @@ -308,8 +307,7 @@ LiveCapture *MainWindow::OnCaptureTrigger(const QString &exe, const QString &wor } LiveCapture *live = new LiveCapture( - m_Ctx, m_Ctx->Renderer()->remote() ? m_Ctx->Renderer()->remote()->Hostname : "", ret, this, - this); + m_Ctx, m_Ctx.Renderer().remote() ? m_Ctx.Renderer().remote()->Hostname : "", ret, this, this); ShowLiveCapture(live); return live; } @@ -320,7 +318,7 @@ LiveCapture *MainWindow::OnInjectTrigger(uint32_t PID, const QListTempLogFilename(name); + QString logfile = m_Ctx.TempLogFilename(name); void *envList = RENDERDOC_MakeEnvironmentModificationList(env.size()); @@ -350,15 +348,14 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local { if(PromptCloseLog()) { - if(m_Ctx->LogLoading()) + if(m_Ctx.LogLoading()) return; rdctype::str driver; rdctype::str machineIdent; ReplaySupport support = eReplaySupport_Unsupported; - bool remoteReplay = - !local || (m_Ctx->Renderer()->remote() && m_Ctx->Renderer()->remote()->Connected); + bool remoteReplay = !local || (m_Ctx.Renderer().remote() && m_Ctx.Renderer().remote()->Connected); if(local) { @@ -367,8 +364,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local // if the return value suggests remote replay, and it's not already selected, AND the user // hasn't previously chosen to always replay locally without being prompted, ask if they'd // prefer to switch to a remote context for replaying. - if(support == eReplaySupport_SuggestRemote && !remoteReplay && - !m_Ctx->Config.AlwaysReplayLocally) + if(support == eReplaySupport_SuggestRemote && !remoteReplay && !m_Ctx.Config.AlwaysReplayLocally) { SuggestRemoteDialog dialog(ToQStr(driver), ToQStr(machineIdent), this); @@ -396,7 +392,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local [this]() { return contextChooser->isEnabled(); }); } - remoteReplay = (m_Ctx->Renderer()->remote() && m_Ctx->Renderer()->remote()->Connected); + remoteReplay = (m_Ctx.Renderer().remote() && m_Ctx.Renderer().remote()->Connected); if(!remoteReplay) { @@ -415,9 +411,9 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local // set that bit as sticky in the config if(dialog.alwaysReplayLocally()) { - m_Ctx->Config.AlwaysReplayLocally = true; + m_Ctx.Config.AlwaysReplayLocally = true; - m_Ctx->Config.Save(); + m_Ctx.Config.Save(); } } } @@ -426,7 +422,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local { support = eReplaySupport_Unsupported; - QStringList remoteDrivers = m_Ctx->Renderer()->GetRemoteSupport(); + QStringList remoteDrivers = m_Ctx.Renderer().GetRemoteSupport(); for(const QString &d : remoteDrivers) { @@ -447,7 +443,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local QString remoteMessage = tr("This log was captured with %1 and cannot be replayed on %2.\n\n") .arg(driver.c_str()) - .arg(m_Ctx->Renderer()->remote()->Hostname); + .arg(m_Ctx.Renderer().remote()->Hostname); remoteMessage += "Try selecting a different remote context in the status bar."; @@ -471,7 +467,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local if(remoteReplay && local) { - fileToLoad = m_Ctx->Renderer()->CopyCaptureToRemote(filename, this); + fileToLoad = m_Ctx.Renderer().CopyCaptureToRemote(filename, this); // deliberately leave local as true so that we keep referring to the locally saved log @@ -484,12 +480,12 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local } } - m_Ctx->LoadLogfile(fileToLoad, origFilename, temporary, local); + m_Ctx.LoadLogfile(fileToLoad, origFilename, temporary, local); } if(!remoteReplay) { - m_Ctx->Config.LastLogPath = QFileInfo(filename).absolutePath(); + m_Ctx.Config.LastLogPath = QFileInfo(filename).absolutePath(); } statusText->setText(tr("Loading ") + origFilename + "..."); @@ -498,7 +494,7 @@ void MainWindow::LoadLogfile(const QString &filename, bool temporary, bool local void MainWindow::OpenCaptureConfigFile(const QString &filename, bool exe) { - CaptureDialog *capDialog = m_Ctx->captureDialog(); + CaptureDialog *capDialog = m_Ctx.captureDialog(); if(exe) capDialog->setExecutableFilename(filename); @@ -513,10 +509,10 @@ QString MainWindow::GetSavePath() { QString dir; - if(m_Ctx->Config.DefaultCaptureSaveDirectory != "") + if(m_Ctx.Config.DefaultCaptureSaveDirectory != "") { if(m_LastSaveCapturePath == "") - dir = m_Ctx->Config.DefaultCaptureSaveDirectory; + dir = m_Ctx.Config.DefaultCaptureSaveDirectory; else dir = m_LastSaveCapturePath; } @@ -542,28 +538,28 @@ bool MainWindow::PromptSaveLog() if(saveFilename != "") { - if(m_Ctx->IsLogLocal() && !QFileInfo(m_Ctx->LogFilename()).exists()) + if(m_Ctx.IsLogLocal() && !QFileInfo(m_Ctx.LogFilename()).exists()) { RDDialog::critical(NULL, tr("File not found"), - tr("Logfile %1 couldn't be found, cannot save.").arg(m_Ctx->LogFilename())); + tr("Logfile %1 couldn't be found, cannot save.").arg(m_Ctx.LogFilename())); return false; } bool success = false; QString error; - if(m_Ctx->IsLogLocal()) + if(m_Ctx.IsLogLocal()) { // we copy the (possibly) temp log to the desired path, but the log item remains referring to // the original path. // This ensures that if the user deletes the saved path we can still open or re-save it. - success = QFile::copy(m_Ctx->LogFilename(), saveFilename); + success = QFile::copy(m_Ctx.LogFilename(), saveFilename); error = tr("Couldn't save to %1").arg(saveFilename); } else { - m_Ctx->Renderer()->CopyCaptureFromRemote(m_Ctx->LogFilename(), saveFilename, this); + m_Ctx.Renderer().CopyCaptureFromRemote(m_Ctx.LogFilename(), saveFilename, this); success = QFile::exists(saveFilename); error = tr("File couldn't be transferred from remote host"); @@ -575,7 +571,7 @@ bool MainWindow::PromptSaveLog() return false; } - PersistantConfig::AddRecentFile(m_Ctx->Config.RecentLogFiles, saveFilename, 10); + PersistantConfig::AddRecentFile(m_Ctx.Config.RecentLogFiles, saveFilename, 10); PopulateRecentFiles(); SetTitle(saveFilename); @@ -591,7 +587,7 @@ bool MainWindow::PromptSaveLog() bool MainWindow::PromptCloseLog() { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return true; QString deletepath = ""; @@ -599,8 +595,8 @@ bool MainWindow::PromptCloseLog() if(m_OwnTempLog) { - QString temppath = m_Ctx->LogFilename(); - loglocal = m_Ctx->IsLogLocal(); + QString temppath = m_Ctx.LogFilename(); + loglocal = m_Ctx.IsLogLocal(); QMessageBox::StandardButton res = QMessageBox::No; @@ -624,7 +620,7 @@ bool MainWindow::PromptCloseLog() } } - if(temppath != m_Ctx->LogFilename() || res == QMessageBox::No) + if(temppath != m_Ctx.LogFilename() || res == QMessageBox::No) deletepath = temppath; m_OwnTempLog = false; m_SavedTempLog = false; @@ -633,14 +629,14 @@ bool MainWindow::PromptCloseLog() CloseLogfile(); if(!deletepath.isEmpty()) - m_Ctx->Renderer()->DeleteCapture(deletepath, loglocal); + m_Ctx.Renderer().DeleteCapture(deletepath, loglocal); return true; } void MainWindow::CloseLogfile() { - m_Ctx->CloseLogfile(); + m_Ctx.CloseLogfile(); ui->action_Save_Log->setEnabled(false); } @@ -649,16 +645,16 @@ void MainWindow::SetTitle(const QString &filename) { QString prefix = ""; - if(m_Ctx && m_Ctx->LogLoaded()) + if(m_Ctx.LogLoaded()) { prefix = QFileInfo(filename).fileName(); - if(m_Ctx->APIProps().degraded) + if(m_Ctx.APIProps().degraded) prefix += " !DEGRADED PERFORMANCE!"; prefix += " - "; } - if(m_Ctx && m_Ctx->Renderer()->remote()) - prefix += tr("Remote: %1 - ").arg(m_Ctx->Renderer()->remote()->Hostname); + if(m_Ctx.Renderer().remote()) + prefix += tr("Remote: %1 - ").arg(m_Ctx.Renderer().remote()->Hostname); QString text = prefix + "RenderDoc "; @@ -677,7 +673,7 @@ void MainWindow::SetTitle(const QString &filename) void MainWindow::SetTitle() { - SetTitle(m_Ctx != NULL ? m_Ctx->LogFilename() : ""); + SetTitle(m_Ctx.LogFilename()); } void MainWindow::PopulateRecentFiles() @@ -687,9 +683,9 @@ void MainWindow::PopulateRecentFiles() ui->menu_Recent_Logs->setEnabled(false); int idx = 1; - for(int i = m_Ctx->Config.RecentLogFiles.size() - 1; i >= 0; i--) + for(int i = m_Ctx.Config.RecentLogFiles.size() - 1; i >= 0; i--) { - const QString &filename = m_Ctx->Config.RecentLogFiles[i]; + const QString &filename = m_Ctx.Config.RecentLogFiles[i]; ui->menu_Recent_Logs->addAction("&" + QString::number(idx) + " " + filename, [this, filename] { recentLog(filename); }); idx++; @@ -708,9 +704,9 @@ void MainWindow::PopulateRecentCaptures() ui->menu_Recent_Capture_Settings->setEnabled(false); int idx = 1; - for(int i = m_Ctx->Config.RecentCaptureSettings.size() - 1; i >= 0; i--) + for(int i = m_Ctx.Config.RecentCaptureSettings.size() - 1; i >= 0; i--) { - const QString &filename = m_Ctx->Config.RecentCaptureSettings[i]; + const QString &filename = m_Ctx.Config.RecentCaptureSettings[i]; ui->menu_Recent_Capture_Settings->addAction("&" + QString::number(idx) + " " + filename, [this, filename] { recentCapture(filename); }); idx++; @@ -724,7 +720,7 @@ void MainWindow::PopulateRecentCaptures() void MainWindow::ShowLiveCapture(LiveCapture *live) { - live->setWindowIcon(m_Ctx->winIcon()); + live->setWindowIcon(m_Ctx.winIcon()); m_LiveCaptures.push_back(live); ui->toolWindowManager->addToolWindow(live, mainToolArea()); } @@ -739,22 +735,20 @@ ToolWindowManager::AreaReference MainWindow::mainToolArea() // bit of a hack. Maybe the ToolWindowManager should track this? // Try and identify where to add new windows, by searching a // priority list of other windows to use their area - if(m_Ctx->hasTextureViewer() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->textureViewer())) + if(m_Ctx.hasTextureViewer() && ui->toolWindowManager->toolWindows().contains(m_Ctx.textureViewer())) return ToolWindowManager::AreaReference(ToolWindowManager::AddTo, - ui->toolWindowManager->areaOf(m_Ctx->textureViewer())); - else if(m_Ctx->hasPipelineViewer() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->pipelineViewer())) + ui->toolWindowManager->areaOf(m_Ctx.textureViewer())); + else if(m_Ctx.hasPipelineViewer() && + ui->toolWindowManager->toolWindows().contains(m_Ctx.pipelineViewer())) return ToolWindowManager::AreaReference(ToolWindowManager::AddTo, - ui->toolWindowManager->areaOf(m_Ctx->pipelineViewer())); - else if(m_Ctx->hasMeshPreview() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->meshPreview())) + ui->toolWindowManager->areaOf(m_Ctx.pipelineViewer())); + else if(m_Ctx.hasMeshPreview() && ui->toolWindowManager->toolWindows().contains(m_Ctx.meshPreview())) return ToolWindowManager::AreaReference(ToolWindowManager::AddTo, - ui->toolWindowManager->areaOf(m_Ctx->meshPreview())); - else if(m_Ctx->hasCaptureDialog() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->captureDialog())) + ui->toolWindowManager->areaOf(m_Ctx.meshPreview())); + else if(m_Ctx.hasCaptureDialog() && + ui->toolWindowManager->toolWindows().contains(m_Ctx.captureDialog())) return ToolWindowManager::AreaReference(ToolWindowManager::AddTo, - ui->toolWindowManager->areaOf(m_Ctx->captureDialog())); + ui->toolWindowManager->areaOf(m_Ctx.captureDialog())); // if all else fails just add to the last place we placed something. return ToolWindowManager::AreaReference(ToolWindowManager::LastUsedArea); @@ -763,18 +757,17 @@ ToolWindowManager::AreaReference MainWindow::mainToolArea() ToolWindowManager::AreaReference MainWindow::leftToolArea() { // see mainToolArea() - if(m_Ctx->hasTextureViewer() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->textureViewer())) + if(m_Ctx.hasTextureViewer() && ui->toolWindowManager->toolWindows().contains(m_Ctx.textureViewer())) return ToolWindowManager::AreaReference(ToolWindowManager::LeftOf, - ui->toolWindowManager->areaOf(m_Ctx->textureViewer())); - else if(m_Ctx->hasPipelineViewer() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->pipelineViewer())) + ui->toolWindowManager->areaOf(m_Ctx.textureViewer())); + else if(m_Ctx.hasPipelineViewer() && + ui->toolWindowManager->toolWindows().contains(m_Ctx.pipelineViewer())) return ToolWindowManager::AreaReference(ToolWindowManager::LeftOf, - ui->toolWindowManager->areaOf(m_Ctx->pipelineViewer())); - else if(m_Ctx->hasCaptureDialog() && - ui->toolWindowManager->toolWindows().contains(m_Ctx->captureDialog())) + ui->toolWindowManager->areaOf(m_Ctx.pipelineViewer())); + else if(m_Ctx.hasCaptureDialog() && + ui->toolWindowManager->toolWindows().contains(m_Ctx.captureDialog())) return ToolWindowManager::AreaReference(ToolWindowManager::LeftOf, - ui->toolWindowManager->areaOf(m_Ctx->captureDialog())); + ui->toolWindowManager->areaOf(m_Ctx.captureDialog())); return ToolWindowManager::AreaReference(ToolWindowManager::LastUsedArea); } @@ -793,7 +786,7 @@ void MainWindow::recentLog(const QString &filename) if(res == QMessageBox::Yes) { - m_Ctx->Config.RecentLogFiles.removeOne(filename); + m_Ctx.Config.RecentLogFiles.removeOne(filename); PopulateRecentFiles(); } @@ -814,7 +807,7 @@ void MainWindow::recentCapture(const QString &filename) if(res == QMessageBox::Yes) { - m_Ctx->Config.RecentLogFiles.removeOne(filename); + m_Ctx.Config.RecentLogFiles.removeOne(filename); PopulateRecentFiles(); } @@ -836,7 +829,7 @@ void MainWindow::setProgress(float val) void MainWindow::setLogHasErrors(bool errors) { - QString filename = QFileInfo(m_Ctx->LogFilename()).fileName(); + QString filename = QFileInfo(m_Ctx.LogFilename()).fileName(); if(errors) { QPixmap icon(QString::fromUtf8(":/delete.png")); @@ -848,9 +841,9 @@ void MainWindow::setLogHasErrors(bool errors) text = tr("%1 loaded. Log has %2 errors, warnings or performance notes. " "See the 'Log Errors and Warnings' window.") .arg(filename) - .arg(m_Ctx->DebugMessages.size()); - if(m_Ctx->UnreadMessageCount > 0) - text += tr(" %1 Unread.").arg(m_Ctx->UnreadMessageCount); + .arg(m_Ctx.DebugMessages.size()); + if(m_Ctx.UnreadMessageCount > 0) + text += tr(" %1 Unread.").arg(m_Ctx.UnreadMessageCount); statusText->setText(text); } else @@ -862,9 +855,9 @@ void MainWindow::setLogHasErrors(bool errors) void MainWindow::remoteProbe() { - if(!m_Ctx->LogLoaded() && !m_Ctx->LogLoading()) + if(!m_Ctx.LogLoaded() && !m_Ctx.LogLoading()) { - for(RemoteHost *host : m_Ctx->Config.RemoteHosts) + for(RemoteHost *host : m_Ctx.Config.RemoteHosts) { // don't mess with a host we're connected to - this is handled anyway if(host->Connected) @@ -877,21 +870,21 @@ void MainWindow::remoteProbe() void MainWindow::messageCheck() { - if(m_Ctx->LogLoaded()) + if(m_Ctx.LogLoaded()) { - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { rdctype::array msgs; r->GetDebugMessages(&msgs); bool disconnected = false; - if(m_Ctx->Renderer()->remote()) + if(m_Ctx.Renderer().remote()) { - bool prev = m_Ctx->Renderer()->remote()->ServerRunning; + bool prev = m_Ctx.Renderer().remote()->ServerRunning; - m_Ctx->Renderer()->PingRemote(); + m_Ctx.Renderer().PingRemote(); - if(prev != m_Ctx->Renderer()->remote()->ServerRunning) + if(prev != m_Ctx.Renderer().remote()->ServerRunning) disconnected = true; } @@ -906,38 +899,38 @@ void MainWindow::messageCheck() "RenderDoc to reconnect and load the capture again")); } - if(m_Ctx->Renderer()->remote() && !m_Ctx->Renderer()->remote()->ServerRunning) + if(m_Ctx.Renderer().remote() && !m_Ctx.Renderer().remote()->ServerRunning) contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/cross.png")))); if(!msgs.empty()) { - m_Ctx->AddMessages(msgs); - m_Ctx->debugMessageView()->RefreshMessageList(); + m_Ctx.AddMessages(msgs); + m_Ctx.debugMessageView()->RefreshMessageList(); } - if(m_Ctx->UnreadMessageCount > 0) + if(m_Ctx.UnreadMessageCount > 0) m_messageAlternate = !m_messageAlternate; else m_messageAlternate = false; - setLogHasErrors(!m_Ctx->DebugMessages.empty()); + setLogHasErrors(!m_Ctx.DebugMessages.empty()); }); }); } - else if(!m_Ctx->LogLoaded() && !m_Ctx->LogLoading()) + else if(!m_Ctx.LogLoaded() && !m_Ctx.LogLoading()) { - if(m_Ctx->Renderer()->remote()) - m_Ctx->Renderer()->PingRemote(); + if(m_Ctx.Renderer().remote()) + m_Ctx.Renderer().PingRemote(); GUIInvoke::call([this]() { - if(m_Ctx->Renderer()->remote() && !m_Ctx->Renderer()->remote()->ServerRunning) + if(m_Ctx.Renderer().remote() && !m_Ctx.Renderer().remote()->ServerRunning) { contextChooser->setIcon(QIcon(QPixmap(QString::fromUtf8(":/cross.png")))); contextChooser->setText(tr("Replay Context: %1").arg("Local")); statusText->setText( tr("Remote server disconnected. To attempt to reconnect please select it again.")); - m_Ctx->Renderer()->DisconnectFromRemoteServer(); + m_Ctx.Renderer().DisconnectFromRemoteServer(); } }); } @@ -950,9 +943,9 @@ void MainWindow::FillRemotesMenu(QMenu *menu, bool includeLocalhost) QIcon tick(QPixmap(QString::fromUtf8(":/tick.png"))); QIcon cross(QPixmap(QString::fromUtf8(":/cross.png"))); - for(int i = 0; i < m_Ctx->Config.RemoteHosts.count(); i++) + for(int i = 0; i < m_Ctx.Config.RemoteHosts.count(); i++) { - RemoteHost *host = m_Ctx->Config.RemoteHosts[i]; + RemoteHost *host = m_Ctx.Config.RemoteHosts[i]; // add localhost at the end if(host->Hostname == "localhost") @@ -1010,9 +1003,9 @@ void MainWindow::switchContext() RemoteHost *host = NULL; - if(hostIdx >= 0 && hostIdx < m_Ctx->Config.RemoteHosts.count()) + if(hostIdx >= 0 && hostIdx < m_Ctx.Config.RemoteHosts.count()) { - host = m_Ctx->Config.RemoteHosts[hostIdx]; + host = m_Ctx.Config.RemoteHosts[hostIdx]; } for(LiveCapture *live : m_LiveCaptures) @@ -1042,7 +1035,7 @@ void MainWindow::switchContext() live->close(); } - m_Ctx->Renderer()->DisconnectFromRemoteServer(); + m_Ctx.Renderer().DisconnectFromRemoteServer(); if(!host) { @@ -1089,7 +1082,7 @@ void MainWindow::switchContext() if(host->ServerRunning && !host->Busy) { - status = m_Ctx->Renderer()->ConnectToRemoteServer(host); + status = m_Ctx.Renderer().ConnectToRemoteServer(host); } GUIInvoke::call([this, host, status]() { @@ -1148,9 +1141,9 @@ void MainWindow::OnLogfileLoaded() statusProgress->setVisible(false); - setLogHasErrors(!m_Ctx->DebugMessages.empty()); + setLogHasErrors(!m_Ctx.DebugMessages.empty()); - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { bool hasResolver = r->HasCallstacks(); GUIInvoke::call([this, hasResolver]() { @@ -1166,7 +1159,7 @@ void MainWindow::OnLogfileLoaded() PopulateRecentFiles(); - ToolWindowManager::raiseToolWindow(m_Ctx->eventBrowser()); + ToolWindowManager::raiseToolWindow(m_Ctx.eventBrowser()); } void MainWindow::OnLogfileClosed() @@ -1183,12 +1176,12 @@ void MainWindow::OnLogfileClosed() SetTitle(); // if the remote sever disconnected during log replay, resort back to a 'disconnected' state - if(m_Ctx->Renderer()->remote() && !m_Ctx->Renderer()->remote()->ServerRunning) + if(m_Ctx.Renderer().remote() && !m_Ctx.Renderer().remote()->ServerRunning) { statusText->setText( tr("Remote server disconnected. To attempt to reconnect please select it again.")); contextChooser->setText(tr("Replay Context: %1").arg("Local")); - m_Ctx->Renderer()->DisconnectFromRemoteServer(); + m_Ctx.Renderer().DisconnectFromRemoteServer(); } } @@ -1214,7 +1207,7 @@ void MainWindow::on_action_About_triggered() void MainWindow::on_action_Mesh_Output_triggered() { - BufferViewer *meshPreview = m_Ctx->meshPreview(); + BufferViewer *meshPreview = m_Ctx.meshPreview(); if(ui->toolWindowManager->toolWindows().contains(meshPreview)) ToolWindowManager::raiseToolWindow(meshPreview); @@ -1224,7 +1217,7 @@ void MainWindow::on_action_Mesh_Output_triggered() void MainWindow::on_action_API_Inspector_triggered() { - APIInspector *apiInspector = m_Ctx->apiInspector(); + APIInspector *apiInspector = m_Ctx.apiInspector(); if(ui->toolWindowManager->toolWindows().contains(apiInspector)) { @@ -1232,10 +1225,10 @@ void MainWindow::on_action_API_Inspector_triggered() } else { - if(m_Ctx->hasEventBrowser()) + if(m_Ctx.hasEventBrowser()) { ToolWindowManager::AreaReference ref(ToolWindowManager::BottomOf, - ui->toolWindowManager->areaOf(m_Ctx->eventBrowser())); + ui->toolWindowManager->areaOf(m_Ctx.eventBrowser())); ui->toolWindowManager->addToolWindow(apiInspector, ref); } else @@ -1247,7 +1240,7 @@ void MainWindow::on_action_API_Inspector_triggered() void MainWindow::on_action_Event_Browser_triggered() { - EventBrowser *eventBrowser = m_Ctx->eventBrowser(); + EventBrowser *eventBrowser = m_Ctx.eventBrowser(); if(ui->toolWindowManager->toolWindows().contains(eventBrowser)) ToolWindowManager::raiseToolWindow(eventBrowser); @@ -1257,7 +1250,7 @@ void MainWindow::on_action_Event_Browser_triggered() void MainWindow::on_action_Texture_Viewer_triggered() { - TextureViewer *textureViewer = m_Ctx->textureViewer(); + TextureViewer *textureViewer = m_Ctx.textureViewer(); if(ui->toolWindowManager->toolWindows().contains(textureViewer)) ToolWindowManager::raiseToolWindow(textureViewer); @@ -1267,7 +1260,7 @@ void MainWindow::on_action_Texture_Viewer_triggered() void MainWindow::on_action_Pipeline_State_triggered() { - PipelineStateViewer *pipelineViewer = m_Ctx->pipelineViewer(); + PipelineStateViewer *pipelineViewer = m_Ctx.pipelineViewer(); if(ui->toolWindowManager->toolWindows().contains(pipelineViewer)) ToolWindowManager::raiseToolWindow(pipelineViewer); @@ -1277,7 +1270,7 @@ void MainWindow::on_action_Pipeline_State_triggered() void MainWindow::on_action_Capture_Log_triggered() { - CaptureDialog *capDialog = m_Ctx->captureDialog(); + CaptureDialog *capDialog = m_Ctx.captureDialog(); capDialog->setInjectMode(false); @@ -1289,7 +1282,7 @@ void MainWindow::on_action_Capture_Log_triggered() void MainWindow::on_action_Inject_into_Process_triggered() { - CaptureDialog *capDialog = m_Ctx->captureDialog(); + CaptureDialog *capDialog = m_Ctx.captureDialog(); capDialog->setInjectMode(true); @@ -1301,7 +1294,7 @@ void MainWindow::on_action_Inject_into_Process_triggered() void MainWindow::on_action_Errors_and_Warnings_triggered() { - DebugMessageView *debugMessages = m_Ctx->debugMessageView(); + DebugMessageView *debugMessages = m_Ctx.debugMessageView(); if(ui->toolWindowManager->toolWindows().contains(debugMessages)) ToolWindowManager::raiseToolWindow(debugMessages); @@ -1311,7 +1304,7 @@ void MainWindow::on_action_Errors_and_Warnings_triggered() void MainWindow::on_action_Statistics_Viewer_triggered() { - StatisticsViewer *stats = m_Ctx->statisticsViewer(); + StatisticsViewer *stats = m_Ctx.statisticsViewer(); if(ui->toolWindowManager->toolWindows().contains(stats)) ToolWindowManager::raiseToolWindow(stats); @@ -1321,17 +1314,17 @@ void MainWindow::on_action_Statistics_Viewer_triggered() void MainWindow::on_action_Resolve_Symbols_triggered() { - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { r->InitResolver(); }); + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { r->InitResolver(); }); ShowProgressDialog(this, tr("Please Wait - Resolving Symbols"), [this]() { bool running = true; - m_Ctx->Renderer()->BlockInvoke( + m_Ctx.Renderer().BlockInvoke( [&running](IReplayRenderer *r) { running = r->HasCallstacks() && !r->InitResolver(); }); return !running; }); - if(m_Ctx->hasAPIInspector()) - m_Ctx->apiInspector()->on_apiEvents_itemSelectionChanged(); + if(m_Ctx.hasAPIInspector()) + m_Ctx.apiInspector()->on_apiEvents_itemSelectionChanged(); } void MainWindow::on_action_Attach_to_Running_Instance_triggered() diff --git a/qrenderdoc/Windows/MainWindow.h b/qrenderdoc/Windows/MainWindow.h index 00a7839e7..a417ce5e6 100644 --- a/qrenderdoc/Windows/MainWindow.h +++ b/qrenderdoc/Windows/MainWindow.h @@ -48,7 +48,7 @@ private: Q_OBJECT public: - explicit MainWindow(CaptureContext *ctx); + explicit MainWindow(CaptureContext &ctx); ~MainWindow(); void OnLogfileLoaded() override; @@ -124,7 +124,7 @@ private: ToolWindowManager::AreaReference leftToolArea(); Ui::MainWindow *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; QList m_LiveCaptures; diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp index ebe6d8f3d..9d7069b00 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp @@ -73,7 +73,7 @@ struct ViewTag Q_DECLARE_METATYPE(ViewTag); -D3D11PipelineStateViewer::D3D11PipelineStateViewer(CaptureContext *ctx, QWidget *parent) +D3D11PipelineStateViewer::D3D11PipelineStateViewer(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::D3D11PipelineStateViewer), m_Ctx(ctx) { ui->setupUi(this); @@ -326,7 +326,7 @@ D3D11PipelineStateViewer::~D3D11PipelineStateViewer() void D3D11PipelineStateViewer::OnLogfileLoaded() { - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void D3D11PipelineStateViewer::OnLogfileClosed() @@ -418,9 +418,9 @@ void D3D11PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT if(view.type == ViewTag::OMDepth) { - if(m_Ctx->CurD3D11PipelineState.m_OM.DepthReadOnly) + if(m_Ctx.CurD3D11PipelineState.m_OM.DepthReadOnly) text += tr("Depth component is read-only\n"); - if(m_Ctx->CurD3D11PipelineState.m_OM.StencilReadOnly) + if(m_Ctx.CurD3D11PipelineState.m_OM.StencilReadOnly) text += tr("Stencil component is read-only\n"); } @@ -511,8 +511,8 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR bool viewDetails = false; if(view.type == ViewTag::OMDepth) - viewDetails = m_Ctx->CurD3D11PipelineState.m_OM.DepthReadOnly || - m_Ctx->CurD3D11PipelineState.m_OM.StencilReadOnly; + viewDetails = m_Ctx.CurD3D11PipelineState.m_OM.DepthReadOnly || + m_Ctx.CurD3D11PipelineState.m_OM.StencilReadOnly; bool filledSlot = (r.Resource != ResourceId()); bool usedSlot = (shaderInput); @@ -542,7 +542,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR w = h = d = a = 0; } - FetchTexture *tex = m_Ctx->GetTexture(r.Resource); + FetchTexture *tex = m_Ctx.GetTexture(r.Resource); if(tex) { @@ -566,7 +566,7 @@ void D3D11PipelineStateViewer::addResourceRow(const ViewTag &view, const ShaderR viewDetails = true; } - FetchBuffer *buf = m_Ctx->GetBuffer(r.Resource); + FetchBuffer *buf = m_Ctx.GetBuffer(r.Resource); if(buf) { @@ -661,29 +661,29 @@ bool D3D11PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const D3D11PipelineState::ShaderStage *D3D11PipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return NULL; while(widget) { if(widget == ui->stagesTabs->widget(0)) - return &m_Ctx->CurD3D11PipelineState.m_VS; + return &m_Ctx.CurD3D11PipelineState.m_VS; if(widget == ui->stagesTabs->widget(1)) - return &m_Ctx->CurD3D11PipelineState.m_VS; + return &m_Ctx.CurD3D11PipelineState.m_VS; if(widget == ui->stagesTabs->widget(2)) - return &m_Ctx->CurD3D11PipelineState.m_HS; + return &m_Ctx.CurD3D11PipelineState.m_HS; if(widget == ui->stagesTabs->widget(3)) - return &m_Ctx->CurD3D11PipelineState.m_DS; + return &m_Ctx.CurD3D11PipelineState.m_DS; if(widget == ui->stagesTabs->widget(4)) - return &m_Ctx->CurD3D11PipelineState.m_GS; + return &m_Ctx.CurD3D11PipelineState.m_GS; if(widget == ui->stagesTabs->widget(5)) - return &m_Ctx->CurD3D11PipelineState.m_PS; + return &m_Ctx.CurD3D11PipelineState.m_PS; if(widget == ui->stagesTabs->widget(6)) - return &m_Ctx->CurD3D11PipelineState.m_PS; + return &m_Ctx.CurD3D11PipelineState.m_PS; if(widget == ui->stagesTabs->widget(7)) - return &m_Ctx->CurD3D11PipelineState.m_PS; + return &m_Ctx.CurD3D11PipelineState.m_PS; if(widget == ui->stagesTabs->widget(8)) - return &m_Ctx->CurD3D11PipelineState.m_CS; + return &m_Ctx.CurD3D11PipelineState.m_CS; widget = widget->parentWidget(); } @@ -954,7 +954,7 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::ShaderSt length = 0; } - FetchBuffer *buf = m_Ctx->GetBuffer(b.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(b.Buffer); if(buf) { @@ -1017,14 +1017,14 @@ void D3D11PipelineStateViewer::setShaderState(const D3D11PipelineState::ShaderSt void D3D11PipelineStateViewer::setState() { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) { clearState(); return; } - const D3D11PipelineState &state = m_Ctx->CurD3D11PipelineState; - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const D3D11PipelineState &state = m_Ctx.CurD3D11PipelineState; + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); QPixmap tick(QString::fromUtf8(":/tick.png")); QPixmap cross(QString::fromUtf8(":/cross.png")); @@ -1261,7 +1261,7 @@ void D3D11PipelineStateViewer::setState() if(!ibufferUsed) length = 0; - FetchBuffer *buf = m_Ctx->GetBuffer(state.m_IA.ibuffer.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(state.m_IA.ibuffer.Buffer); if(buf) { @@ -1326,7 +1326,7 @@ void D3D11PipelineStateViewer::setState() length = 0; } - FetchBuffer *buf = m_Ctx->GetBuffer(v.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(v.Buffer); if(buf) { name = buf->name; @@ -1418,7 +1418,7 @@ void D3D11PipelineStateViewer::setState() name = "Empty"; } - FetchBuffer *buf = m_Ctx->GetBuffer(s.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(s.Buffer); if(buf) { @@ -1727,25 +1727,25 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int if(tag.canConvert()) { ResourceId id = tag.value(); - tex = m_Ctx->GetTexture(id); - buf = m_Ctx->GetBuffer(id); + tex = m_Ctx.GetTexture(id); + buf = m_Ctx.GetBuffer(id); } else if(tag.canConvert()) { ViewTag view = tag.value(); - tex = m_Ctx->GetTexture(view.res.Resource); - buf = m_Ctx->GetBuffer(view.res.Resource); + tex = m_Ctx.GetTexture(view.res.Resource); + buf = m_Ctx.GetBuffer(view.res.Resource); } if(tex) { if(tex->resType == eResType_Buffer) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewTexture(0, 0, tex->ID); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1754,9 +1754,9 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int } else { - if(!m_Ctx->hasTextureViewer()) - m_Ctx->showTextureViewer(); - TextureViewer *viewer = m_Ctx->textureViewer(); + if(!m_Ctx.hasTextureViewer()) + m_Ctx.showTextureViewer(); + TextureViewer *viewer = m_Ctx.textureViewer(); viewer->ViewTexture(tex->ID, true); } @@ -1780,14 +1780,14 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int { // last thing, see if it's a streamout buffer - if(stage == &m_Ctx->CurD3D11PipelineState.m_GS) + if(stage == &m_Ctx.CurD3D11PipelineState.m_GS) { - for(int i = 0; i < m_Ctx->CurD3D11PipelineState.m_SO.Outputs.count; i++) + for(int i = 0; i < m_Ctx.CurD3D11PipelineState.m_SO.Outputs.count; i++) { - if(buf->ID == m_Ctx->CurD3D11PipelineState.m_SO.Outputs[i].Buffer) + if(buf->ID == m_Ctx.CurD3D11PipelineState.m_SO.Outputs[i].Buffer) { - size -= m_Ctx->CurD3D11PipelineState.m_SO.Outputs[i].Offset; - offs += m_Ctx->CurD3D11PipelineState.m_SO.Outputs[i].Offset; + size -= m_Ctx.CurD3D11PipelineState.m_SO.Outputs[i].Offset; + offs += m_Ctx.CurD3D11PipelineState.m_SO.Outputs[i].Offset; break; } } @@ -1912,11 +1912,11 @@ void D3D11PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int } { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(offs, size, view.res.Resource, format); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1948,9 +1948,9 @@ void D3D11PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int } ConstantBufferPreviewer *prev = - new ConstantBufferPreviewer(m_Ctx, stage->stage, cb, 0, m_Ctx->mainWindow()); + new ConstantBufferPreviewer(m_Ctx, stage->stage, cb, 0, m_Ctx.mainWindow()); - m_Ctx->setupDockWindow(prev); + m_Ctx.setupDockWindow(prev); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1973,11 +1973,11 @@ void D3D11PipelineStateViewer::on_iaBuffers_itemActivated(QTreeWidgetItem *item, if(buf.id != ResourceId()) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(buf.offset, UINT64_MAX, buf.id); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1991,7 +1991,7 @@ void D3D11PipelineStateViewer::highlightIABind(int slot) { int idx = ((slot + 1) * 21) % 32; // space neighbouring colours reasonably distinctly - const D3D11PipelineState::InputAssembler &IA = m_Ctx->CurD3D11PipelineState.m_IA; + const D3D11PipelineState::InputAssembler &IA = m_Ctx.CurD3D11PipelineState.m_IA; QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); @@ -2041,14 +2041,14 @@ void D3D11PipelineStateViewer::highlightIABind(int slot) void D3D11PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QModelIndex idx = ui->iaLayouts->indexAt(e->pos()); vertex_leave(NULL); - const D3D11PipelineState::InputAssembler &IA = m_Ctx->CurD3D11PipelineState.m_IA; + const D3D11PipelineState::InputAssembler &IA = m_Ctx.CurD3D11PipelineState.m_IA; if(idx.isValid()) { @@ -2063,7 +2063,7 @@ void D3D11PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) void D3D11PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); @@ -2151,7 +2151,7 @@ void D3D11PipelineStateViewer::shaderView_clicked() QWidget *sender = qobject_cast(QObject::sender()); if(sender == ui->iaBytecode || sender == ui->iaBytecodeViewButton) { - shaderDetails = m_Ctx->CurD3D11PipelineState.m_IA.Bytecode; + shaderDetails = m_Ctx.CurD3D11PipelineState.m_IA.Bytecode; } else { @@ -2166,7 +2166,7 @@ void D3D11PipelineStateViewer::shaderView_clicked() ShaderViewer *shad = new ShaderViewer(m_Ctx, shaderDetails, shaderStage, NULL, ""); - m_Ctx->setupDockWindow(shad); + m_Ctx.setupDockWindow(shad); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2225,7 +2225,7 @@ void D3D11PipelineStateViewer::on_exportHTML_clicked() void D3D11PipelineStateViewer::on_meshView_clicked() { - if(!m_Ctx->hasMeshPreview()) - m_Ctx->showMeshPreview(); - ToolWindowManager::raiseToolWindow(m_Ctx->meshPreview()); + if(!m_Ctx.hasMeshPreview()) + m_Ctx.showMeshPreview(); + ToolWindowManager::raiseToolWindow(m_Ctx.meshPreview()); } diff --git a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h index 04ca795cc..ebf7bf966 100644 --- a/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.h @@ -41,7 +41,7 @@ class D3D11PipelineStateViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit D3D11PipelineStateViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit D3D11PipelineStateViewer(CaptureContext &ctx, QWidget *parent = 0); ~D3D11PipelineStateViewer(); void OnLogfileLoaded(); @@ -70,7 +70,7 @@ private slots: private: Ui::D3D11PipelineStateViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; enum D3DBufferViewFlags { diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp index e2cfa17df..75cf0a222 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.cpp @@ -97,7 +97,7 @@ struct ViewTag Q_DECLARE_METATYPE(ViewTag); -D3D12PipelineStateViewer::D3D12PipelineStateViewer(CaptureContext *ctx, QWidget *parent) +D3D12PipelineStateViewer::D3D12PipelineStateViewer(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::D3D12PipelineStateViewer), m_Ctx(ctx) { ui->setupUi(this); @@ -362,7 +362,7 @@ D3D12PipelineStateViewer::~D3D12PipelineStateViewer() void D3D12PipelineStateViewer::OnLogfileLoaded() { - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void D3D12PipelineStateViewer::OnLogfileClosed() @@ -443,7 +443,7 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT bool viewdetails = false; - for(const D3D12PipelineState::ResourceData &im : m_Ctx->CurD3D12PipelineState.Resources) + for(const D3D12PipelineState::ResourceData &im : m_Ctx.CurD3D12PipelineState.Resources) { if(im.id == tex->ID) { @@ -463,9 +463,9 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT if(view.space == ViewTag::OMDepth) { - if(m_Ctx->CurD3D12PipelineState.m_OM.DepthReadOnly) + if(m_Ctx.CurD3D12PipelineState.m_OM.DepthReadOnly) text += tr("Depth component is read-only\n"); - if(m_Ctx->CurD3D12PipelineState.m_OM.StencilReadOnly) + if(m_Ctx.CurD3D12PipelineState.m_OM.StencilReadOnly) text += tr("Stencil component is read-only\n"); } @@ -522,7 +522,7 @@ void D3D12PipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const ViewT const D3D12PipelineState::ResourceView &res = view.res; - for(const D3D12PipelineState::ResourceData &im : m_Ctx->CurD3D12PipelineState.Resources) + for(const D3D12PipelineState::ResourceData &im : m_Ctx.CurD3D12PipelineState.Resources) { if(im.id == buf->ID) { @@ -606,8 +606,8 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, bool viewDetails = false; if(view.space == ViewTag::OMDepth) - viewDetails = m_Ctx->CurD3D12PipelineState.m_OM.DepthReadOnly || - m_Ctx->CurD3D12PipelineState.m_OM.StencilReadOnly; + viewDetails = m_Ctx.CurD3D12PipelineState.m_OM.DepthReadOnly || + m_Ctx.CurD3D12PipelineState.m_OM.StencilReadOnly; QString rootel = r.Immediate ? QString("#%1 Direct").arg(r.RootElement) : QString("#%1 Table[%2]").arg(r.RootElement).arg(r.TableIndex); @@ -643,7 +643,7 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, w = h = d = a = 0; } - FetchTexture *tex = m_Ctx->GetTexture(r.Resource); + FetchTexture *tex = m_Ctx.GetTexture(r.Resource); if(tex) { @@ -667,7 +667,7 @@ void D3D12PipelineStateViewer::addResourceRow(const ViewTag &view, viewDetails = true; } - FetchBuffer *buf = m_Ctx->GetBuffer(r.Resource); + FetchBuffer *buf = m_Ctx.GetBuffer(r.Resource); if(buf) { @@ -757,29 +757,29 @@ bool D3D12PipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const D3D12PipelineState::ShaderStage *D3D12PipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return NULL; while(widget) { if(widget == ui->stagesTabs->widget(0)) - return &m_Ctx->CurD3D12PipelineState.m_VS; + return &m_Ctx.CurD3D12PipelineState.m_VS; if(widget == ui->stagesTabs->widget(1)) - return &m_Ctx->CurD3D12PipelineState.m_VS; + return &m_Ctx.CurD3D12PipelineState.m_VS; if(widget == ui->stagesTabs->widget(2)) - return &m_Ctx->CurD3D12PipelineState.m_HS; + return &m_Ctx.CurD3D12PipelineState.m_HS; if(widget == ui->stagesTabs->widget(3)) - return &m_Ctx->CurD3D12PipelineState.m_DS; + return &m_Ctx.CurD3D12PipelineState.m_DS; if(widget == ui->stagesTabs->widget(4)) - return &m_Ctx->CurD3D12PipelineState.m_GS; + return &m_Ctx.CurD3D12PipelineState.m_GS; if(widget == ui->stagesTabs->widget(5)) - return &m_Ctx->CurD3D12PipelineState.m_PS; + return &m_Ctx.CurD3D12PipelineState.m_PS; if(widget == ui->stagesTabs->widget(6)) - return &m_Ctx->CurD3D12PipelineState.m_PS; + return &m_Ctx.CurD3D12PipelineState.m_PS; if(widget == ui->stagesTabs->widget(7)) - return &m_Ctx->CurD3D12PipelineState.m_PS; + return &m_Ctx.CurD3D12PipelineState.m_PS; if(widget == ui->stagesTabs->widget(8)) - return &m_Ctx->CurD3D12PipelineState.m_CS; + return &m_Ctx.CurD3D12PipelineState.m_CS; widget = widget->parentWidget(); } @@ -862,7 +862,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::ShaderSt RDTreeWidget *uavs) { ShaderReflection *shaderDetails = stage.ShaderDetails; - const D3D12PipelineState &state = m_Ctx->CurD3D12PipelineState; + const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState; QIcon action(QPixmap(QString::fromUtf8(":/action.png"))); QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png"))); @@ -870,7 +870,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::ShaderSt if(stage.Shader == ResourceId()) shader->setText(tr("Unbound Shader")); else if(state.customName) - shader->setText(ToQStr(state.PipelineName) + " - " + m_Ctx->CurPipelineState.Abbrev(stage.stage)); + shader->setText(ToQStr(state.PipelineName) + " - " + m_Ctx.CurPipelineState.Abbrev(stage.stage)); else shader->setText(ToQStr(state.PipelineName) + " - " + ToQStr(stage.stage, eGraphicsAPI_D3D12) + " Shader"); @@ -1111,7 +1111,7 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::ShaderSt if(!filledSlot) name = "Empty"; - FetchBuffer *buf = m_Ctx->GetBuffer(b.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(b.Buffer); if(buf) name = buf->name; @@ -1153,14 +1153,14 @@ void D3D12PipelineStateViewer::setShaderState(const D3D12PipelineState::ShaderSt void D3D12PipelineStateViewer::setState() { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) { clearState(); return; } - const D3D12PipelineState &state = m_Ctx->CurD3D12PipelineState; - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const D3D12PipelineState &state = m_Ctx.CurD3D12PipelineState; + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); QPixmap tick(QString::fromUtf8(":/tick.png")); QPixmap cross(QString::fromUtf8(":/cross.png")); @@ -1302,7 +1302,7 @@ void D3D12PipelineStateViewer::setState() if(!ibufferUsed) length = 0; - FetchBuffer *buf = m_Ctx->GetBuffer(state.m_IA.ibuffer.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(state.m_IA.ibuffer.Buffer); if(buf) { @@ -1368,7 +1368,7 @@ void D3D12PipelineStateViewer::setState() length = 0; } - FetchBuffer *buf = m_Ctx->GetBuffer(v.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(v.Buffer); if(buf) { name = buf->name; @@ -1435,7 +1435,7 @@ void D3D12PipelineStateViewer::setState() name = "Empty"; } - FetchBuffer *buf = m_Ctx->GetBuffer(s.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(s.Buffer); if(buf) { @@ -1710,25 +1710,25 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int if(tag.canConvert()) { ResourceId id = tag.value(); - tex = m_Ctx->GetTexture(id); - buf = m_Ctx->GetBuffer(id); + tex = m_Ctx.GetTexture(id); + buf = m_Ctx.GetBuffer(id); } else if(tag.canConvert()) { ViewTag view = tag.value(); - tex = m_Ctx->GetTexture(view.res.Resource); - buf = m_Ctx->GetBuffer(view.res.Resource); + tex = m_Ctx.GetTexture(view.res.Resource); + buf = m_Ctx.GetBuffer(view.res.Resource); } if(tex) { if(tex->resType == eResType_Buffer) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewTexture(0, 0, tex->ID); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1737,9 +1737,9 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int } else { - if(!m_Ctx->hasTextureViewer()) - m_Ctx->showTextureViewer(); - TextureViewer *viewer = m_Ctx->textureViewer(); + if(!m_Ctx.hasTextureViewer()) + m_Ctx.showTextureViewer(); + TextureViewer *viewer = m_Ctx.textureViewer(); viewer->ViewTexture(tex->ID, true); } @@ -1763,14 +1763,14 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int { // last thing, see if it's a streamout buffer - if(stage == &m_Ctx->CurD3D12PipelineState.m_GS) + if(stage == &m_Ctx.CurD3D12PipelineState.m_GS) { - for(int i = 0; i < m_Ctx->CurD3D12PipelineState.m_SO.Outputs.count; i++) + for(int i = 0; i < m_Ctx.CurD3D12PipelineState.m_SO.Outputs.count; i++) { - if(buf->ID == m_Ctx->CurD3D12PipelineState.m_SO.Outputs[i].Buffer) + if(buf->ID == m_Ctx.CurD3D12PipelineState.m_SO.Outputs[i].Buffer) { - size -= m_Ctx->CurD3D12PipelineState.m_SO.Outputs[i].Offset; - offs += m_Ctx->CurD3D12PipelineState.m_SO.Outputs[i].Offset; + size -= m_Ctx.CurD3D12PipelineState.m_SO.Outputs[i].Offset; + offs += m_Ctx.CurD3D12PipelineState.m_SO.Outputs[i].Offset; break; } } @@ -1900,11 +1900,11 @@ void D3D12PipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int } { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(offs, size, view.res.Resource, format); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1931,13 +1931,13 @@ void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int if(cb.idx == ~0U) { // unused cbuffer, open regular buffer viewer - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); const D3D12PipelineState::CBuffer &buf = stage->Spaces[cb.space].ConstantBuffers[cb.reg]; viewer->ViewBuffer(buf.Offset, buf.ByteSize, buf.Buffer); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1955,9 +1955,9 @@ void D3D12PipelineStateViewer::cbuffer_itemActivated(QTreeWidgetItem *item, int } ConstantBufferPreviewer *prev = - new ConstantBufferPreviewer(m_Ctx, stage->stage, cb.idx, 0, m_Ctx->mainWindow()); + new ConstantBufferPreviewer(m_Ctx, stage->stage, cb.idx, 0, m_Ctx.mainWindow()); - m_Ctx->setupDockWindow(prev); + m_Ctx.setupDockWindow(prev); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1980,11 +1980,11 @@ void D3D12PipelineStateViewer::on_iaBuffers_itemActivated(QTreeWidgetItem *item, if(buf.id != ResourceId()) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(buf.offset, UINT64_MAX, buf.id); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1998,7 +1998,7 @@ void D3D12PipelineStateViewer::highlightIABind(int slot) { int idx = ((slot + 1) * 21) % 32; // space neighbouring colours reasonably distinctly - const D3D12PipelineState::InputAssembler &IA = m_Ctx->CurD3D12PipelineState.m_IA; + const D3D12PipelineState::InputAssembler &IA = m_Ctx.CurD3D12PipelineState.m_IA; QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); @@ -2048,14 +2048,14 @@ void D3D12PipelineStateViewer::highlightIABind(int slot) void D3D12PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QModelIndex idx = ui->iaLayouts->indexAt(e->pos()); vertex_leave(NULL); - const D3D12PipelineState::InputAssembler &IA = m_Ctx->CurD3D12PipelineState.m_IA; + const D3D12PipelineState::InputAssembler &IA = m_Ctx.CurD3D12PipelineState.m_IA; if(idx.isValid()) { @@ -2070,7 +2070,7 @@ void D3D12PipelineStateViewer::on_iaLayouts_mouseMove(QMouseEvent *e) void D3D12PipelineStateViewer::on_iaBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QTreeWidgetItem *item = ui->iaBuffers->itemAt(e->pos()); @@ -2160,7 +2160,7 @@ void D3D12PipelineStateViewer::shaderView_clicked() ShaderViewer *shad = new ShaderViewer(m_Ctx, stage->ShaderDetails, stage->stage, NULL, ""); - m_Ctx->setupDockWindow(shad); + m_Ctx.setupDockWindow(shad); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2219,7 +2219,7 @@ void D3D12PipelineStateViewer::on_exportHTML_clicked() void D3D12PipelineStateViewer::on_meshView_clicked() { - if(!m_Ctx->hasMeshPreview()) - m_Ctx->showMeshPreview(); - ToolWindowManager::raiseToolWindow(m_Ctx->meshPreview()); + if(!m_Ctx.hasMeshPreview()) + m_Ctx.showMeshPreview(); + ToolWindowManager::raiseToolWindow(m_Ctx.meshPreview()); } diff --git a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h index 5add0abe0..b828f01b2 100644 --- a/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/D3D12PipelineStateViewer.h @@ -41,7 +41,7 @@ class D3D12PipelineStateViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit D3D12PipelineStateViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit D3D12PipelineStateViewer(CaptureContext &ctx, QWidget *parent = 0); ~D3D12PipelineStateViewer(); void OnLogfileLoaded(); @@ -70,7 +70,7 @@ private slots: private: Ui::D3D12PipelineStateViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; enum D3DBufferViewFlags { diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp index 659d7cf2c..d5e0a68b5 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.cpp @@ -72,7 +72,7 @@ struct ReadWriteTag Q_DECLARE_METATYPE(ReadWriteTag); -GLPipelineStateViewer::GLPipelineStateViewer(CaptureContext *ctx, QWidget *parent) +GLPipelineStateViewer::GLPipelineStateViewer(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::GLPipelineStateViewer), m_Ctx(ctx) { ui->setupUi(this); @@ -332,7 +332,7 @@ GLPipelineStateViewer::~GLPipelineStateViewer() void GLPipelineStateViewer::OnLogfileLoaded() { - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void GLPipelineStateViewer::OnLogfileClosed() @@ -393,29 +393,29 @@ bool GLPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const GLPipelineState::ShaderStage *GLPipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return NULL; while(widget) { if(widget == ui->stagesTabs->widget(0)) - return &m_Ctx->CurGLPipelineState.m_VS; + return &m_Ctx.CurGLPipelineState.m_VS; if(widget == ui->stagesTabs->widget(1)) - return &m_Ctx->CurGLPipelineState.m_VS; + return &m_Ctx.CurGLPipelineState.m_VS; if(widget == ui->stagesTabs->widget(2)) - return &m_Ctx->CurGLPipelineState.m_TCS; + return &m_Ctx.CurGLPipelineState.m_TCS; if(widget == ui->stagesTabs->widget(3)) - return &m_Ctx->CurGLPipelineState.m_TES; + return &m_Ctx.CurGLPipelineState.m_TES; if(widget == ui->stagesTabs->widget(4)) - return &m_Ctx->CurGLPipelineState.m_GS; + return &m_Ctx.CurGLPipelineState.m_GS; if(widget == ui->stagesTabs->widget(5)) - return &m_Ctx->CurGLPipelineState.m_FS; + return &m_Ctx.CurGLPipelineState.m_FS; if(widget == ui->stagesTabs->widget(6)) - return &m_Ctx->CurGLPipelineState.m_FS; + return &m_Ctx.CurGLPipelineState.m_FS; if(widget == ui->stagesTabs->widget(7)) - return &m_Ctx->CurGLPipelineState.m_FS; + return &m_Ctx.CurGLPipelineState.m_FS; if(widget == ui->stagesTabs->widget(8)) - return &m_Ctx->CurGLPipelineState.m_CS; + return &m_Ctx.CurGLPipelineState.m_CS; widget = widget->parentWidget(); } @@ -518,7 +518,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s { ShaderReflection *shaderDetails = stage.ShaderDetails; const ShaderBindpointMapping &mapping = stage.BindpointMapping; - const GLPipelineState &state = m_Ctx->CurGLPipelineState; + const GLPipelineState &state = m_Ctx.CurGLPipelineState; QIcon action(QPixmap(QString::fromUtf8(":/action.png"))); QIcon action_hover(QPixmap(QString::fromUtf8(":/action_hover.png"))); @@ -607,7 +607,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s w = h = d = a = 0; } - FetchTexture *tex = m_Ctx->GetTexture(r.Resource); + FetchTexture *tex = m_Ctx.GetTexture(r.Resource); if(tex) { @@ -772,7 +772,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s offset = b->Offset; length = b->Size; - FetchBuffer *buf = m_Ctx->GetBuffer(b->Resource); + FetchBuffer *buf = m_Ctx.GetBuffer(b->Resource); if(buf) { name = buf->name; @@ -881,7 +881,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s QVariant tag; - FetchTexture *tex = m_Ctx->GetTexture(id); + FetchTexture *tex = m_Ctx.GetTexture(id); if(tex) { @@ -909,7 +909,7 @@ void GLPipelineStateViewer::setShaderState(const GLPipelineState::ShaderStage &s tag = QVariant::fromValue(id); } - FetchBuffer *buf = m_Ctx->GetBuffer(id); + FetchBuffer *buf = m_Ctx.GetBuffer(id); if(buf) { @@ -1019,14 +1019,14 @@ GLPipelineStateViewer::GLReadWriteType GLPipelineStateViewer::GetGLReadWriteType void GLPipelineStateViewer::setState() { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) { clearState(); return; } - const GLPipelineState &state = m_Ctx->CurGLPipelineState; - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const GLPipelineState &state = m_Ctx.CurGLPipelineState; + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); bool showDisabled = ui->showDisabled->isChecked(); bool showEmpty = ui->showEmpty->isChecked(); @@ -1181,7 +1181,7 @@ void GLPipelineStateViewer::setState() if(!ibufferUsed) length = 0; - FetchBuffer *buf = m_Ctx->GetBuffer(state.m_VtxIn.ibuffer); + FetchBuffer *buf = m_Ctx.GetBuffer(state.m_VtxIn.ibuffer); if(buf) { @@ -1247,7 +1247,7 @@ void GLPipelineStateViewer::setState() length = 0; } - FetchBuffer *buf = m_Ctx->GetBuffer(v.Buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(v.Buffer); if(buf) { name = buf->name; @@ -1310,7 +1310,7 @@ void GLPipelineStateViewer::setState() name = "Empty"; } - FetchBuffer *buf = m_Ctx->GetBuffer(state.m_Feedback.BufferBinding[i]); + FetchBuffer *buf = m_Ctx.GetBuffer(state.m_Feedback.BufferBinding[i]); if(buf) { @@ -1625,7 +1625,7 @@ void GLPipelineStateViewer::setState() w = h = d = a = 0; } - FetchTexture *tex = m_Ctx->GetTexture(p); + FetchTexture *tex = m_Ctx.GetTexture(p); if(tex) { w = tex->width; @@ -1710,7 +1710,7 @@ void GLPipelineStateViewer::setState() w = h = d = a = 0; } - FetchTexture *tex = m_Ctx->GetTexture(ds); + FetchTexture *tex = m_Ctx.GetTexture(ds); if(tex) { w = tex->width; @@ -1956,17 +1956,17 @@ void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int co if(tag.canConvert()) { - FetchTexture *tex = m_Ctx->GetTexture(tag.value()); + FetchTexture *tex = m_Ctx.GetTexture(tag.value()); if(tex) { if(tex->resType == eResType_Buffer) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewTexture(0, 0, tex->ID); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1975,9 +1975,9 @@ void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int co } else { - if(!m_Ctx->hasTextureViewer()) - m_Ctx->showTextureViewer(); - TextureViewer *viewer = m_Ctx->textureViewer(); + if(!m_Ctx.hasTextureViewer()) + m_Ctx.showTextureViewer(); + TextureViewer *viewer = m_Ctx.textureViewer(); viewer->ViewTexture(tex->ID, true); } @@ -2029,11 +2029,11 @@ void GLPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, int co if(buf.ID != ResourceId()) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(buf.offset, buf.size, buf.ID, format); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2065,9 +2065,9 @@ void GLPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int column) } ConstantBufferPreviewer *prev = - new ConstantBufferPreviewer(m_Ctx, stage->stage, cb, 0, m_Ctx->mainWindow()); + new ConstantBufferPreviewer(m_Ctx, stage->stage, cb, 0, m_Ctx.mainWindow()); - m_Ctx->setupDockWindow(prev); + m_Ctx.setupDockWindow(prev); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2090,11 +2090,11 @@ void GLPipelineStateViewer::on_viBuffers_itemActivated(QTreeWidgetItem *item, in if(buf.id != ResourceId()) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(buf.offset, UINT64_MAX, buf.id); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2108,7 +2108,7 @@ void GLPipelineStateViewer::highlightIABind(int slot) { int idx = ((slot + 1) * 21) % 32; // space neighbouring colours reasonably distinctly - const GLPipelineState::VertexInput &VI = m_Ctx->CurGLPipelineState.m_VtxIn; + const GLPipelineState::VertexInput &VI = m_Ctx.CurGLPipelineState.m_VtxIn; QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); @@ -2152,14 +2152,14 @@ void GLPipelineStateViewer::highlightIABind(int slot) void GLPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QModelIndex idx = ui->viAttrs->indexAt(e->pos()); vertex_leave(NULL); - const GLPipelineState::VertexInput &VI = m_Ctx->CurGLPipelineState.m_VtxIn; + const GLPipelineState::VertexInput &VI = m_Ctx.CurGLPipelineState.m_VtxIn; if(idx.isValid()) { @@ -2174,7 +2174,7 @@ void GLPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) void GLPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); @@ -2257,7 +2257,7 @@ void GLPipelineStateViewer::shaderView_clicked() ShaderViewer *shad = new ShaderViewer(m_Ctx, shaderDetails, stage->stage, NULL, ""); - m_Ctx->setupDockWindow(shad); + m_Ctx.setupDockWindow(shad); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2316,7 +2316,7 @@ void GLPipelineStateViewer::on_exportHTML_clicked() void GLPipelineStateViewer::on_meshView_clicked() { - if(!m_Ctx->hasMeshPreview()) - m_Ctx->showMeshPreview(); - ToolWindowManager::raiseToolWindow(m_Ctx->meshPreview()); + if(!m_Ctx.hasMeshPreview()) + m_Ctx.showMeshPreview(); + ToolWindowManager::raiseToolWindow(m_Ctx.meshPreview()); } diff --git a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h index 3afa5aaea..af843ba55 100644 --- a/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/GLPipelineStateViewer.h @@ -40,7 +40,7 @@ class GLPipelineStateViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit GLPipelineStateViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit GLPipelineStateViewer(CaptureContext &ctx, QWidget *parent = 0); ~GLPipelineStateViewer(); void OnLogfileLoaded(); @@ -69,7 +69,7 @@ private slots: private: Ui::GLPipelineStateViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; enum class GLReadWriteType { diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index dc265a76d..9b3da2eed 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -29,7 +29,7 @@ #include "VulkanPipelineStateViewer.h" #include "ui_PipelineStateViewer.h" -PipelineStateViewer::PipelineStateViewer(CaptureContext *ctx, QWidget *parent) +PipelineStateViewer::PipelineStateViewer(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::PipelineStateViewer), m_Ctx(ctx) { ui->setupUi(this); @@ -41,7 +41,7 @@ PipelineStateViewer::PipelineStateViewer(CaptureContext *ctx, QWidget *parent) m_Current = NULL; - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); setToD3D11(); } @@ -50,21 +50,21 @@ PipelineStateViewer::~PipelineStateViewer() { reset(); - m_Ctx->windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.windowClosed(this); + m_Ctx.RemoveLogViewer(this); delete ui; } void PipelineStateViewer::OnLogfileLoaded() { - if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_D3D11) + if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_D3D11) setToD3D11(); - else if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_D3D12) + else if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_D3D12) setToD3D12(); - else if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL) + else if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) setToGL(); - else if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_Vulkan) + else if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_Vulkan) setToVulkan(); if(m_Current) @@ -79,7 +79,7 @@ void PipelineStateViewer::OnLogfileClosed() void PipelineStateViewer::OnEventChanged(uint32_t eventID) { - if(m_Ctx->CurPipelineState.DefaultType != m_Ctx->APIProps().pipelineType) + if(m_Ctx.CurPipelineState.DefaultType != m_Ctx.APIProps().pipelineType) OnLogfileLoaded(); if(m_Current) @@ -143,7 +143,7 @@ void PipelineStateViewer::setToD3D11() m_D3D11 = new D3D11PipelineStateViewer(m_Ctx, this); ui->layout->addWidget(m_D3D11); m_Current = m_D3D11; - m_Ctx->CurPipelineState.DefaultType = eGraphicsAPI_D3D11; + m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_D3D11; } void PipelineStateViewer::setToD3D12() @@ -156,7 +156,7 @@ void PipelineStateViewer::setToD3D12() m_D3D12 = new D3D12PipelineStateViewer(m_Ctx, this); ui->layout->addWidget(m_D3D12); m_Current = m_D3D12; - m_Ctx->CurPipelineState.DefaultType = eGraphicsAPI_D3D12; + m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_D3D12; } void PipelineStateViewer::setToGL() @@ -169,7 +169,7 @@ void PipelineStateViewer::setToGL() m_GL = new GLPipelineStateViewer(m_Ctx, this); ui->layout->addWidget(m_GL); m_Current = m_GL; - m_Ctx->CurPipelineState.DefaultType = eGraphicsAPI_OpenGL; + m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_OpenGL; } void PipelineStateViewer::setToVulkan() @@ -182,5 +182,5 @@ void PipelineStateViewer::setToVulkan() m_Vulkan = new VulkanPipelineStateViewer(m_Ctx, this); ui->layout->addWidget(m_Vulkan); m_Current = m_Vulkan; - m_Ctx->CurPipelineState.DefaultType = eGraphicsAPI_Vulkan; + m_Ctx.CurPipelineState.DefaultType = eGraphicsAPI_Vulkan; } diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h index fa537c58f..5fe1debee 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.h @@ -44,7 +44,7 @@ class PipelineStateViewer : public QFrame, public ILogViewerForm Q_PROPERTY(QVariant persistData READ persistData WRITE setPersistData DESIGNABLE false SCRIPTABLE false) public: - explicit PipelineStateViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit PipelineStateViewer(CaptureContext &ctx, QWidget *parent = 0); ~PipelineStateViewer(); void OnLogfileLoaded(); @@ -57,7 +57,7 @@ public: private: Ui::PipelineStateViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; void setToD3D11(); void setToD3D12(); diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index ba3b82b16..b6ed414f3 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -90,7 +90,7 @@ struct BufferTag Q_DECLARE_METATYPE(BufferTag); -VulkanPipelineStateViewer::VulkanPipelineStateViewer(CaptureContext *ctx, QWidget *parent) +VulkanPipelineStateViewer::VulkanPipelineStateViewer(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::VulkanPipelineStateViewer), m_Ctx(ctx) { ui->setupUi(this); @@ -296,7 +296,7 @@ VulkanPipelineStateViewer::~VulkanPipelineStateViewer() void VulkanPipelineStateViewer::OnLogfileLoaded() { - OnEventChanged(m_Ctx->CurEvent()); + OnEventChanged(m_Ctx.CurEvent()); } void VulkanPipelineStateViewer::OnLogfileClosed() @@ -347,7 +347,7 @@ void VulkanPipelineStateViewer::setViewDetails(QTreeWidgetItem *node, const bind bool viewdetails = false; { - for(const VulkanPipelineState::ImageData &im : m_Ctx->CurVulkanPipelineState.images) + for(const VulkanPipelineState::ImageData &im : m_Ctx.CurVulkanPipelineState.images) { if(im.image == tex->ID) { @@ -460,29 +460,29 @@ bool VulkanPipelineStateViewer::showNode(bool usedSlot, bool filledSlot) const VulkanPipelineState::ShaderStage *VulkanPipelineStateViewer::stageForSender(QWidget *widget) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return NULL; while(widget) { if(widget == ui->stagesTabs->widget(0)) - return &m_Ctx->CurVulkanPipelineState.m_VS; + return &m_Ctx.CurVulkanPipelineState.m_VS; if(widget == ui->stagesTabs->widget(1)) - return &m_Ctx->CurVulkanPipelineState.m_VS; + return &m_Ctx.CurVulkanPipelineState.m_VS; if(widget == ui->stagesTabs->widget(2)) - return &m_Ctx->CurVulkanPipelineState.m_TCS; + return &m_Ctx.CurVulkanPipelineState.m_TCS; if(widget == ui->stagesTabs->widget(3)) - return &m_Ctx->CurVulkanPipelineState.m_TES; + return &m_Ctx.CurVulkanPipelineState.m_TES; if(widget == ui->stagesTabs->widget(4)) - return &m_Ctx->CurVulkanPipelineState.m_GS; + return &m_Ctx.CurVulkanPipelineState.m_GS; if(widget == ui->stagesTabs->widget(5)) - return &m_Ctx->CurVulkanPipelineState.m_FS; + return &m_Ctx.CurVulkanPipelineState.m_FS; if(widget == ui->stagesTabs->widget(6)) - return &m_Ctx->CurVulkanPipelineState.m_FS; + return &m_Ctx.CurVulkanPipelineState.m_FS; if(widget == ui->stagesTabs->widget(7)) - return &m_Ctx->CurVulkanPipelineState.m_FS; + return &m_Ctx.CurVulkanPipelineState.m_FS; if(widget == ui->stagesTabs->widget(8)) - return &m_Ctx->CurVulkanPipelineState.m_CS; + return &m_Ctx.CurVulkanPipelineState.m_CS; widget = widget->parentWidget(); } @@ -806,7 +806,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, format = ToQStr(descriptorBind->viewfmt.strname); // check to see if it's a texture - tex = m_Ctx->GetTexture(descriptorBind->res); + tex = m_Ctx.GetTexture(descriptorBind->res); if(tex) { w = tex->width; @@ -821,7 +821,7 @@ void VulkanPipelineStateViewer::addResourceRow(ShaderReflection *shaderDetails, } // if not a texture, it must be a buffer - buf = m_Ctx->GetBuffer(descriptorBind->res); + buf = m_Ctx.GetBuffer(descriptorBind->res); if(buf) { len = buf->length; @@ -1145,7 +1145,7 @@ void VulkanPipelineStateViewer::addConstantBlockRow(ShaderReflection *shaderDeta name = ""; length = descriptorBind->size; - FetchBuffer *buf = m_Ctx->GetBuffer(descriptorBind->res); + FetchBuffer *buf = m_Ctx.GetBuffer(descriptorBind->res); if(buf) { name = buf->name; @@ -1404,7 +1404,7 @@ void VulkanPipelineStateViewer::setShaderState(const VulkanPipelineState::Shader void VulkanPipelineStateViewer::setState() { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) { clearState(); return; @@ -1412,8 +1412,8 @@ void VulkanPipelineStateViewer::setState() m_CombinedImageSamplers.clear(); - const VulkanPipelineState &state = m_Ctx->CurVulkanPipelineState; - const FetchDrawcall *draw = m_Ctx->CurDrawcall(); + const VulkanPipelineState &state = m_Ctx.CurVulkanPipelineState; + const FetchDrawcall *draw = m_Ctx.CurDrawcall(); bool showDisabled = ui->showDisabled->isChecked(); bool showEmpty = ui->showEmpty->isChecked(); @@ -1549,7 +1549,7 @@ void VulkanPipelineStateViewer::setState() if(!ibufferUsed) length = 0; - FetchBuffer *buf = m_Ctx->GetBuffer(state.IA.ibuffer.buf); + FetchBuffer *buf = m_Ctx.GetBuffer(state.IA.ibuffer.buf); if(buf) { @@ -1630,7 +1630,7 @@ void VulkanPipelineStateViewer::setState() name = "Buffer " + ToQStr(vbuff->buffer); offset = vbuff->offset; - FetchBuffer *buf = m_Ctx->GetBuffer(vbuff->buffer); + FetchBuffer *buf = m_Ctx.GetBuffer(vbuff->buffer); if(buf) { name = buf->name; @@ -1810,7 +1810,7 @@ void VulkanPipelineStateViewer::setState() w = h = d = a = 0; } - FetchTexture *tex = m_Ctx->GetTexture(p.img); + FetchTexture *tex = m_Ctx.GetTexture(p.img); if(tex) { w = tex->width; @@ -2047,17 +2047,17 @@ void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, in if(tag.canConvert()) { - FetchTexture *tex = m_Ctx->GetTexture(tag.value()); + FetchTexture *tex = m_Ctx.GetTexture(tag.value()); if(tex) { if(tex->resType == eResType_Buffer) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewTexture(0, 0, tex->ID); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2066,9 +2066,9 @@ void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, in } else { - if(!m_Ctx->hasTextureViewer()) - m_Ctx->showTextureViewer(); - TextureViewer *viewer = m_Ctx->textureViewer(); + if(!m_Ctx.hasTextureViewer()) + m_Ctx.showTextureViewer(); + TextureViewer *viewer = m_Ctx.textureViewer(); viewer->ViewTexture(tex->ID, true); } @@ -2122,11 +2122,11 @@ void VulkanPipelineStateViewer::resource_itemActivated(QTreeWidgetItem *item, in if(buf.ID != ResourceId()) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(buf.offset, buf.size, buf.ID, format); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2159,9 +2159,9 @@ void VulkanPipelineStateViewer::ubo_itemActivated(QTreeWidgetItem *item, int col } ConstantBufferPreviewer *prev = - new ConstantBufferPreviewer(m_Ctx, stage->stage, cb.slotIdx, cb.arrayIdx, m_Ctx->mainWindow()); + new ConstantBufferPreviewer(m_Ctx, stage->stage, cb.slotIdx, cb.arrayIdx, m_Ctx.mainWindow()); - m_Ctx->setupDockWindow(prev); + m_Ctx.setupDockWindow(prev); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2184,11 +2184,11 @@ void VulkanPipelineStateViewer::on_viBuffers_itemActivated(QTreeWidgetItem *item if(buf.id != ResourceId()) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewBuffer(buf.offset, UINT64_MAX, buf.id); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2202,7 +2202,7 @@ void VulkanPipelineStateViewer::highlightIABind(int slot) { int idx = ((slot + 1) * 21) % 32; // space neighbouring colours reasonably distinctly - const VulkanPipelineState::VertexInput &VI = m_Ctx->CurVulkanPipelineState.VI; + const VulkanPipelineState::VertexInput &VI = m_Ctx.CurVulkanPipelineState.VI; QColor col = QColor::fromHslF(float(idx) / 32.0f, 1.0f, 0.95f); @@ -2254,14 +2254,14 @@ void VulkanPipelineStateViewer::highlightIABind(int slot) void VulkanPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QModelIndex idx = ui->viAttrs->indexAt(e->pos()); vertex_leave(NULL); - const VulkanPipelineState::VertexInput &VI = m_Ctx->CurVulkanPipelineState.VI; + const VulkanPipelineState::VertexInput &VI = m_Ctx.CurVulkanPipelineState.VI; if(idx.isValid()) { @@ -2276,7 +2276,7 @@ void VulkanPipelineStateViewer::on_viAttrs_mouseMove(QMouseEvent *e) void VulkanPipelineStateViewer::on_viBuffers_mouseMove(QMouseEvent *e) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; QTreeWidgetItem *item = ui->viBuffers->itemAt(e->pos()); @@ -2359,7 +2359,7 @@ void VulkanPipelineStateViewer::shaderView_clicked() ShaderViewer *shad = new ShaderViewer(m_Ctx, shaderDetails, stage->stage, NULL, ""); - m_Ctx->setupDockWindow(shad); + m_Ctx.setupDockWindow(shad); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -2418,7 +2418,7 @@ void VulkanPipelineStateViewer::on_exportHTML_clicked() void VulkanPipelineStateViewer::on_meshView_clicked() { - if(!m_Ctx->hasMeshPreview()) - m_Ctx->showMeshPreview(); - ToolWindowManager::raiseToolWindow(m_Ctx->meshPreview()); + if(!m_Ctx.hasMeshPreview()) + m_Ctx.showMeshPreview(); + ToolWindowManager::raiseToolWindow(m_Ctx.meshPreview()); } diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h index 5cb99eb40..7bc338124 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.h @@ -47,7 +47,7 @@ class VulkanPipelineStateViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit VulkanPipelineStateViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit VulkanPipelineStateViewer(CaptureContext &ctx, QWidget *parent = 0); ~VulkanPipelineStateViewer(); void OnLogfileLoaded(); @@ -76,7 +76,7 @@ private slots: private: Ui::VulkanPipelineStateViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; QVariantList makeSampler( const QString &bindset, const QString &slotname, diff --git a/qrenderdoc/Windows/ShaderViewer.cpp b/qrenderdoc/Windows/ShaderViewer.cpp index dbf45345a..848f0c8bc 100644 --- a/qrenderdoc/Windows/ShaderViewer.cpp +++ b/qrenderdoc/Windows/ShaderViewer.cpp @@ -30,7 +30,7 @@ #include "Code/ScintillaSyntax.h" #include "ui_ShaderViewer.h" -ShaderViewer::ShaderViewer(CaptureContext *ctx, ShaderReflection *shader, ShaderStageType stage, +ShaderViewer::ShaderViewer(CaptureContext &ctx, ShaderReflection *shader, ShaderStageType stage, ShaderDebugTrace *trace, const QString &debugContext, QWidget *parent) : QFrame(parent), ui(new Ui::ShaderViewer), m_Ctx(ctx) { @@ -41,15 +41,15 @@ ShaderViewer::ShaderViewer(CaptureContext *ctx, ShaderReflection *shader, Shader if(trace != NULL) setWindowTitle( - QString("Debugging %1 - %2").arg(m_Ctx->CurPipelineState.GetShaderName(stage)).arg(debugContext)); + QString("Debugging %1 - %2").arg(m_Ctx.CurPipelineState.GetShaderName(stage)).arg(debugContext)); else - setWindowTitle(m_Ctx->CurPipelineState.GetShaderName(stage)); + setWindowTitle(m_Ctx.CurPipelineState.GetShaderName(stage)); QString disasm = shader != NULL ? ToQStr(shader->Disassembly) : ""; { m_DisassemblyView = MakeEditor("scintillaDisassem", disasm, - m_Ctx->APIProps().pipelineType == eGraphicsAPI_Vulkan); + m_Ctx.APIProps().pipelineType == eGraphicsAPI_Vulkan); m_DisassemblyView->setReadOnly(true); m_DisassemblyView->setWindowTitle(tr("Disassembly")); @@ -197,12 +197,12 @@ ShaderViewer::ShaderViewer(CaptureContext *ctx, ShaderReflection *shader, Shader QHBoxLayout *layout = new QHBoxLayout(this); layout->addWidget(ui->docking); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); } ShaderViewer::~ShaderViewer() { - m_Ctx->RemoveLogViewer(this); + m_Ctx.RemoveLogViewer(this); delete ui; } @@ -252,7 +252,7 @@ ScintillaEdit *ShaderViewer::MakeEditor(const QString &name, const QString &text ret->indicSetStyle(4, INDIC_ROUNDBOX); ConfigureSyntax(ret, - m_Ctx->APIProps().localRenderer == eGraphicsAPI_OpenGL ? SCLEX_GLSL : SCLEX_HLSL); + m_Ctx.APIProps().localRenderer == eGraphicsAPI_OpenGL ? SCLEX_GLSL : SCLEX_HLSL); ret->setTabWidth(4); diff --git a/qrenderdoc/Windows/ShaderViewer.h b/qrenderdoc/Windows/ShaderViewer.h index 9395ff70c..908622feb 100644 --- a/qrenderdoc/Windows/ShaderViewer.h +++ b/qrenderdoc/Windows/ShaderViewer.h @@ -42,7 +42,7 @@ class ShaderViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit ShaderViewer(CaptureContext *ctx, ShaderReflection *shader, ShaderStageType stage, + explicit ShaderViewer(CaptureContext &ctx, ShaderReflection *shader, ShaderStageType stage, ShaderDebugTrace *trace, const QString &debugContext, QWidget *parent = 0); ~ShaderViewer(); @@ -58,7 +58,7 @@ private slots: private: Ui::ShaderViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; ShaderDebugTrace *m_Trace; ShaderReflection *m_ShaderDetails; ScintillaEdit *m_DisassemblyView; diff --git a/qrenderdoc/Windows/StatisticsViewer.cpp b/qrenderdoc/Windows/StatisticsViewer.cpp index a8ff082d7..3253cb6e5 100644 --- a/qrenderdoc/Windows/StatisticsViewer.cpp +++ b/qrenderdoc/Windows/StatisticsViewer.cpp @@ -168,7 +168,7 @@ void AppendInputAssemblerStatistics(QString &statisticsLog, const FetchFrameInfo vertices.bindslots)); } -void AppendShaderStatistics(CaptureContext *ctx, QString &statisticsLog, +void AppendShaderStatistics(CaptureContext &ctx, QString &statisticsLog, const FetchFrameInfo &frameInfo) { const FetchFrameShaderStats *shaders = frameInfo.stats.shaders; @@ -188,7 +188,7 @@ void AppendShaderStatistics(CaptureContext *ctx, QString &statisticsLog, { statisticsLog.append(QString("%1 calls: %2, non-null shader sets: %3, null shader sets: %4, " "redundant shader sets: %5\n") - .arg(ctx->CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) .arg(shaders[s].calls) .arg(shaders[s].sets) .arg(shaders[s].nulls) @@ -203,7 +203,7 @@ void AppendShaderStatistics(CaptureContext *ctx, QString &statisticsLog, .arg(totalShadersPerStage.redundants)); } -void AppendConstantBindStatistics(CaptureContext *ctx, QString &statisticsLog, +void AppendConstantBindStatistics(CaptureContext &ctx, QString &statisticsLog, const FetchFrameInfo &frameInfo) { // #mivance C++-side we guarantee all stages will have the same slots @@ -263,7 +263,7 @@ void AppendConstantBindStatistics(CaptureContext *ctx, QString &statisticsLog, for(int s = eShaderStage_First; s < eShaderStage_Count; s++) { statisticsLog.append(QString("%1 calls: %2, non-null buffer sets: %3, null buffer sets: %4\n") - .arg(ctx->CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) .arg(totalConstantsPerStage[s].calls) .arg(totalConstantsPerStage[s].sets) .arg(totalConstantsPerStage[s].nulls)); @@ -299,7 +299,7 @@ void AppendConstantBindStatistics(CaptureContext *ctx, QString &statisticsLog, } } -void AppendSamplerBindStatistics(CaptureContext *ctx, QString &statisticsLog, +void AppendSamplerBindStatistics(CaptureContext &ctx, QString &statisticsLog, const FetchFrameInfo &frameInfo) { // #mivance see AppendConstantBindStatistics @@ -348,7 +348,7 @@ void AppendSamplerBindStatistics(CaptureContext *ctx, QString &statisticsLog, for(int s = eShaderStage_First; s < eShaderStage_Count; s++) { statisticsLog.append(QString("%1 calls: %2, non-null sampler sets: %3, null sampler sets: %4\n") - .arg(ctx->CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) .arg(totalSamplersPerStage[s].calls) .arg(totalSamplersPerStage[s].sets) .arg(totalSamplersPerStage[s].nulls)); @@ -364,7 +364,7 @@ void AppendSamplerBindStatistics(CaptureContext *ctx, QString &statisticsLog, "Aggregate slot counts per invocation across all stages", totalSamplersForAllStages.bindslots)); } -void AppendResourceBindStatistics(CaptureContext *ctx, QString &statisticsLog, +void AppendResourceBindStatistics(CaptureContext &ctx, QString &statisticsLog, const FetchFrameInfo &frameInfo) { // #mivance see AppendConstantBindStatistics @@ -424,7 +424,7 @@ void AppendResourceBindStatistics(CaptureContext *ctx, QString &statisticsLog, for(int s = eShaderStage_First; s < eShaderStage_Count; s++) { statisticsLog.append(QString("%1 calls: %2 non-null resource sets: %3 null resource sets: %4\n") - .arg(ctx->CurPipelineState.Abbrev((ShaderStageType)s)) + .arg(ctx.CurPipelineState.Abbrev((ShaderStageType)s)) .arg(totalResourcesPerStage[s].calls) .arg(totalResourcesPerStage[s].sets) .arg(totalResourcesPerStage[s].nulls)); @@ -584,7 +584,7 @@ void AppendOutputStatistics(QString &statisticsLog, const FetchFrameInfo &frameI statisticsLog.append(CreateSimpleIntegerHistogram("Outputs set", outputs.bindslots)); } -void AppendDetailedInformation(CaptureContext *ctx, QString &statisticsLog, +void AppendDetailedInformation(CaptureContext &ctx, QString &statisticsLog, const FetchFrameInfo &frameInfo) { if(frameInfo.stats.recorded == 0) @@ -664,11 +664,11 @@ QString AppendAPICallSummary(const FetchFrameInfo &frameInfo, uint numAPICalls) return calls; } -QString GenerateReport(CaptureContext *ctx) +QString GenerateReport(CaptureContext &ctx) { QString statisticsLog; - const rdctype::array &curDraws = ctx->CurDrawcalls(); + const rdctype::array &curDraws = ctx.CurDrawcalls(); const FetchDrawcall *lastDraw = &curDraws.back(); while(!lastDraw->children.empty()) @@ -682,13 +682,13 @@ QString GenerateReport(CaptureContext *ctx) uint32_t numAPIcalls = lastDraw->eventID - (drawCount + dispatchCount + diagnosticCount); - int numTextures = ctx->GetTextures().count; - int numBuffers = ctx->GetBuffers().count; + int numTextures = ctx.GetTextures().count; + int numBuffers = ctx.GetBuffers().count; uint64_t IBBytes = 0; uint64_t VBBytes = 0; uint64_t BufBytes = 0; - for(const FetchBuffer &b : ctx->GetBuffers()) + for(const FetchBuffer &b : ctx.GetBuffers()) { BufBytes += b.length; @@ -706,7 +706,7 @@ QString GenerateReport(CaptureContext *ctx) float texW = 0, texH = 0; float largeTexW = 0, largeTexH = 0; int texCount = 0, largeTexCount = 0; - for(const FetchTexture &t : ctx->GetTextures()) + for(const FetchTexture &t : ctx.GetTextures()) { if(t.creationFlags & (eTextureCreate_RTV | eTextureCreate_DSV)) { @@ -739,7 +739,7 @@ QString GenerateReport(CaptureContext *ctx) largeTexW /= largeTexCount; largeTexH /= largeTexCount; - const FetchFrameInfo &frameInfo = ctx->FrameInfo(); + const FetchFrameInfo &frameInfo = ctx.FrameInfo(); float compressedMB = (float)frameInfo.compressedFileSize / (1024.0f * 1024.0f); float uncompressedMB = (float)frameInfo.uncompressedFileSize / (1024.0f * 1024.0f); @@ -751,7 +751,7 @@ QString GenerateReport(CaptureContext *ctx) QString( "Stats for %1.\n\nFile size: %2MB (%3MB uncompressed, compression ratio %4:1)\n" "Persistent Data (approx): %5MB, Frame-initial data (approx): %6MB\n") - .arg(QFileInfo(ctx->LogFilename()).fileName()) + .arg(QFileInfo(ctx.LogFilename()).fileName()) .arg(compressedMB, 2, 'f', 2) .arg(uncompressedMB, 2, 'f', 2) .arg(compressRatio, 2, 'f', 2) @@ -797,23 +797,21 @@ QString GenerateReport(CaptureContext *ctx) return statisticsLog; } -StatisticsViewer::StatisticsViewer(CaptureContext *ctx, QWidget *parent) - : QFrame(parent), ui(new Ui::StatisticsViewer) +StatisticsViewer::StatisticsViewer(CaptureContext &ctx, QWidget *parent) + : QFrame(parent), ui(new Ui::StatisticsViewer), m_Ctx(ctx) { ui->setupUi(this); - m_Ctx = ctx; - ui->statistics->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont)); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); } StatisticsViewer::~StatisticsViewer() { - m_Ctx->windowClosed(this); + m_Ctx.windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.RemoveLogViewer(this); delete ui; } diff --git a/qrenderdoc/Windows/StatisticsViewer.h b/qrenderdoc/Windows/StatisticsViewer.h index d32dd4d1e..312e731d0 100644 --- a/qrenderdoc/Windows/StatisticsViewer.h +++ b/qrenderdoc/Windows/StatisticsViewer.h @@ -37,7 +37,7 @@ class StatisticsViewer : public QFrame, public ILogViewerForm Q_OBJECT public: - explicit StatisticsViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit StatisticsViewer(CaptureContext &ctx, QWidget *parent = 0); ~StatisticsViewer(); void OnLogfileLoaded(); @@ -46,5 +46,5 @@ public: void OnEventChanged(uint32_t eventID) {} private: Ui::StatisticsViewer *ui; - CaptureContext *m_Ctx; + CaptureContext &m_Ctx; }; diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 224a46d55..76d6749c4 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -85,35 +85,35 @@ bool Following::operator==(const Following &o) return Type == o.Type && Stage == o.Stage && index == o.index; } -void Following::GetDrawContext(CaptureContext *ctx, bool ©, bool &compute) +void Following::GetDrawContext(CaptureContext &ctx, bool ©, bool &compute) { - const FetchDrawcall *curDraw = ctx->CurDrawcall(); + const FetchDrawcall *curDraw = ctx.CurDrawcall(); copy = curDraw != NULL && (curDraw->flags & (eDraw_Copy | eDraw_Resolve)); compute = curDraw != NULL && (curDraw->flags & eDraw_Dispatch) && - ctx->CurPipelineState.GetShader(eShaderStage_Compute) != ResourceId(); + ctx.CurPipelineState.GetShader(eShaderStage_Compute) != ResourceId(); } -int Following::GetHighestMip(CaptureContext *ctx) +int Following::GetHighestMip(CaptureContext &ctx) { return GetBoundResource(ctx, arrayEl).HighestMip; } -int Following::GetFirstArraySlice(CaptureContext *ctx) +int Following::GetFirstArraySlice(CaptureContext &ctx) { return GetBoundResource(ctx, arrayEl).FirstSlice; } -FormatComponentType Following::GetTypeHint(CaptureContext *ctx) +FormatComponentType Following::GetTypeHint(CaptureContext &ctx) { return GetBoundResource(ctx, arrayEl).typeHint; } -ResourceId Following::GetResourceId(CaptureContext *ctx) +ResourceId Following::GetResourceId(CaptureContext &ctx) { return GetBoundResource(ctx, arrayEl).Id; } -BoundResource Following::GetBoundResource(CaptureContext *ctx, int arrayIdx) +BoundResource Following::GetBoundResource(CaptureContext &ctx, int arrayIdx) { BoundResource ret; @@ -160,9 +160,9 @@ BoundResource Following::GetBoundResource(CaptureContext *ctx, int arrayIdx) return ret; } -QVector Following::GetOutputTargets(CaptureContext *ctx) +QVector Following::GetOutputTargets(CaptureContext &ctx) { - const FetchDrawcall *curDraw = ctx->CurDrawcall(); + const FetchDrawcall *curDraw = ctx.CurDrawcall(); bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -176,14 +176,14 @@ QVector Following::GetOutputTargets(CaptureContext *ctx) } else { - QVector ret = ctx->CurPipelineState.GetOutputTargets(); + QVector ret = ctx.CurPipelineState.GetOutputTargets(); if(ret.isEmpty() && curDraw != NULL && (curDraw->flags & eDraw_Present)) { if(curDraw->copyDestination != ResourceId()) return {BoundResource(curDraw->copyDestination)}; - for(const FetchTexture &tex : ctx->GetTextures()) + for(const FetchTexture &tex : ctx.GetTextures()) { if(tex.creationFlags & eTextureCreate_SwapBuffer) return {BoundResource(tex.ID)}; @@ -194,7 +194,7 @@ QVector Following::GetOutputTargets(CaptureContext *ctx) } } -BoundResource Following::GetDepthTarget(CaptureContext *ctx) +BoundResource Following::GetDepthTarget(CaptureContext &ctx) { bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -202,10 +202,10 @@ BoundResource Following::GetDepthTarget(CaptureContext *ctx) if(copy || compute) return BoundResource(ResourceId()); else - return ctx->CurPipelineState.GetDepthTarget(); + return ctx.CurPipelineState.GetDepthTarget(); } -QMap> Following::GetReadWriteResources(CaptureContext *ctx, +QMap> Following::GetReadWriteResources(CaptureContext &ctx, ShaderStageType stage) { bool copy = false, compute = false; @@ -219,25 +219,25 @@ QMap> Following::GetReadWriteResources(Capt { // only return compute resources for one stage if(stage == eShaderStage_Pixel || stage == eShaderStage_Compute) - return ctx->CurPipelineState.GetReadWriteResources(eShaderStage_Compute); + return ctx.CurPipelineState.GetReadWriteResources(eShaderStage_Compute); else return QMap>(); } else { - return ctx->CurPipelineState.GetReadWriteResources(stage); + return ctx.CurPipelineState.GetReadWriteResources(stage); } } -QMap> Following::GetReadWriteResources(CaptureContext *ctx) +QMap> Following::GetReadWriteResources(CaptureContext &ctx) { return GetReadWriteResources(ctx, Stage); } -QMap> Following::GetReadOnlyResources(CaptureContext *ctx, +QMap> Following::GetReadOnlyResources(CaptureContext &ctx, ShaderStageType stage) { - const FetchDrawcall *curDraw = ctx->CurDrawcall(); + const FetchDrawcall *curDraw = ctx.CurDrawcall(); bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -255,22 +255,22 @@ QMap> Following::GetReadOnlyResources(Captu { // only return compute resources for one stage if(stage == eShaderStage_Pixel || stage == eShaderStage_Compute) - return ctx->CurPipelineState.GetReadOnlyResources(eShaderStage_Compute); + return ctx.CurPipelineState.GetReadOnlyResources(eShaderStage_Compute); else return QMap>(); } else { - return ctx->CurPipelineState.GetReadOnlyResources(stage); + return ctx.CurPipelineState.GetReadOnlyResources(stage); } } -QMap> Following::GetReadOnlyResources(CaptureContext *ctx) +QMap> Following::GetReadOnlyResources(CaptureContext &ctx) { return GetReadOnlyResources(ctx, Stage); } -ShaderReflection *Following::GetReflection(CaptureContext *ctx, ShaderStageType stage) +ShaderReflection *Following::GetReflection(CaptureContext &ctx, ShaderStageType stage) { bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -278,17 +278,17 @@ ShaderReflection *Following::GetReflection(CaptureContext *ctx, ShaderStageType if(copy) return NULL; else if(compute) - return ctx->CurPipelineState.GetShaderReflection(eShaderStage_Compute); + return ctx.CurPipelineState.GetShaderReflection(eShaderStage_Compute); else - return ctx->CurPipelineState.GetShaderReflection(stage); + return ctx.CurPipelineState.GetShaderReflection(stage); } -ShaderReflection *Following::GetReflection(CaptureContext *ctx) +ShaderReflection *Following::GetReflection(CaptureContext &ctx) { return GetReflection(ctx, Stage); } -ShaderBindpointMapping Following::GetMapping(CaptureContext *ctx, ShaderStageType stage) +ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx, ShaderStageType stage) { bool copy = false, compute = false; GetDrawContext(ctx, copy, compute); @@ -305,15 +305,15 @@ ShaderBindpointMapping Following::GetMapping(CaptureContext *ctx, ShaderStageTyp } else if(compute) { - return ctx->CurPipelineState.GetBindpointMapping(eShaderStage_Compute); + return ctx.CurPipelineState.GetBindpointMapping(eShaderStage_Compute); } else { - return ctx->CurPipelineState.GetBindpointMapping(stage); + return ctx.CurPipelineState.GetBindpointMapping(stage); } } -ShaderBindpointMapping Following::GetMapping(CaptureContext *ctx) +ShaderBindpointMapping Following::GetMapping(CaptureContext &ctx) { return GetMapping(ctx, Stage); } @@ -329,9 +329,9 @@ public: }; TextureListItemModel(QObject *parent) : QAbstractItemModel(parent) {} - void reset(FilterType type, const QString &filter, CaptureContext *ctx) + void reset(FilterType type, const QString &filter, CaptureContext &ctx) { - const rdctype::array src = ctx->GetTextures(); + const rdctype::array src = ctx.GetTextures(); texs.clear(); texs.reserve(src.count); @@ -457,7 +457,7 @@ FetchTexture *TextureViewer::GetCurrentTexture() void TextureViewer::UI_UpdateCachedTexture() { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) { m_CachedTexture = NULL; return; @@ -470,15 +470,15 @@ void TextureViewer::UI_UpdateCachedTexture() if(id == ResourceId()) id = m_TexDisplay.texid; - m_CachedTexture = m_Ctx->GetTexture(id); + m_CachedTexture = m_Ctx.GetTexture(id); } -TextureViewer::TextureViewer(CaptureContext *ctx, QWidget *parent) +TextureViewer::TextureViewer(CaptureContext &ctx, QWidget *parent) : QFrame(parent), ui(new Ui::TextureViewer), m_Ctx(ctx) { ui->setupUi(this); - m_Ctx->AddLogViewer(this); + m_Ctx.AddLogViewer(this); Reset(); @@ -634,8 +634,8 @@ TextureViewer::TextureViewer(CaptureContext *ctx, QWidget *parent) TextureViewer::~TextureViewer() { - m_Ctx->windowClosed(this); - m_Ctx->RemoveLogViewer(this); + m_Ctx.windowClosed(this); + m_Ctx.RemoveLogViewer(this); delete ui; } @@ -793,7 +793,7 @@ void TextureViewer::UI_UpdateStatusText() uint32_t mipWidth = qMax(1U, tex.width >> (int)m_TexDisplay.mip); uint32_t mipHeight = qMax(1U, tex.height >> (int)m_TexDisplay.mip); - if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) y = (int)(mipHeight - 1) - y; if(m_TexDisplay.FlipY) y = (int)(mipHeight - 1) - y; @@ -822,7 +822,7 @@ void TextureViewer::UI_UpdateStatusText() { x = m_PickedPoint.x() >> (int)m_TexDisplay.mip; y = m_PickedPoint.y() >> (int)m_TexDisplay.mip; - if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) y = (int)(mipHeight - 1) - y; if(m_TexDisplay.FlipY) y = (int)(mipHeight - 1) - y; @@ -896,7 +896,7 @@ void TextureViewer::UI_UpdateStatusText() if(m_Output != NULL) { - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *) { m_Output->DisablePixelContext(); }); + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *) { m_Output->DisablePixelContext(); }); } // PixelPicked = false; @@ -933,8 +933,8 @@ void TextureViewer::UI_UpdateTextureDetails() ResourceId followID = m_Following.GetResourceId(m_Ctx); { - FetchTexture *followtex = m_Ctx->GetTexture(followID); - FetchBuffer *followbuf = m_Ctx->GetBuffer(followID); + FetchTexture *followtex = m_Ctx.GetTexture(followID); + FetchBuffer *followbuf = m_Ctx.GetBuffer(followID); QString title; @@ -1027,7 +1027,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) bool newtex = (m_TexDisplay.texid != tex.ID); // save settings for this current texture - if(m_Ctx->Config.TextureViewer_PerTexSettings) + if(m_Ctx.Config.TextureViewer_PerTexSettings) { m_TextureSettings[m_TexDisplay.texid].r = ui->channelRed->isChecked(); m_TextureSettings[m_TexDisplay.texid].g = ui->channelGreen->isChecked(); @@ -1220,7 +1220,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) // even if we don't switch to a new texture. // Note that if the slice or mip was changed because that slice or mip is the selected one // at the API level, we leave this alone. - if(m_Ctx->Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID)) + if(m_Ctx.Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID)) { if(usemipsettings) ui->mipLevel->setCurrentIndex(m_TextureSettings[tex.ID].mip); @@ -1233,7 +1233,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) if(newtex) { // if we save certain settings per-texture, restore them (if we have any) - if(m_Ctx->Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID)) + if(m_Ctx.Config.TextureViewer_PerTexSettings && m_TextureSettings.contains(tex.ID)) { ui->channels->setCurrentIndex(m_TextureSettings[tex.ID].displayType); @@ -1252,7 +1252,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) m_TextureSettings[m_TexDisplay.texid].maxrange); m_NoRangePaint = false; } - else if(m_Ctx->Config.TextureViewer_PerTexSettings) + else if(m_Ctx.Config.TextureViewer_PerTexSettings) { // if we are using per-tex settings, reset back to RGB ui->channels->setCurrentIndex(0); @@ -1273,7 +1273,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) } // reset the range if desired - if(m_Ctx->Config.TextureViewer_ResetRange) + if(m_Ctx.Config.TextureViewer_ResetRange) { UI_SetHistogramRange(texptr, m_TexDisplay.typeHint); } @@ -1286,7 +1286,7 @@ void TextureViewer::UI_OnTextureSelectionChanged(bool newdraw) if(ui->autoFit->isChecked()) AutoFitRange(); - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { RT_UpdateVisualRange(r); RT_UpdateAndDisplay(r); @@ -1383,7 +1383,7 @@ void TextureViewer::UI_UpdateChannels() } m_TexDisplay.CustomShader = ResourceId(); } - else if(ui->channels->currentIndex() == 0 || !m_Ctx->LogLoaded()) + else if(ui->channels->currentIndex() == 0 || !m_Ctx.LogLoaded()) { // RGBA SHOW(ui->channelRed); @@ -1618,7 +1618,7 @@ void TextureViewer::UI_CreateThumbnails() void TextureViewer::GotoLocation(int x, int y) { - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; FetchTexture *tex = GetCurrentTexture(); @@ -1629,7 +1629,7 @@ void TextureViewer::GotoLocation(int x, int y) m_PickedPoint = QPoint(x, y); uint32_t mipHeight = qMax(1U, tex->height >> (int)m_TexDisplay.mip); - if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.y()); if(m_TexDisplay.FlipY) m_PickedPoint.setY((int)(mipHeight - 1) - m_PickedPoint.x()); @@ -1666,7 +1666,7 @@ void TextureViewer::ViewTexture(ResourceId ID, bool focus) return; } - FetchTexture *tex = m_Ctx->GetTexture(ID); + FetchTexture *tex = m_Ctx.GetTexture(ID); if(tex) { QWidget *lockedContainer = new QWidget(this); @@ -1703,14 +1703,14 @@ void TextureViewer::ViewTexture(ResourceId ID, bool focus) return; } - FetchBuffer *buf = m_Ctx->GetBuffer(ID); + FetchBuffer *buf = m_Ctx.GetBuffer(ID); if(buf) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewTexture(0, 0, ID); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -1726,7 +1726,7 @@ void TextureViewer::texContextItem_triggered() QVariant eid = act->property("eid"); if(eid.isValid()) { - m_Ctx->SetEventID({}, eid.toUInt(), eid.toUInt()); + m_Ctx.SetEventID({}, eid.toUInt(), eid.toUInt()); return; } @@ -1742,16 +1742,16 @@ void TextureViewer::showDisabled_triggered() { m_ShowDisabled = !m_ShowDisabled; - if(m_Ctx->LogLoaded()) - m_Ctx->RefreshStatus(); + if(m_Ctx.LogLoaded()) + m_Ctx.RefreshStatus(); } void TextureViewer::showEmpty_triggered() { m_ShowEmpty = !m_ShowEmpty; - if(m_Ctx->LogLoaded()) - m_Ctx->RefreshStatus(); + if(m_Ctx.LogLoaded()) + m_Ctx.RefreshStatus(); } void TextureViewer::AddResourceUsageEntry(QMenu &menu, uint32_t start, uint32_t end, @@ -1761,10 +1761,10 @@ void TextureViewer::AddResourceUsageEntry(QMenu &menu, uint32_t start, uint32_t if(start == end) item = new QAction( - "EID " + QString::number(start) + ": " + ToQStr(usage, m_Ctx->APIProps().pipelineType), this); + "EID " + QString::number(start) + ": " + ToQStr(usage, m_Ctx.APIProps().pipelineType), this); else item = new QAction("EID " + QString::number(start) + "-" + QString::number(end) + ": " + - ToQStr(usage, m_Ctx->APIProps().pipelineType), + ToQStr(usage, m_Ctx.APIProps().pipelineType), this); QObject::connect(item, &QAction::triggered, this, &TextureViewer::texContextItem_triggered); @@ -1796,10 +1796,10 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array< QObject::connect(&showDisabled, &QAction::triggered, this, &TextureViewer::showDisabled_triggered); QObject::connect(&showEmpty, &QAction::triggered, this, &TextureViewer::showEmpty_triggered); - if(m_Ctx->CurPipelineState.SupportsBarriers()) + if(m_Ctx.CurPipelineState.SupportsBarriers()) { contextMenu.addSeparator(); - imageLayout.setText(tr("Image is in layout ") + m_Ctx->CurPipelineState.GetImageLayout(id)); + imageLayout.setText(tr("Image is in layout ") + m_Ctx.CurPipelineState.GetImageLayout(id)); contextMenu.addAction(&imageLayout); } @@ -1828,7 +1828,7 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array< continue; } - const FetchDrawcall *curDraw = m_Ctx->GetDrawcall(u.eventID); + const FetchDrawcall *curDraw = m_Ctx.GetDrawcall(u.eventID); bool distinct = false; @@ -1844,13 +1844,13 @@ void TextureViewer::OpenResourceContextMenu(ResourceId id, const rdctype::array< // last event was where we were - otherwise it's a new // distinct set of drawcalls and should have a separate // entry in the context menu - const FetchDrawcall *prev = m_Ctx->GetDrawcall(curDraw->previous); + const FetchDrawcall *prev = m_Ctx.GetDrawcall(curDraw->previous); while(prev != NULL && prev->eventID > end) { if((prev->flags & (eDraw_Dispatch | eDraw_Drawcall | eDraw_CmdList)) == 0) { - prev = m_Ctx->GetDrawcall(prev->previous); + prev = m_Ctx.GetDrawcall(prev->previous); } else { @@ -1890,8 +1890,8 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, { if(id != ResourceId() || force) { - FetchTexture *texptr = m_Ctx->GetTexture(id); - FetchBuffer *bufptr = m_Ctx->GetBuffer(id); + FetchTexture *texptr = m_Ctx.GetTexture(id); + FetchBuffer *bufptr = m_Ctx.GetBuffer(id); if(texptr != NULL) { @@ -1907,8 +1907,8 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, prev->setResourceName(fullname); WId handle = prev->thumbWinId(); - m_Ctx->Renderer()->AsyncInvoke([this, handle, id, typeHint](IReplayRenderer *) { - m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle), id, typeHint); + m_Ctx.Renderer().AsyncInvoke([this, handle, id, typeHint](IReplayRenderer *) { + m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), id, typeHint); }); } else if(bufptr != NULL) @@ -1925,18 +1925,18 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, prev->setResourceName(fullname); WId handle = prev->thumbWinId(); - m_Ctx->Renderer()->AsyncInvoke([this, handle](IReplayRenderer *) { - m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle), - ResourceId(), eCompType_None); + m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) { + m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(), + eCompType_None); }); } else { prev->setResourceName(""); WId handle = prev->thumbWinId(); - m_Ctx->Renderer()->AsyncInvoke([this, handle](IReplayRenderer *) { - m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle), - ResourceId(), eCompType_None); + m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) { + m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(), + eCompType_None); }); } @@ -1952,8 +1952,8 @@ void TextureViewer::InitResourcePreview(ResourcePreview *prev, ResourceId id, prev->setSelected(true); WId handle = prev->thumbWinId(); - m_Ctx->Renderer()->AsyncInvoke([this, handle](IReplayRenderer *) { - m_Output->AddThumbnail(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(handle), ResourceId(), + m_Ctx.Renderer().AsyncInvoke([this, handle](IReplayRenderer *) { + m_Output->AddThumbnail(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(handle), ResourceId(), eCompType_None); }); } @@ -2025,7 +2025,7 @@ void TextureViewer::InitStageResourcePreviews(ShaderStageType stage, Following follow(rw ? FollowType::ReadWrite : FollowType::ReadOnly, stage, idx, arrayIdx); QString slotName = - QString("%1 %2%3").arg(m_Ctx->CurPipelineState.Abbrev(stage)).arg(rw ? "RW " : "").arg(idx); + QString("%1 %2%3").arg(m_Ctx.CurPipelineState.Abbrev(stage)).arg(rw ? "RW " : "").arg(idx); if(arrayLen > 1) slotName += QString("[%1]").arg(arrayIdx); @@ -2129,7 +2129,7 @@ void TextureViewer::thumb_clicked(QMouseEvent *e) } else { - m_Ctx->Renderer()->AsyncInvoke([this, id](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this, id](IReplayRenderer *r) { rdctype::array usage; r->GetUsage(id, &usage); @@ -2245,7 +2245,7 @@ void TextureViewer::render_keyPress(QKeyEvent *e) clipboard->setText(ui->texStatusDim->text() + " | " + ui->statusText->text()); } - if(!m_Ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) return; if((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_G) @@ -2284,7 +2284,7 @@ void TextureViewer::render_keyPress(QKeyEvent *e) qBound(0, m_PickedPoint.y(), (int)texptr->height - 1)); e->accept(); - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { RT_PickPixelsAndUpdate(r); RT_UpdateAndDisplay(r); }); @@ -2418,10 +2418,10 @@ void TextureViewer::on_renderVScroll_valueChanged(int position) void TextureViewer::UI_RecreatePanels() { - CaptureContext *ctx = m_Ctx; + CaptureContext *ctx = &m_Ctx; // while a log is loaded, pass NULL into the widget - if(!ctx->LogLoaded()) + if(!m_Ctx.LogLoaded()) ctx = NULL; { @@ -2476,11 +2476,11 @@ void TextureViewer::OnLogfileLoaded() m_TexDisplay.lightBackgroundColour = FloatVector(lightBack.redF(), lightBack.greenF(), lightBack.blueF(), 1.0f); - m_Ctx->Renderer()->BlockInvoke([renderID, contextID, this](IReplayRenderer *r) { - m_Output = r->CreateOutput(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(renderID), + m_Ctx.Renderer().BlockInvoke([renderID, contextID, this](IReplayRenderer *r) { + m_Output = r->CreateOutput(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(renderID), eOutputType_TexDisplay); - m_Output->SetPixelContext(m_Ctx->m_CurWinSystem, m_Ctx->FillWindowingData(contextID)); + m_Output->SetPixelContext(m_Ctx.m_CurWinSystem, m_Ctx.FillWindowingData(contextID)); ui->render->setOutput(m_Output); ui->pixelContext->setOutput(m_Output); @@ -2490,7 +2490,7 @@ void TextureViewer::OnLogfileLoaded() RT_UpdateAndDisplay(r); - GUIInvoke::call([this]() { OnEventChanged(m_Ctx->CurEvent()); }); + GUIInvoke::call([this]() { OnEventChanged(m_Ctx.CurEvent()); }); }); } @@ -2589,7 +2589,7 @@ void TextureViewer::OnEventChanged(uint32_t eventID) Following follow(FollowType::OutputColour, eShaderStage_Pixel, rt, 0); QString bindName = copy ? tr("Destination") : ""; QString slotName = - copy ? tr("DST") : (m_Ctx->CurPipelineState.OutputAbbrev() + QString::number(rt)); + copy ? tr("DST") : (m_Ctx.CurPipelineState.OutputAbbrev() + QString::number(rt)); InitResourcePreview(prev, RTs[rt].Id, RTs[rt].typeHint, false, follow, bindName, slotName); } @@ -2953,10 +2953,10 @@ void TextureViewer::on_visualiseRange_clicked() void TextureViewer::AutoFitRange() { // no log loaded or buffer/empty texture currently being viewed - don't autofit - if(!m_Ctx->LogLoaded() || GetCurrentTexture() == NULL || m_Output == NULL) + if(!m_Ctx.LogLoaded() || GetCurrentTexture() == NULL || m_Output == NULL) return; - m_Ctx->Renderer()->AsyncInvoke([this](IReplayRenderer *r) { + m_Ctx.Renderer().AsyncInvoke([this](IReplayRenderer *r) { PixelValue min, max; bool success = m_Output->GetMinMax(&min, &max); @@ -3168,7 +3168,7 @@ void TextureViewer::ShowGotoPopup() uint32_t mipHeight = qMax(1U, texptr->height >> (int)m_TexDisplay.mip); - if(m_Ctx->APIProps().pipelineType == eGraphicsAPI_OpenGL) + if(m_Ctx.APIProps().pipelineType == eGraphicsAPI_OpenGL) p.setY((int)(mipHeight - 1) - p.y()); if(m_TexDisplay.FlipY) p.setY((int)(mipHeight - 1) - p.y()); @@ -3183,11 +3183,11 @@ void TextureViewer::on_viewTexBuffer_clicked() if(texptr) { - BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx->mainWindow()); + BufferViewer *viewer = new BufferViewer(m_Ctx, false, m_Ctx.mainWindow()); viewer->ViewTexture(m_TexDisplay.sliceFace, m_TexDisplay.mip, texptr->ID); - m_Ctx->setupDockWindow(viewer); + m_Ctx.setupDockWindow(viewer); ToolWindowManager *manager = ToolWindowManager::managerOf(this); @@ -3234,7 +3234,7 @@ void TextureViewer::on_saveTex_clicked() if(m_TexDisplay.CustomShader != ResourceId()) { ResourceId id; - m_Ctx->Renderer()->BlockInvoke( + m_Ctx.Renderer().BlockInvoke( [this, &id](IReplayRenderer *r) { id = m_Output->GetCustomShaderTexID(); }); if(id != ResourceId()) @@ -3251,7 +3251,7 @@ void TextureViewer::on_saveTex_clicked() bool ret = false; QString fn = saveDialog.filename(); - m_Ctx->Renderer()->BlockInvoke([this, &ret, config, fn](IReplayRenderer *r) { + m_Ctx.Renderer().BlockInvoke([this, &ret, config, fn](IReplayRenderer *r) { ret = r->SaveTexture(config, fn.toUtf8().data()); }); diff --git a/qrenderdoc/Windows/TextureViewer.h b/qrenderdoc/Windows/TextureViewer.h index aa41392fd..d5d007fcd 100644 --- a/qrenderdoc/Windows/TextureViewer.h +++ b/qrenderdoc/Windows/TextureViewer.h @@ -61,34 +61,34 @@ struct Following bool operator==(const Following &o); bool operator!=(const Following &o); - static void GetDrawContext(CaptureContext *ctx, bool ©, bool &compute); + static void GetDrawContext(CaptureContext &ctx, bool ©, bool &compute); - int GetHighestMip(CaptureContext *ctx); - int GetFirstArraySlice(CaptureContext *ctx); - FormatComponentType GetTypeHint(CaptureContext *ctx); + int GetHighestMip(CaptureContext &ctx); + int GetFirstArraySlice(CaptureContext &ctx); + FormatComponentType GetTypeHint(CaptureContext &ctx); - ResourceId GetResourceId(CaptureContext *ctx); - BoundResource GetBoundResource(CaptureContext *ctx, int arrayIdx); + ResourceId GetResourceId(CaptureContext &ctx); + BoundResource GetBoundResource(CaptureContext &ctx, int arrayIdx); - static QVector GetOutputTargets(CaptureContext *ctx); + static QVector GetOutputTargets(CaptureContext &ctx); - static BoundResource GetDepthTarget(CaptureContext *ctx); + static BoundResource GetDepthTarget(CaptureContext &ctx); - QMap> GetReadWriteResources(CaptureContext *ctx); + QMap> GetReadWriteResources(CaptureContext &ctx); - static QMap> GetReadWriteResources(CaptureContext *ctx, + static QMap> GetReadWriteResources(CaptureContext &ctx, ShaderStageType stage); - QMap> GetReadOnlyResources(CaptureContext *ctx); + QMap> GetReadOnlyResources(CaptureContext &ctx); - static QMap> GetReadOnlyResources(CaptureContext *ctx, + static QMap> GetReadOnlyResources(CaptureContext &ctx, ShaderStageType stage); - ShaderReflection *GetReflection(CaptureContext *ctx); - static ShaderReflection *GetReflection(CaptureContext *ctx, ShaderStageType stage); + ShaderReflection *GetReflection(CaptureContext &ctx); + static ShaderReflection *GetReflection(CaptureContext &ctx, ShaderStageType stage); - ShaderBindpointMapping GetMapping(CaptureContext *ctx); - static ShaderBindpointMapping GetMapping(CaptureContext *ctx, ShaderStageType stage); + ShaderBindpointMapping GetMapping(CaptureContext &ctx); + static ShaderBindpointMapping GetMapping(CaptureContext &ctx, ShaderStageType stage); }; struct TexSettings @@ -121,7 +121,7 @@ private: Q_PROPERTY(QVariant persistData READ persistData WRITE setPersistData DESIGNABLE false SCRIPTABLE false) public: - explicit TextureViewer(CaptureContext *ctx, QWidget *parent = 0); + explicit TextureViewer(CaptureContext &ctx, QWidget *parent = 0); ~TextureViewer(); void OnLogfileLoaded(); @@ -287,7 +287,7 @@ private: TextureGoto *m_Goto; Ui::TextureViewer *ui; - CaptureContext *m_Ctx = NULL; + CaptureContext &m_Ctx; IReplayOutput *m_Output = NULL; FetchTexture *m_CachedTexture;