From ba067178422997f45c2396bff598cb7cfd327e0e Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 21 Jan 2021 11:30:50 +0000 Subject: [PATCH] Don't fetch resource lists for unbound shader stages * This is a minor optimisation when there are large numbers of bound resources that are available (duplicated) to all shader stages. There's no point fetching them when there's no shader bound there. --- qrenderdoc/Windows/TextureViewer.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/qrenderdoc/Windows/TextureViewer.cpp b/qrenderdoc/Windows/TextureViewer.cpp index 12c504b92..36e21654c 100644 --- a/qrenderdoc/Windows/TextureViewer.cpp +++ b/qrenderdoc/Windows/TextureViewer.cpp @@ -3116,10 +3116,19 @@ 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 ShaderBindpointMapping &mapping = Following::GetMapping(m_Ctx, stage); + + if(!mapping.readOnlyResources.empty()) + m_ReadOnlyResources[(uint32_t)stage] = + Following::GetReadOnlyResources(m_Ctx, stage, !m_ShowUnused); + else + m_ReadOnlyResources[(uint32_t)stage].clear(); + + if(!mapping.readWriteResources.empty()) + m_ReadWriteResources[(uint32_t)stage] = + Following::GetReadWriteResources(m_Ctx, stage, !m_ShowUnused); + else + m_ReadWriteResources[(uint32_t)stage].clear(); } UI_UpdateCachedTexture();