mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 17:40:39 +00:00
For any images that don't have an initial layout recorded, use GENERAL
* This could happen if the image is created mid-frame and its layout isn't serialised out in the BeginCaptureFrame chunk, and prevents us from trying to use an image while it's UNDEFINED.
This commit is contained in:
@@ -1147,11 +1147,47 @@ bool WrappedVulkan::Serialise_BeginCaptureFrame(SerialiserType &ser)
|
||||
|
||||
SERIALISE_CHECK_READ_ERRORS();
|
||||
|
||||
if(IsReplayingAndReading() && !imgBarriers.empty())
|
||||
if(IsReplayingAndReading())
|
||||
{
|
||||
VkPipelineStageFlags src_stages = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||
VkPipelineStageFlags dest_stages = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||
|
||||
if(IsLoading(m_State))
|
||||
{
|
||||
// for the first load, ensure all images are in a non-undefined layout. Any images that don't
|
||||
// have an initial layout to transition back into were likely created mid-frame so their state
|
||||
// is expected to be transitioned from undefined in the capture itself.
|
||||
for(auto it = m_ImageLayouts.begin(); it != m_ImageLayouts.end(); ++it)
|
||||
{
|
||||
for(auto stit = it->second.subresourceStates.begin();
|
||||
stit != it->second.subresourceStates.end(); ++stit)
|
||||
{
|
||||
if(stit->newLayout == VK_IMAGE_LAYOUT_UNDEFINED &&
|
||||
GetResourceManager()->HasCurrentResource(it->first))
|
||||
{
|
||||
VkImage img = GetResourceManager()->GetCurrentHandle<VkImage>(it->first);
|
||||
|
||||
if(GetResID(img) != GetResourceManager()->GetOriginalID(GetResID(img)))
|
||||
{
|
||||
VkImageMemoryBarrier barrier = {};
|
||||
|
||||
stit->newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
|
||||
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
barrier.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
barrier.newLayout = VK_IMAGE_LAYOUT_GENERAL;
|
||||
barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
|
||||
barrier.image = Unwrap(img);
|
||||
barrier.subresourceRange = stit->subresourceRange;
|
||||
|
||||
imgBarriers.push_back(barrier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!imgBarriers.empty())
|
||||
{
|
||||
for(size_t i = 0; i < imgBarriers.size(); i++)
|
||||
|
||||
Reference in New Issue
Block a user