mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-07-08 16:50:44 +00:00
Handle VK_ATTACHMENT_UNUSED in color/input attachments without crashing
This commit is contained in:
@@ -2570,6 +2570,9 @@ void WrappedVulkan::AddDrawcall(const FetchDrawcall &d, bool hasEvents)
|
||||
|
||||
for(int i = 0; i < 8 && i < (int)colAtt.size(); i++)
|
||||
{
|
||||
if(colAtt[i] == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
|
||||
RDCASSERT(colAtt[i] < atts.size());
|
||||
draw.outputs[i] = atts[colAtt[i]].view;
|
||||
}
|
||||
@@ -2791,6 +2794,8 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, vector<DebugMessa
|
||||
for(size_t i = 0; i < rp.subpasses[state.subpass].inputAttachments.size(); i++)
|
||||
{
|
||||
uint32_t att = rp.subpasses[state.subpass].inputAttachments[i];
|
||||
if(att == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
drawNode.resourceUsage.push_back(
|
||||
std::make_pair(c.m_ImageView[fb.attachments[att].view].image,
|
||||
EventUsage(e, eUsage_InputTarget, fb.attachments[att].view)));
|
||||
@@ -2799,6 +2804,8 @@ void WrappedVulkan::AddUsage(VulkanDrawcallTreeNode &drawNode, vector<DebugMessa
|
||||
for(size_t i = 0; i < rp.subpasses[state.subpass].colorAttachments.size(); i++)
|
||||
{
|
||||
uint32_t att = rp.subpasses[state.subpass].colorAttachments[i];
|
||||
if(att == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
drawNode.resourceUsage.push_back(
|
||||
std::make_pair(c.m_ImageView[fb.attachments[att].view].image,
|
||||
EventUsage(e, eUsage_ColourTarget, fb.attachments[att].view)));
|
||||
|
||||
@@ -70,15 +70,25 @@ std::vector<VkImageMemoryBarrier> WrappedVulkan::GetImplicitRenderPassBarriers(u
|
||||
// transition the attachments in this subpass
|
||||
for(size_t i = 0; i < rpinfo.subpasses[subpass].colorAttachments.size(); i++)
|
||||
{
|
||||
uint32_t attIdx = rpinfo.subpasses[subpass].colorAttachments[i];
|
||||
|
||||
if(attIdx == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
|
||||
atts.push_back(VkAttachmentReference());
|
||||
atts.back().attachment = rpinfo.subpasses[subpass].colorAttachments[i];
|
||||
atts.back().attachment = attIdx;
|
||||
atts.back().layout = rpinfo.subpasses[subpass].colorLayouts[i];
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < rpinfo.subpasses[subpass].inputAttachments.size(); i++)
|
||||
{
|
||||
uint32_t attIdx = rpinfo.subpasses[subpass].inputAttachments[i];
|
||||
|
||||
if(attIdx == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
|
||||
atts.push_back(VkAttachmentReference());
|
||||
atts.back().attachment = rpinfo.subpasses[subpass].inputAttachments[i];
|
||||
atts.back().attachment = attIdx;
|
||||
atts.back().layout = rpinfo.subpasses[subpass].inputLayouts[i];
|
||||
}
|
||||
|
||||
|
||||
@@ -40,14 +40,20 @@ void WrappedVulkan::MakeSubpassLoadRP(VkRenderPassCreateInfo &info,
|
||||
// so that this RP doesn't perform any layout transitions
|
||||
for(uint32_t a = 0; a < sub->colorAttachmentCount; a++)
|
||||
{
|
||||
att[sub->pColorAttachments[a].attachment].initialLayout =
|
||||
att[sub->pColorAttachments[a].attachment].finalLayout = sub->pColorAttachments[a].layout;
|
||||
if(sub->pColorAttachments[a].attachment != VK_ATTACHMENT_UNUSED)
|
||||
{
|
||||
att[sub->pColorAttachments[a].attachment].initialLayout =
|
||||
att[sub->pColorAttachments[a].attachment].finalLayout = sub->pColorAttachments[a].layout;
|
||||
}
|
||||
}
|
||||
|
||||
for(uint32_t a = 0; a < sub->inputAttachmentCount; a++)
|
||||
{
|
||||
att[sub->pInputAttachments[a].attachment].initialLayout =
|
||||
att[sub->pInputAttachments[a].attachment].finalLayout = sub->pInputAttachments[a].layout;
|
||||
if(sub->pInputAttachments[a].attachment != VK_ATTACHMENT_UNUSED)
|
||||
{
|
||||
att[sub->pInputAttachments[a].attachment].initialLayout =
|
||||
att[sub->pInputAttachments[a].attachment].finalLayout = sub->pInputAttachments[a].layout;
|
||||
}
|
||||
}
|
||||
|
||||
if(sub->pDepthStencilAttachment && sub->pDepthStencilAttachment->attachment != VK_ATTACHMENT_UNUSED)
|
||||
|
||||
Reference in New Issue
Block a user