Don't rely on creation info during capture, it isn't populated

* On capture when we need the buffer size we can get it from the resource
  record.
This commit is contained in:
baldurk
2021-01-26 15:21:47 +00:00
parent 58ef496c8a
commit 34dca01cb2
@@ -517,26 +517,10 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
{
// either set the buffer that's dedicated, or if this is dedicated image memory set NULL
wholeMemBuf = dedicated->buffer;
VkDeviceSize bufSize = m_CreationInfo.m_Buffer[GetResID(dedicated->buffer)].size;
if(memSize > bufSize)
{
RDCDEBUG("Truncating memory size %llu to dedicated buffer size %llu for %s", memSize,
bufSize, ToStr(id).c_str());
memSize = bufSize;
}
}
else if(dedicatedNV)
{
wholeMemBuf = dedicatedNV->buffer;
VkDeviceSize bufSize = m_CreationInfo.m_Buffer[GetResID(dedicatedNV->buffer)].size;
if(memSize > bufSize)
{
RDCDEBUG("Truncating memory size %llu to dedicated buffer size %llu for %s", memSize,
bufSize, ToStr(id).c_str());
memSize = bufSize;
}
}
else
{
@@ -556,6 +540,19 @@ VkResult WrappedVulkan::vkAllocateMemory(VkDevice device, const VkMemoryAllocate
ObjDisp(device)->BindBufferMemory(Unwrap(device), Unwrap(wholeMemBuf), Unwrap(*pMemory), 0);
}
if((dedicated != NULL || dedicatedNV != NULL) && wholeMemBuf != VK_NULL_HANDLE)
{
VkDeviceSize bufSize = IsCaptureMode(m_State)
? GetRecord(wholeMemBuf)->memSize
: m_CreationInfo.m_Buffer[GetResID(wholeMemBuf)].size;
if(memSize > bufSize)
{
RDCDEBUG("Truncating memory size %llu to dedicated buffer size %llu for %s", memSize,
bufSize, ToStr(id).c_str());
memSize = bufSize;
}
}
if(IsCaptureMode(m_State))
{
Chunk *chunk = NULL;