Added recording and replaying of calls to functions: vmaTouchAllocation, vmaGetAllocationInfo. VmaReplay: fixed handling of null allocation.

This commit is contained in:
Adam Sawicki 2018-08-21 10:59:53 +02:00
parent b3ea2c62f1
commit 80cb2365c5
3 changed files with 184 additions and 7 deletions

View file

@ -4803,6 +4803,10 @@ public:
VmaAllocation allocation);
void RecordDestroyImage(uint32_t frameIndex,
VmaAllocation allocation);
void RecordTouchAllocation(uint32_t frameIndex,
VmaAllocation allocation);
void RecordGetAllocationInfo(uint32_t frameIndex,
VmaAllocation allocation);
private:
struct CallParams
@ -8432,6 +8436,30 @@ void VmaRecorder::RecordDestroyImage(uint32_t frameIndex,
Flush();
}
void VmaRecorder::RecordTouchAllocation(uint32_t frameIndex,
VmaAllocation allocation)
{
CallParams callParams;
GetBasicParams(callParams);
VmaMutexLock lock(m_FileMutex, m_UseMutex);
fprintf(m_File, "%u,%.3f,%u,vmaTouchAllocation,%p\n", callParams.threadId, callParams.time, frameIndex,
allocation);
Flush();
}
void VmaRecorder::RecordGetAllocationInfo(uint32_t frameIndex,
VmaAllocation allocation)
{
CallParams callParams;
GetBasicParams(callParams);
VmaMutexLock lock(m_FileMutex, m_UseMutex);
fprintf(m_File, "%u,%.3f,%u,vmaGetAllocationInfo,%p\n", callParams.threadId, callParams.time, frameIndex,
allocation);
Flush();
}
VmaRecorder::UserDataString::UserDataString(VmaAllocationCreateFlags allocFlags, const void* pUserData)
{
if(pUserData != VMA_NULL)
@ -10519,6 +10547,15 @@ void vmaGetAllocationInfo(
VMA_DEBUG_GLOBAL_MUTEX_LOCK
#if VMA_RECORDING_ENABLED
if(allocator->GetRecorder() != VMA_NULL)
{
allocator->GetRecorder()->RecordGetAllocationInfo(
allocator->GetCurrentFrameIndex(),
allocation);
}
#endif
allocator->GetAllocationInfo(allocation, pAllocationInfo);
}
@ -10530,6 +10567,15 @@ VkBool32 vmaTouchAllocation(
VMA_DEBUG_GLOBAL_MUTEX_LOCK
#if VMA_RECORDING_ENABLED
if(allocator->GetRecorder() != VMA_NULL)
{
allocator->GetRecorder()->RecordTouchAllocation(
allocator->GetCurrentFrameIndex(),
allocation);
}
#endif
return allocator->TouchAllocation(allocation);
}