From 747afa7b74ef6b8324c91194626b9fc9a8343092 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 22 Jun 2017 12:41:15 +0100 Subject: [PATCH] Handle subpasses with all color attachments being UNUSED. Refs #670 --- .../driver/vulkan/wrappers/vk_cmd_funcs.cpp | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index b73342279..d875fa9ac 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -219,15 +219,27 @@ string WrappedVulkan::MakeRenderPassOpString(bool store) const std::vector &cols = info.subpasses[subpass].colorAttachments; - // first colour attachment, if there is one - const uint32_t col0 = cols.empty() ? (uint32_t)atts.size() : cols[0]; + // we check all non-UNUSED attachments to see if they're all the same. + // To begin with we point to an invalid attachment index + uint32_t col0 = VK_ATTACHMENT_UNUSED; - // look through all other non-depth attachments to see if they're - // identical - for(size_t i = 1; i < cols.size(); i++) + // look through all other color attachments to see if they're identical + for(size_t i = 0; i < cols.size(); i++) { const uint32_t col = cols[i]; + // skip unused attachments + if(col == VK_ATTACHMENT_UNUSED) + continue; + + // the first valid attachment we find, use that as our reference point + if(col0 == VK_ATTACHMENT_UNUSED) + { + col0 = col; + continue; + } + + // for any other attachments, compare them to the reference if(store) { if(atts[col].storeOp != atts[col0].storeOp) @@ -252,6 +264,11 @@ string WrappedVulkan::MakeRenderPassOpString(bool store) opDesc = store ? "Different store ops" : "Different load ops"; } + else if(col0 == VK_ATTACHMENT_UNUSED) + { + // we're here if we didn't find any non-UNUSED color attachments at all + opDesc = "Unused"; + } else { // all colour ops are the same, print it