Fix some cases where buffer memory requirements were assumed to be tight

* It's possible for a buffer to require more memory than its size (e.g. up to
  some alignment)
This commit is contained in:
baldurk
2022-02-08 17:46:49 +00:00
parent a8e7b64a31
commit b38f8b8378
3 changed files with 2 additions and 9 deletions
-7
View File
@@ -506,13 +506,6 @@ bool WrappedVulkan::Prepare_InitialState(WrappedVkRes *res)
if(readbackmem.mem == VK_NULL_HANDLE)
return false;
// dummy request to keep the validation layers happy - the buffers are identical so the
// requirements must be identical
{
VkMemoryRequirements mrq = {0};
ObjDisp(d)->GetBufferMemoryRequirements(Unwrap(d), Unwrap(dstBuf), &mrq);
}
CheckVkResult(vkr);
vkr = ObjDisp(d)->BindBufferMemory(Unwrap(d), Unwrap(dstBuf), Unwrap(readbackmem.mem),
readbackmem.offs);
+1 -1
View File
@@ -693,7 +693,7 @@ void VulkanReplay::GetOutputWindowData(uint64_t id, bytebuf &retData)
vt->GetBufferMemoryRequirements(Unwrap(device), readbackBuf, &mrq);
VkMemoryAllocateInfo allocInfo = {
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, NULL, bufInfo.size,
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, NULL, mrq.size,
m_pDriver->GetReadbackMemoryIndex(mrq.memoryTypeBits),
};
+1 -1
View File
@@ -3861,7 +3861,7 @@ void VulkanReplay::GetTextureData(ResourceId tex, const Subresource &sub,
vt->GetBufferMemoryRequirements(Unwrap(dev), readbackBuf, &mrq);
VkMemoryAllocateInfo allocInfo = {
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, NULL, dataSize,
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, NULL, mrq.size,
m_pDriver->GetReadbackMemoryIndex(mrq.memoryTypeBits),
};