Protect against captures that try to allocate memory from invalid types

This commit is contained in:
baldurk
2020-10-06 16:11:22 +01:00
parent 96ab4c25d6
commit 1cbd062aa7
@@ -289,6 +289,16 @@ bool WrappedVulkan::Serialise_vkAllocateMemory(SerialiserType &ser, VkDevice dev
UnwrapNextChain(m_State, "VkMemoryAllocateInfo", tempMem, (VkBaseInStructure *)&patched);
if(patched.memoryTypeIndex >= m_PhysicalDeviceData.memProps.memoryTypeCount)
{
RDCERR(
"Tried to allocate memory from index %u, but on replay we only have %u memory types.\n"
"This is most likely caused by incompatible hardware or drivers between capture and "
"replay, causing a change in memory requirements.",
patched.memoryTypeIndex, m_PhysicalDeviceData.memProps.memoryTypeCount);
return false;
}
VkResult ret = ObjDisp(device)->AllocateMemory(Unwrap(device), &patched, NULL, &mem);
if(ret != VK_SUCCESS)