From 627d23b9370d530f40b4f3698b8ad960ea890acb Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 31 Jan 2018 18:15:55 +0000 Subject: [PATCH] Recreate proxy preview window if it's out of date --- renderdoc/core/replay_proxy.cpp | 24 ++++++++++++++++++++---- renderdoc/core/replay_proxy.h | 2 ++ 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/renderdoc/core/replay_proxy.cpp b/renderdoc/core/replay_proxy.cpp index 469c64dc6..bad34b05a 100644 --- a/renderdoc/core/replay_proxy.cpp +++ b/renderdoc/core/replay_proxy.cpp @@ -1860,13 +1860,29 @@ const DrawcallDescription *ReplayProxy::FindDraw(const rdcarrayGetSupportedWindowSystems()); - if(data.system != WindowingSystem::Unknown) - m_PreviewOutput = m_Replay->MakeOutputWindow(data, false); - m_FrameRecord = m_Replay->GetFrameRecord(); + if(data.system != WindowingSystem::Unknown) + { + // if the data has changed, destroy the old window so we'll recreate + if(m_PreviewWindow == 0 || memcmp(&m_PreviewWindowingData, &data, sizeof(data))) + { + if(m_PreviewWindow) + { + RDCDEBUG("Re-creating preview window due to change in data"); + m_Replay->DestroyOutputWindow(m_PreviewOutput); + } + + m_PreviewOutput = m_Replay->MakeOutputWindow(data, false); + + m_PreviewWindowingData = data; + } + } + + if(m_FrameRecord.drawcallList.empty()) + m_FrameRecord = m_Replay->GetFrameRecord(); } } diff --git a/renderdoc/core/replay_proxy.h b/renderdoc/core/replay_proxy.h index 7883ff1b3..9331d92ac 100644 --- a/renderdoc/core/replay_proxy.h +++ b/renderdoc/core/replay_proxy.h @@ -634,6 +634,8 @@ private: // the ID of the output window to use for previewing on the remote host. Only valid/useful if // m_Replay is set uint64_t m_PreviewOutput = 0; + // The previous windowing data, so we can detect changes and recreate the window + WindowingData m_PreviewWindowingData; uint32_t m_PreviewEvent = 0;