From 96afe779142c34164362b0657db3f8d64467640b Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 21 Apr 2021 13:57:24 +0100 Subject: [PATCH] Disable hover pipeline thumbnails on remote replay * Most remote replay links are slow enough that the lag introduced by synchronously fetching and displaying these thumbnails would be annoying for simple mouse-over scenarios. --- .../PipelineState/PipelineStateViewer.cpp | 39 +++++++++++++------ renderdoc/api/replay/data_types.h | 4 ++ renderdoc/core/replay_proxy.cpp | 3 ++ 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp index 6b8fe9aba..dfdf56b0b 100644 --- a/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/PipelineStateViewer.cpp @@ -100,16 +100,16 @@ RDPreviewTooltip::RDPreviewTooltip(PipelineStateViewer *parent, CustomPaintWidge QHBoxLayout *hbox = new QHBoxLayout; QVBoxLayout *vbox = new QVBoxLayout; - label = new QLabel(this); + hbox->setSpacing(0); + hbox->setContentsMargins(0, 0, 0, 0); + vbox->setSpacing(2); + vbox->setContentsMargins(6, 3, 6, 3); - label->setMargin(margin + 1); + label = new QLabel(this); label->setAlignment(Qt::AlignLeft); - label->setIndent(1); title = new QLabel(this); - title->setMargin(margin + 1); title->setAlignment(Qt::AlignLeft); - title->setIndent(1); setLayout(vbox); vbox->addWidget(title); @@ -236,23 +236,32 @@ void PipelineStateViewer::OnCaptureLoaded() if(m_Current) m_Current->OnCaptureLoaded(); - WindowingData thumbData = ui->thumbnail->GetWidgetWindowingData(); + if(!m_Ctx.APIProps().remoteReplay) + { + WindowingData thumbData = ui->thumbnail->GetWidgetWindowingData(); - m_Ctx.Replay().BlockInvoke([thumbData, this](IReplayController *r) { - m_Output = r->CreateOutput(thumbData, ReplayOutputType::Texture); + m_Ctx.Replay().BlockInvoke([thumbData, this](IReplayController *r) { + m_Output = r->CreateOutput(thumbData, ReplayOutputType::Texture); - ui->thumbnail->SetOutput(m_Output); + ui->thumbnail->SetOutput(m_Output); - RT_UpdateAndDisplay(r); - }); + RT_UpdateAndDisplay(r); + }); + } + else + { + m_Output = NULL; + } } void PipelineStateViewer::RT_UpdateAndDisplay(IReplayController *r) { if(m_Output != NULL) + { m_Output->SetTextureDisplay(m_TexDisplay); - GUIInvoke::call(this, [this]() { ui->thumbnail->update(); }); + GUIInvoke::call(this, [this]() { ui->thumbnail->update(); }); + } } void PipelineStateViewer::OnCaptureClosed() @@ -1195,6 +1204,9 @@ ResourceId PipelineStateViewer::updateThumbnail(QWidget *widget, QModelIndex idx { ResourceId id; + if(!m_Output) + return id; + RDTreeWidget *treeWidget = qobject_cast(widget); if(treeWidget) { @@ -1237,6 +1249,9 @@ ResourceId PipelineStateViewer::updateThumbnail(QWidget *widget, QModelIndex idx bool PipelineStateViewer::hasThumbnail(QWidget *widget, QModelIndex idx) { + if(!m_Output) + return false; + RDTreeWidget *treeWidget = qobject_cast(widget); if(treeWidget) { diff --git a/renderdoc/api/replay/data_types.h b/renderdoc/api/replay/data_types.h index 297b1c206..59f5dbe6c 100644 --- a/renderdoc/api/replay/data_types.h +++ b/renderdoc/api/replay/data_types.h @@ -1712,6 +1712,10 @@ different to the above, and lets the UI make decisions e.g. to flip rendering of DOCUMENT("The :class:`GPUVendor` of the active GPU being used."); GPUVendor vendor = GPUVendor::Unknown; + DOCUMENT(R"(``True`` if the capture is being replayed over a remote connection. +)"); + bool remoteReplay = false; + DOCUMENT(R"(``True`` if the capture was loaded successfully but running in a degraded mode - e.g. with software rendering, or with some functionality disabled due to lack of support. )"); diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 8af8fbe9f..3f3cee069 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -287,7 +287,10 @@ APIProperties ReplayProxy::Proxied_GetAPIProperties(ParamSerialiser ¶mser, SERIALISE_RETURN(ret); if(!m_RemoteServer) + { ret.localRenderer = m_Proxy->GetAPIProperties().localRenderer; + ret.remoteReplay = true; + } m_APIProps = ret;