From 351df759e10ee30b4452e72508bc0d3fedbe3182 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 9 Sep 2016 13:33:40 +0200 Subject: [PATCH] Apply missing implicit renderpass barriers when replaying a subpass --- renderdoc/driver/vulkan/vk_core.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/vulkan/vk_core.cpp b/renderdoc/driver/vulkan/vk_core.cpp index b926e422c..6b46e4fa8 100644 --- a/renderdoc/driver/vulkan/vk_core.cpp +++ b/renderdoc/driver/vulkan/vk_core.cpp @@ -2160,6 +2160,8 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay // has chosen a subsection that lies within a command buffer if(partial) { + m_State = EXECUTING; + VkCommandBuffer cmd = m_Partial[Primary].outsideCmdBuffer = GetNextCmd(); VkCommandBufferBeginInfo beginInfo = {VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO, NULL, @@ -2170,12 +2172,27 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay rpWasActive = m_Partial[Primary].renderPassActive; - // if a render pass was active, begin it and set up the partial replay state if(m_Partial[Primary].renderPassActive) + { + // first apply implicit transitions to the right subpass + std::vector imgBarriers = GetImplicitRenderPassBarriers(); + + GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[GetResID(cmd)].imgbarriers, + m_ImageLayouts, (uint32_t)imgBarriers.size(), + &imgBarriers[0]); + + ObjDisp(cmd)->CmdPipelineBarrier(Unwrap(cmd), VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, false, 0, NULL, 0, NULL, + (uint32_t)imgBarriers.size(), &imgBarriers[0]); + + // if a render pass was active, begin it and set up the partial replay state m_RenderState.BeginRenderPassAndApplyState(cmd); - // if we had a compute pipeline, need to bind that + } else if(m_RenderState.compute.pipeline != ResourceId()) + { + // if we had a compute pipeline, need to bind that m_RenderState.BindPipeline(cmd); + } } if(replayType == eReplay_Full)