Don't transition from undefined when doing implicit renderpass barriers

* This would discard the resource. Instead transition from whichever
  state it's currently in.
This commit is contained in:
baldurk
2016-09-09 20:53:20 +02:00
parent ea5bcfd1f5
commit a673ee181d
+14
View File
@@ -2177,6 +2177,20 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
// first apply implicit transitions to the right subpass
std::vector<VkImageMemoryBarrier> imgBarriers = GetImplicitRenderPassBarriers();
// don't transition from undefined, or contents will be discarded, instead transition from
// the current state.
for(size_t i = 0; i < imgBarriers.size(); i++)
{
if(imgBarriers[i].oldLayout == VK_IMAGE_LAYOUT_UNDEFINED)
{
// TODO find overlapping range and transition that instead
imgBarriers[i].oldLayout =
m_ImageLayouts[GetResourceManager()->GetNonDispWrapper(imgBarriers[i].image)->id]
.subresourceStates[0]
.newLayout;
}
}
GetResourceManager()->RecordBarriers(m_BakedCmdBufferInfo[GetResID(cmd)].imgbarriers,
m_ImageLayouts, (uint32_t)imgBarriers.size(),
&imgBarriers[0]);