Store last swapchain presented and use it instead if none is specified

This commit is contained in:
baldurk
2016-02-07 18:45:11 +01:00
parent d198569313
commit b2676c2861
3 changed files with 22 additions and 0 deletions
+19
View File
@@ -702,6 +702,25 @@ bool WrappedVulkan::EndFrameCapture(void *dev, void *wnd)
for(size_t i=0; i < swapInfo.images.size(); i++)
GetResourceManager()->MarkResourceFrameReferenced(GetResID(swapInfo.images[i].im), eFrameRef_Read);
}
else
{
// if a swapchain wasn't specified or found, use the last one presented
swaprecord = GetResourceManager()->GetResourceRecord(m_LastSwap);
if(swaprecord)
{
GetResourceManager()->MarkResourceFrameReferenced(swaprecord->GetResourceID(), eFrameRef_Read);
RDCASSERT(swaprecord->swapInfo);
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
{
+2
View File
@@ -389,6 +389,8 @@ private:
// capture-side data
ResourceId m_LastSwap;
// holds the current list of coherent mapped memory. Locked against concurrent use
vector<VkResourceRecord*> m_CoherentMaps;
Threading::CriticalSection m_CoherentMapsLock;
@@ -488,6 +488,7 @@ VkResult WrappedVulkan::vkQueuePresentKHR(
// need to record which image was last flipped so we can get the correct backbuffer
// for a thumbnail in EndFrameCapture
swapInfo.lastPresent = pPresentInfo->imageIndices[0];
m_LastSwap = swaprecord->GetResourceID();
VkImage backbuffer = swapInfo.images[pPresentInfo->imageIndices[0]].im;