Fix image barriers when selecting BeginRP with discards

This commit is contained in:
baldurk
2022-02-24 14:02:07 +00:00
parent d57a8dc5d9
commit 52d26919b5
@@ -1699,6 +1699,8 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(SerialiserType &ser, VkComman
rdcarray<VkImageMemoryBarrier> imgBarriers = GetImplicitRenderPassBarriers();
ApplyRPLoadDiscards(commandBuffer, RenderPassBegin.renderArea);
// if we're just replaying the vkCmdBeginRenderPass on its own, we use the first loadRP
// instead of the real thing. This then doesn't require us to finish off any subpasses etc.
// we need to manually do the subpass 0 barriers, since loadRP expects the image to already
@@ -1709,11 +1711,18 @@ bool WrappedVulkan::Serialise_vkCmdBeginRenderPass(SerialiserType &ser, VkComman
unwrappedInfo.renderPass = Unwrap(rpinfo.loadRPs[0]);
unwrappedInfo.framebuffer = Unwrap(fbinfo.loadFBs[0]);
if(m_ReplayOptions.optimisation != ReplayOptimisationLevel::Fastest)
{
for(VkImageMemoryBarrier &barrier : imgBarriers)
{
if(barrier.oldLayout == VK_IMAGE_LAYOUT_UNDEFINED)
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
}
}
DoPipelineBarrier(commandBuffer, imgBarriers.size(), imgBarriers.data());
}
ApplyRPLoadDiscards(commandBuffer, RenderPassBegin.renderArea);
ActionFlags drawFlags = ActionFlags::PassBoundary | ActionFlags::BeginPass;
uint32_t eventId = HandlePreCallback(commandBuffer, drawFlags);