Handle subpasses with all color attachments being UNUSED. Refs #670

This commit is contained in:
baldurk
2017-06-22 14:20:21 +01:00
parent a00e0f3ed0
commit 747afa7b74
@@ -219,15 +219,27 @@ string WrappedVulkan::MakeRenderPassOpString(bool store)
const std::vector<uint32_t> &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