From f7c34cdb0cc433c8849b9b28ba8838e9eba56912 Mon Sep 17 00:00:00 2001 From: Leonard Tsai Date: Fri, 28 Jan 2022 16:29:34 -0800 Subject: [PATCH] Support VK_KHR_depth_stencil_resolve attachment in pipeline state view Depth stencil resolve attachments were not being serialized and exposed in the pipeline state view. This change serializes the attachment id for the depth-stencil resolve attachment so that it can show up in the pipeline state view. Update name of depth/stencil in pipeline viewer Fix clang formatting Update struct type --- .../PipelineState/VulkanPipelineStateViewer.cpp | 15 ++++++++++++++- renderdoc/api/replay/vk_pipestate.h | 5 +++++ renderdoc/driver/vulkan/vk_info.cpp | 11 +++++++++++ renderdoc/driver/vulkan/vk_info.h | 1 + renderdoc/driver/vulkan/vk_replay.cpp | 3 +++ renderdoc/replay/renderdoc_serialise.inl | 7 ++++--- 6 files changed, 38 insertions(+), 4 deletions(-) diff --git a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp index 8f45f16bb..c3da796dd 100644 --- a/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp +++ b/qrenderdoc/Windows/PipelineState/VulkanPipelineStateViewer.cpp @@ -2589,7 +2589,8 @@ void VulkanPipelineStateViewer::setState() bool filledSlot = (p.imageResourceId != ResourceId()); bool usedSlot = (colIdx >= 0 || resIdx >= 0 || state.currentPass.renderpass.depthstencilAttachment == i || - state.currentPass.renderpass.fragmentDensityAttachment == i); + state.currentPass.renderpass.fragmentDensityAttachment == i || + state.currentPass.renderpass.depthstencilResolveAttachment == i); if(showNode(usedSlot, filledSlot)) { @@ -2640,6 +2641,10 @@ void VulkanPipelineStateViewer::setState() { slotname = QFormatStr("Resolve %1").arg(resIdx); } + else if(state.currentPass.renderpass.depthstencilResolveAttachment == i) + { + slotname = lit("Depth/Stencil Resolve"); + } else if(state.currentPass.renderpass.fragmentDensityAttachment == i) { slotname = lit("Fragment Density Map"); @@ -4042,6 +4047,14 @@ void VulkanPipelineStateViewer::exportHTML(QXmlStreamWriter &xml, const VKPipe:: xml.writeEndElement(); } + if(pass.renderpass.depthstencilResolveAttachment >= 0) + { + xml.writeStartElement(lit("p")); + xml.writeCharacters(tr("Depth-stencil Resolve Attachment: %1") + .arg(pass.renderpass.depthstencilResolveAttachment)); + xml.writeEndElement(); + } + if(pass.renderpass.fragmentDensityAttachment >= 0) { xml.writeStartElement(lit("p")); diff --git a/renderdoc/api/replay/vk_pipestate.h b/renderdoc/api/replay/vk_pipestate.h index 2fdcce67f..6bc1f1a20 100644 --- a/renderdoc/api/replay/vk_pipestate.h +++ b/renderdoc/api/replay/vk_pipestate.h @@ -979,6 +979,11 @@ attachments. If there is no depth-stencil attachment, this index is ``-1``. )"); int32_t depthstencilAttachment = -1; + DOCUMENT(R"(An index into the framebuffer attachments for the depth-stencil resolve attachment. + +If there is no depth-stencil resolve attachment, this index is ``-1``. +)"); + int32_t depthstencilResolveAttachment = -1; DOCUMENT(R"(An index into the framebuffer attachments for the fragment density attachment. diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index cb3079a6e..deffcfe7e 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -1037,6 +1037,17 @@ void VulkanCreationInfo::RenderPass::Init(VulkanResourceManager *resourceMan, if(separateStencil) dst.stencilLayout = separateStencil->stencilLayout; + // VK_KHR_depth_stencil_resolve + const VkSubpassDescriptionDepthStencilResolve *depthstencilResolve = + (const VkSubpassDescriptionDepthStencilResolve *)FindNextStruct( + &src, VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE); + + dst.depthstencilResolveAttachment = + (depthstencilResolve && + depthstencilResolve->pDepthStencilResolveAttachment->attachment != VK_ATTACHMENT_UNUSED + ? depthstencilResolve->pDepthStencilResolveAttachment->attachment + : -1); + dst.fragmentDensityAttachment = (fragmentDensity && fragmentDensity->fragmentDensityMapAttachment.attachment != VK_ATTACHMENT_UNUSED diff --git a/renderdoc/driver/vulkan/vk_info.h b/renderdoc/driver/vulkan/vk_info.h index 67cfcc652..0c75e3cc6 100644 --- a/renderdoc/driver/vulkan/vk_info.h +++ b/renderdoc/driver/vulkan/vk_info.h @@ -449,6 +449,7 @@ struct VulkanCreationInfo rdcarray colorAttachments; rdcarray resolveAttachments; int32_t depthstencilAttachment; + int32_t depthstencilResolveAttachment; int32_t fragmentDensityAttachment; rdcarray inputLayouts; diff --git a/renderdoc/driver/vulkan/vk_replay.cpp b/renderdoc/driver/vulkan/vk_replay.cpp index 1dcef224c..f9f7bf9ef 100644 --- a/renderdoc/driver/vulkan/vk_replay.cpp +++ b/renderdoc/driver/vulkan/vk_replay.cpp @@ -1688,6 +1688,8 @@ void VulkanReplay::SavePipelineState(uint32_t eventId) c.m_RenderPass[state.GetRenderPass()].subpasses[state.subpass].resolveAttachments; ret.currentPass.renderpass.depthstencilAttachment = c.m_RenderPass[state.GetRenderPass()].subpasses[state.subpass].depthstencilAttachment; + ret.currentPass.renderpass.depthstencilResolveAttachment = + c.m_RenderPass[state.GetRenderPass()].subpasses[state.subpass].depthstencilResolveAttachment; ret.currentPass.renderpass.fragmentDensityAttachment = c.m_RenderPass[state.GetRenderPass()].subpasses[state.subpass].fragmentDensityAttachment; @@ -1760,6 +1762,7 @@ void VulkanReplay::SavePipelineState(uint32_t eventId) ret.currentPass.renderpass.colorAttachments.clear(); ret.currentPass.renderpass.resolveAttachments.clear(); ret.currentPass.renderpass.depthstencilAttachment = -1; + ret.currentPass.renderpass.depthstencilResolveAttachment = -1; ret.currentPass.renderpass.fragmentDensityAttachment = -1; ret.currentPass.framebuffer.resourceId = ResourceId(); diff --git a/renderdoc/replay/renderdoc_serialise.inl b/renderdoc/replay/renderdoc_serialise.inl index f847a56f1..6f59f0154 100644 --- a/renderdoc/replay/renderdoc_serialise.inl +++ b/renderdoc/replay/renderdoc_serialise.inl @@ -2209,10 +2209,11 @@ void DoSerialise(SerialiserType &ser, VKPipe::RenderPass &el) SERIALISE_MEMBER(colorAttachments); SERIALISE_MEMBER(resolveAttachments); SERIALISE_MEMBER(depthstencilAttachment); + SERIALISE_MEMBER(depthstencilResolveAttachment); SERIALISE_MEMBER(fragmentDensityAttachment); SERIALISE_MEMBER(multiviews); - SIZE_CHECK(120); + SIZE_CHECK(128); } template @@ -2262,7 +2263,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::CurrentPass &el) SERIALISE_MEMBER(framebuffer); SERIALISE_MEMBER(renderArea); - SIZE_CHECK(184); + SIZE_CHECK(192); } template @@ -2330,7 +2331,7 @@ void DoSerialise(SerialiserType &ser, VKPipe::State &el) SERIALISE_MEMBER(conditionalRendering); - SIZE_CHECK(2008); + SIZE_CHECK(2016); } #pragma endregion Vulkan pipeline state