Store subpasses in creation info, use to fetch active attachments

This commit is contained in:
baldurk
2015-11-06 20:18:15 +01:00
parent 2a6e33ad0e
commit 64aa299090
5 changed files with 63 additions and 33 deletions
+1
View File
@@ -1798,6 +1798,7 @@ ResourceId VulkanDebugManager::RenderOverlay(ResourceId texid, TextureDisplayOve
// modify state
m_pDriver->m_PartialReplayData.state.renderPass = GetResID(m_OverlayNoDepthRP);
m_pDriver->m_PartialReplayData.state.subpass = 0;
m_pDriver->m_PartialReplayData.state.framebuffer = GetResID(m_OverlayNoDepthFB);
m_pDriver->m_PartialReplayData.state.graphics.pipeline = GetResID(pipe);
+15 -12
View File
@@ -253,20 +253,23 @@ void VulkanCreationInfo::RenderPass::Init(VulkanResourceManager *resourceMan, co
attachments.push_back(a);
}
// VKTODOMED figure out how subpasses work
RDCASSERT(pCreateInfo->subpassCount > 0);
const VkSubpassDescription &subp = pCreateInfo->pSubpasses[0];
subpasses.resize(pCreateInfo->subpassCount);
for(uint32_t i=0; i < pCreateInfo->subpassCount; i++)
{
const VkSubpassDescription &subp = pCreateInfo->pSubpasses[i];
Subpass &s = subpasses[i];
inputAttachments.resize(subp.inputCount);
for(uint32_t i=0; i < subp.inputCount; i++)
inputAttachments[i] = subp.pInputAttachments[i].attachment;
s.inputAttachments.resize(subp.inputCount);
for(uint32_t i=0; i < subp.inputCount; i++)
s.inputAttachments[i] = subp.pInputAttachments[i].attachment;
colorAttachments.resize(subp.colorCount);
for(uint32_t i=0; i < subp.colorCount; i++)
colorAttachments[i] = subp.pColorAttachments[i].attachment;
depthstencilAttachment = (subp.depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED
? (int32_t)subp.depthStencilAttachment.attachment : -1);
s.colorAttachments.resize(subp.colorCount);
for(uint32_t i=0; i < subp.colorCount; i++)
s.colorAttachments[i] = subp.pColorAttachments[i].attachment;
s.depthstencilAttachment = (subp.depthStencilAttachment.attachment != VK_ATTACHMENT_UNUSED
? (int32_t)subp.depthStencilAttachment.attachment : -1);
}
}
void VulkanCreationInfo::Framebuffer::Init(VulkanResourceManager *resourceMan, const VkFramebufferCreateInfo* pCreateInfo)
+7 -3
View File
@@ -181,9 +181,13 @@ struct VulkanCreationInfo
};
vector<Attachment> attachments;
vector<uint32_t> inputAttachments;
vector<uint32_t> colorAttachments;
int32_t depthstencilAttachment;
struct Subpass
{
vector<uint32_t> inputAttachments;
vector<uint32_t> colorAttachments;
int32_t depthstencilAttachment;
};
vector<Subpass> subpasses;
VkRenderPass loadRP;
};
+3 -3
View File
@@ -1660,9 +1660,9 @@ void VulkanReplay::SavePipelineState()
// Renderpass
m_VulkanPipelineState.Pass.renderpass.obj = rm->GetOriginalID(state.renderPass);
m_VulkanPipelineState.Pass.renderpass.inputAttachments = c.m_RenderPass[state.renderPass].inputAttachments;
m_VulkanPipelineState.Pass.renderpass.colorAttachments = c.m_RenderPass[state.renderPass].colorAttachments;
m_VulkanPipelineState.Pass.renderpass.depthstencilAttachment = c.m_RenderPass[state.renderPass].depthstencilAttachment;
m_VulkanPipelineState.Pass.renderpass.inputAttachments = c.m_RenderPass[state.renderPass].subpasses[state.subpass].inputAttachments;
m_VulkanPipelineState.Pass.renderpass.colorAttachments = c.m_RenderPass[state.renderPass].subpasses[state.subpass].colorAttachments;
m_VulkanPipelineState.Pass.renderpass.depthstencilAttachment = c.m_RenderPass[state.renderPass].subpasses[state.subpass].depthstencilAttachment;
m_VulkanPipelineState.Pass.framebuffer.obj = rm->GetOriginalID(state.framebuffer);
@@ -584,11 +584,22 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(
if(atts[i].loadOp != atts[0].loadOp)
allsame = allsameexceptstencil = false;
if(info.depthstencilAttachment != -1 && allsame && atts.size() > 1)
{
size_t o = (info.depthstencilAttachment == 0) ? 1 : 0;
int32_t dsAttach = -1;
if(atts[info.depthstencilAttachment].stencilLoadOp != atts[o].loadOp)
for(size_t i=0; i < info.subpasses.size(); i++)
{
if(info.subpasses[i].depthstencilAttachment != -1)
{
dsAttach = info.subpasses[i].depthstencilAttachment;
break;
}
}
if(dsAttach != -1 && allsame && atts.size() > 1)
{
size_t o = (dsAttach == 0) ? 1 : 0;
if(atts[dsAttach].stencilLoadOp != atts[o].loadOp)
allsame = false;
}
@@ -610,13 +621,13 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(
if(atts[0].loadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
loadDesc = "Don't Care";
if(info.depthstencilAttachment >= 0 && info.depthstencilAttachment < atts.size())
if(dsAttach >= 0 && dsAttach < atts.size())
{
if(atts[info.depthstencilAttachment].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
if(atts[dsAttach].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_CLEAR)
loadDesc += ", Stencil=Clear";
if(atts[info.depthstencilAttachment].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD)
if(atts[dsAttach].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_LOAD)
loadDesc += ", Stencil=Load";
if(atts[info.depthstencilAttachment].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
if(atts[dsAttach].stencilLoadOp == VK_ATTACHMENT_LOAD_OP_DONT_CARE)
loadDesc += ", Stencil=Don't Care";
}
}
@@ -844,11 +855,22 @@ bool WrappedVulkan::Serialise_vkCmdEndRenderPass(
if(atts[i].storeOp != atts[0].storeOp)
allsame = allsameexceptstencil = false;
if(info.depthstencilAttachment != -1 && allsame && atts.size() > 1)
{
size_t o = (info.depthstencilAttachment == 0) ? 1 : 0;
int32_t dsAttach = -1;
if(atts[info.depthstencilAttachment].stencilStoreOp != atts[o].storeOp)
for(size_t i=0; i < info.subpasses.size(); i++)
{
if(info.subpasses[i].depthstencilAttachment != -1)
{
dsAttach = info.subpasses[i].depthstencilAttachment;
break;
}
}
if(dsAttach != -1 && allsame && atts.size() > 1)
{
size_t o = (dsAttach == 0) ? 1 : 0;
if(atts[dsAttach].stencilStoreOp != atts[o].storeOp)
allsameexceptstencil = false;
}
@@ -866,11 +888,11 @@ bool WrappedVulkan::Serialise_vkCmdEndRenderPass(
if(atts[0].storeOp == VK_ATTACHMENT_STORE_OP_DONT_CARE)
storeDesc = "Don't Care";
if(info.depthstencilAttachment >= 0 && info.depthstencilAttachment < atts.size())
if(dsAttach >= 0 && dsAttach < atts.size())
{
if(atts[info.depthstencilAttachment].stencilStoreOp == VK_ATTACHMENT_STORE_OP_STORE)
if(atts[dsAttach].stencilStoreOp == VK_ATTACHMENT_STORE_OP_STORE)
storeDesc += ", Stencil=Store";
if(atts[info.depthstencilAttachment].stencilStoreOp == VK_ATTACHMENT_STORE_OP_DONT_CARE)
if(atts[dsAttach].stencilStoreOp == VK_ATTACHMENT_STORE_OP_DONT_CARE)
storeDesc += ", Stencil=Don't Care";
}
}