From 0f2f359eef006413aeef0cfab1cfd00c2caeec3b Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 16 Jun 2017 15:50:10 +0100 Subject: [PATCH] Don't count resolve attachments, when looking at color load/store ops --- .../driver/vulkan/wrappers/vk_cmd_funcs.cpp | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index 9a4edea8a..b73342279 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -202,9 +202,10 @@ string WrappedVulkan::MakeRenderPassOpString(bool store) { bool colsame = true; + uint32_t subpass = m_BakedCmdBufferInfo[m_LastCmdBufferID].state.subpass; + // find which attachment is the depth-stencil one - int32_t dsAttach = - info.subpasses[m_BakedCmdBufferInfo[m_LastCmdBufferID].state.subpass].depthstencilAttachment; + int32_t dsAttach = info.subpasses[subpass].depthstencilAttachment; bool hasStencil = false; bool depthonly = false; @@ -213,33 +214,28 @@ string WrappedVulkan::MakeRenderPassOpString(bool store) if(dsAttach >= 0) { hasStencil = !IsDepthOnlyFormat(fbinfo.attachments[dsAttach].format); - depthonly = info.subpasses[m_BakedCmdBufferInfo[m_LastCmdBufferID].state.subpass] - .colorAttachments.size() == 0; + depthonly = info.subpasses[subpass].colorAttachments.size() == 0; } + const std::vector &cols = info.subpasses[subpass].colorAttachments; + // first colour attachment, if there is one - int32_t colAttach = 0; - if(!depthonly && dsAttach == 0) - colAttach = 1; + const uint32_t col0 = cols.empty() ? (uint32_t)atts.size() : cols[0]; // look through all other non-depth attachments to see if they're // identical - for(size_t i = 0; i < atts.size(); i++) + for(size_t i = 1; i < cols.size(); i++) { - if((int32_t)i == dsAttach) - continue; - - if((int32_t)i == colAttach) - continue; + const uint32_t col = cols[i]; if(store) { - if(atts[i].storeOp != atts[colAttach].storeOp) + if(atts[col].storeOp != atts[col0].storeOp) colsame = false; } else { - if(atts[i].loadOp != atts[colAttach].loadOp) + if(atts[col].loadOp != atts[col0].loadOp) colsame = false; } } @@ -259,7 +255,7 @@ string WrappedVulkan::MakeRenderPassOpString(bool store) else { // all colour ops are the same, print it - opDesc = store ? ToStr::Get(atts[colAttach].storeOp) : ToStr::Get(atts[colAttach].loadOp); + opDesc = store ? ToStr::Get(atts[col0].storeOp) : ToStr::Get(atts[col0].loadOp); } // do we have depth?