From 40f83cfbfd296d85a10223cc2bca955ea5bccecb Mon Sep 17 00:00:00 2001 From: baldurk Date: Wed, 20 Jan 2021 16:35:29 +0000 Subject: [PATCH] Fix lag in updating texture viewer display when selecting new draws --- qrenderdoc/Windows/TextureViewer.cpp | 43 ++++++++++++++++------------ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 033508780..bd10a8af5 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -3094,6 +3094,30 @@ void TextureViewer::OnCaptureClosed() void TextureViewer::OnEventChanged(uint32_t eventId) { + bool copy = false, clear = false, compute = false; + Following::GetDrawContext(m_Ctx, copy, clear, compute); + + ShaderStage stages[] = {ShaderStage::Vertex, ShaderStage::Hull, ShaderStage::Domain, + ShaderStage::Geometry, ShaderStage::Pixel}; + + int count = 5; + + if(compute) + { + stages[0] = ShaderStage::Compute; + count = 1; + } + + for(int i = 0; i < count; i++) + { + ShaderStage stage = stages[i]; + + m_ReadWriteResources[(uint32_t)stage] = + Following::GetReadWriteResources(m_Ctx, stage, !m_ShowUnused); + m_ReadOnlyResources[(uint32_t)stage] = + Following::GetReadOnlyResources(m_Ctx, stage, !m_ShowUnused); + } + UI_UpdateCachedTexture(); TextureDescription *CurrentTexture = GetCurrentTexture(); @@ -3131,9 +3155,6 @@ void TextureViewer::OnEventChanged(uint32_t eventId) ui->outputThumbs->setUpdatesEnabled(false); ui->inputThumbs->setUpdatesEnabled(false); - bool copy = false, clear = false, compute = false; - Following::GetDrawContext(m_Ctx, copy, clear, compute); - for(int rt = 0; rt < RTs.count(); rt++) { ResourcePreview *prev; @@ -3170,17 +3191,6 @@ void TextureViewer::OnEventChanged(uint32_t eventId) InitResourcePreview(prev, Depth, false, follow, QString(), tr("DS")); } - ShaderStage stages[] = {ShaderStage::Vertex, ShaderStage::Hull, ShaderStage::Domain, - ShaderStage::Geometry, ShaderStage::Pixel}; - - int count = 5; - - if(compute) - { - stages[0] = ShaderStage::Compute; - count = 1; - } - const rdcarray empty; // display resources used for all stages @@ -3188,11 +3198,6 @@ void TextureViewer::OnEventChanged(uint32_t eventId) { ShaderStage stage = stages[i]; - m_ReadWriteResources[(uint32_t)stage] = - Following::GetReadWriteResources(m_Ctx, stage, !m_ShowUnused); - m_ReadOnlyResources[(uint32_t)stage] = - Following::GetReadOnlyResources(m_Ctx, stage, !m_ShowUnused); - const ShaderReflection *details = Following::GetReflection(m_Ctx, stage); const ShaderBindpointMapping &mapping = Following::GetMapping(m_Ctx, stage);