Vulkan images in preinitialized layout must always be patched to general

* Originally the idea was that on first use in a Loading pass we'd transition
  from preinitialized to whatever the application wanted, and then subsequently
  on repeated replays it would be left in general. However this doesn't account
  for initial contents and initial frame states, which will end up putting the
  image in GENERAL anyway. This is fine as it still satisfies the requirements
  if needed.
This commit is contained in:
baldurk
2022-02-09 13:03:59 +00:00
parent a661020cec
commit 469f17a607
@@ -3835,17 +3835,7 @@ bool WrappedVulkan::Serialise_vkCmdPipelineBarrier(
// now sanitise layouts before passing to vulkan
for(VkImageMemoryBarrier &barrier : imgBarriers)
{
if(!IsLoading(m_State) && barrier.oldLayout == VK_IMAGE_LAYOUT_PREINITIALIZED)
{
// This is a transition from PRENITIALIZED, but we've already done this barrier once (when
// loading); Since we couldn't transition back to PREINITIALIZED, we instead left the
// image in GENERAL.
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
}
else
{
SanitiseReplayImageLayout(barrier.oldLayout);
}
SanitiseOldImageLayout(barrier.oldLayout);
SanitiseReplayImageLayout(barrier.newLayout);
}
@@ -4101,17 +4091,7 @@ bool WrappedVulkan::Serialise_vkCmdPipelineBarrier2(SerialiserType &ser,
continue;
}
if(!IsLoading(m_State) && barrier.oldLayout == VK_IMAGE_LAYOUT_PREINITIALIZED)
{
// This is a transition from PRENITIALIZED, but we've already done this barrier once (when
// loading); Since we couldn't transition back to PREINITIALIZED, we instead left the
// image in GENERAL.
barrier.oldLayout = VK_IMAGE_LAYOUT_GENERAL;
}
else
{
SanitiseReplayImageLayout(barrier.oldLayout);
}
SanitiseOldImageLayout(barrier.oldLayout);
SanitiseReplayImageLayout(barrier.newLayout);
}