Fix tests and documentation to use vmaBind* instead of vkBind* functions after defragmentation

This commit is contained in:
Adam Sawicki 2019-07-02 12:34:26 +02:00
parent 87cea36670
commit af88c1bde1
4 changed files with 156 additions and 155 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1188,7 +1188,7 @@ static void RecreateAllocationResource(AllocInfo& allocation)
vkGetBufferMemoryRequirements(g_hDevice, allocation.m_Buffer, &vkMemReq); vkGetBufferMemoryRequirements(g_hDevice, allocation.m_Buffer, &vkMemReq);
TEST(vkMemReq.size >= allocation.m_BufferInfo.size); TEST(vkMemReq.size >= allocation.m_BufferInfo.size);
res = vkBindBufferMemory(g_hDevice, allocation.m_Buffer, allocInfo.deviceMemory, allocInfo.offset); res = vmaBindBufferMemory(g_hAllocator, allocation.m_Allocation, allocation.m_Buffer);
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
} }
else else
@ -1202,7 +1202,7 @@ static void RecreateAllocationResource(AllocInfo& allocation)
VkMemoryRequirements vkMemReq; VkMemoryRequirements vkMemReq;
vkGetImageMemoryRequirements(g_hDevice, allocation.m_Image, &vkMemReq); vkGetImageMemoryRequirements(g_hDevice, allocation.m_Image, &vkMemReq);
res = vkBindImageMemory(g_hDevice, allocation.m_Image, allocInfo.deviceMemory, allocInfo.offset); res = vmaBindImageMemory(g_hAllocator, allocation.m_Allocation, allocation.m_Image);
TEST(res == VK_SUCCESS); TEST(res == VK_SUCCESS);
} }
} }

View File

@ -762,7 +762,8 @@ What it doesn't do, so you need to do it yourself:
- Recreate buffers and images that were bound to allocations that were defragmented and - Recreate buffers and images that were bound to allocations that were defragmented and
bind them with their new places in memory. bind them with their new places in memory.
You must use `vkDestroyBuffer()`, `vkDestroyImage()`, You must use `vkDestroyBuffer()`, `vkDestroyImage()`,
`vkCreateBuffer()`, `vkCreateImage()` for that purpose and NOT vmaDestroyBuffer(), `vkCreateBuffer()`, `vkCreateImage()`, vmaBindBufferMemory(), vmaBindImageMemory()
for that purpose and NOT vmaDestroyBuffer(),
vmaDestroyImage(), vmaCreateBuffer(), vmaCreateImage(), because you don't need to vmaDestroyImage(), vmaCreateBuffer(), vmaCreateImage(), because you don't need to
destroy or create allocation objects! destroy or create allocation objects!
- Recreate views and update descriptors that point to these buffers and images. - Recreate views and update descriptors that point to these buffers and images.
@ -816,7 +817,7 @@ for(uint32_t i = 0; i < allocCount; ++i)
// Bind new buffer to new memory region. Data contained in it is already moved. // Bind new buffer to new memory region. Data contained in it is already moved.
VmaAllocationInfo allocInfo; VmaAllocationInfo allocInfo;
vmaGetAllocationInfo(allocator, allocations[i], &allocInfo); vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);
vkBindBufferMemory(device, buffers[i], allocInfo.deviceMemory, allocInfo.offset); vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
} }
} }
\endcode \endcode
@ -894,7 +895,7 @@ for(uint32_t i = 0; i < allocCount; ++i)
// Bind new buffer to new memory region. Data contained in it is already moved. // Bind new buffer to new memory region. Data contained in it is already moved.
VmaAllocationInfo allocInfo; VmaAllocationInfo allocInfo;
vmaGetAllocationInfo(allocator, allocations[i], &allocInfo); vmaGetAllocationInfo(allocator, allocations[i], &allocInfo);
vkBindBufferMemory(device, buffers[i], allocInfo.deviceMemory, allocInfo.offset); vmaBindBufferMemory(allocator, allocations[i], buffers[i]);
} }
} }
\endcode \endcode