From 1a268ace8b319eb5a9264983d7766b970f3ed6a9 Mon Sep 17 00:00:00 2001 From: Baldur Karlsson Date: Mon, 12 Mar 2018 12:35:35 +0000 Subject: [PATCH] Add async tags for display widget painting * This prevents widget painting from getting out of control and queuing up many redundant paints which slows down processing of the command queue. * Also remove a spammy command to disable pixel context that only ever got called when pixel context was already disabled (right after a reset - at all other times it stays active). --- qrenderdoc/Widgets/CustomPaintWidget.cpp | 4 +++- qrenderdoc/Widgets/CustomPaintWidget.h | 1 + qrenderdoc/Windows/BufferViewer.cpp | 3 ++- qrenderdoc/Windows/TextureViewer.cpp | 9 --------- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/qrenderdoc/Widgets/CustomPaintWidget.cpp b/qrenderdoc/Widgets/CustomPaintWidget.cpp index da67bf4cd..e543bba9e 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.cpp +++ b/qrenderdoc/Widgets/CustomPaintWidget.cpp @@ -33,6 +33,7 @@ CustomPaintWidget::CustomPaintWidget(QWidget *parent) : QWidget(parent) m_Output = NULL; setAttribute(Qt::WA_OpaquePaintEvent); setMouseTracking(true); + m_Tag = QFormatStr("custompaint%1").arg((uintptr_t) this); } CustomPaintWidget::CustomPaintWidget(ICaptureContext *c, QWidget *parent) : QWidget(parent) @@ -43,6 +44,7 @@ CustomPaintWidget::CustomPaintWidget(ICaptureContext *c, QWidget *parent) : QWid if(c) setAttribute(Qt::WA_PaintOnScreen); setMouseTracking(true); + m_Tag = QFormatStr("custompaint%1").arg((uintptr_t) this); } CustomPaintWidget::~CustomPaintWidget() @@ -89,7 +91,7 @@ void CustomPaintWidget::paintEvent(QPaintEvent *e) if(m_Ctx) { if(m_Output != NULL) - m_Ctx->Replay().AsyncInvoke([this](IReplayController *r) { m_Output->Display(); }); + m_Ctx->Replay().AsyncInvoke(m_Tag, [this](IReplayController *r) { m_Output->Display(); }); } else if(m_Dark == m_Light) { diff --git a/qrenderdoc/Widgets/CustomPaintWidget.h b/qrenderdoc/Widgets/CustomPaintWidget.h index 85815fc78..9bfcda35b 100644 --- a/qrenderdoc/Widgets/CustomPaintWidget.h +++ b/qrenderdoc/Widgets/CustomPaintWidget.h @@ -76,6 +76,7 @@ protected: QPaintEngine *paintEngine() const override { return m_Ctx ? NULL : QWidget::paintEngine(); } ICaptureContext *m_Ctx; IReplayOutput *m_Output; + QString m_Tag; QColor m_Dark; QColor m_Light; }; diff --git a/qrenderdoc/Windows/BufferViewer.cpp b/qrenderdoc/Windows/BufferViewer.cpp index a615bc10a..11aa8b62b 100644 --- a/qrenderdoc/Windows/BufferViewer.cpp +++ b/qrenderdoc/Windows/BufferViewer.cpp @@ -2705,8 +2705,9 @@ void BufferViewer::RT_UpdateAndDisplay(IReplayController *) { m_Config.cam = m_CurrentCamera->camera(); m_Output->SetMeshDisplay(m_Config); - m_Output->Display(); } + + GUIInvoke::call([this]() { ui->render->update(); }); } RDTableView *BufferViewer::tableForStage(MeshDataStage stage) diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 8fdc67a75..a0a197877 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -943,19 +943,10 @@ void TextureViewer::UI_UpdateStatusText() if(m_TexDisplay.customShaderId != ResourceId()) statusText += lit(")"); - - // PixelPicked = true; } else { statusText += tr(" - Right click to pick a pixel"); - - if(m_Output != NULL) - { - m_Ctx.Replay().AsyncInvoke([this](IReplayController *) { m_Output->DisablePixelContext(); }); - } - - // PixelPicked = false; } // try and keep status text consistent by sticking to the high water mark