Make swapchains parents of im and put GetSwapchainImages in swap record

This commit is contained in:
baldurk
2015-11-04 12:21:58 +01:00
parent 58703dd348
commit d198569313
2 changed files with 11 additions and 6 deletions
+4
View File
@@ -697,6 +697,10 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd)
const SwapchainInfo &swapInfo = *swaprecord->swapInfo;
backbuffer = swapInfo.images[swapInfo.lastPresent].im;
// mark all images referenced as well
for(size_t i=0; i < swapInfo.images.size(); i++)
GetResourceManager()->MarkResourceFrameReferenced(GetResID(swapInfo.images[i].im), eFrameRef_Read);
}
// transition back to IDLE atomically
@@ -132,16 +132,17 @@ VkResult WrappedVulkan::vkGetSwapchainImagesKHR(
}
VkResourceRecord *record = GetResourceManager()->AddResourceRecord(pSwapchainImages[i]);
record->AddChunk(chunk);
VkResourceRecord *swaprecord = GetRecord(swapchain);
record->SpecialResource = true;
// we invert the usual scheme - we make the swapchain record take parent refs
// on these images, so that we can just ref the swapchain on present and pull
// in all the images
VkResourceRecord *swaprecord = GetRecord(swapchain);
record->AddParent(swaprecord);
swaprecord->AddParent(record);
// note we add the chunk to the swap record, that way when the swapchain is created it will
// always create all of its images on replay. The image's record is kept around for reference
// tracking and any other chunks. Because it has a parent relationship on the swapchain, if
// the image is referenced the swapchain (and thus all the getimages) will be included.
swaprecord->AddChunk(chunk);
}
else
{