Add a function to reset memory blocks without freeing them

* This can be used only when all resources are safely freed, but means the
  memory can be re-used.
This commit is contained in:
baldurk committed 2023-05-05 12:28:35 +01:00
1 parent 3e21a26f84
commit 279a827c73
2 files changed
+12

No files matched your search

+1
View File
@@ -590,6 +590,7 @@ private:
VkDeviceSize m_MemoryBlockSize[arraydim<MemoryScope>()] = {};
void FreeAllMemory(MemoryScope scope);
void ResetMemoryBlocks(MemoryScope scope);
void FreeMemoryAllocation(MemoryAllocation alloc);
// internal implementation - call one of the functions above
+11
View File
@@ -432,6 +432,17 @@ void WrappedVulkan::FreeAllMemory(MemoryScope scope)
});
}
void WrappedVulkan::ResetMemoryBlocks(MemoryScope scope)
{
rdcarray<MemoryAllocation> &allocList = m_MemoryBlocks[(size_t)scope];
if(allocList.empty())
return;
for(MemoryAllocation &alloc : allocList)
alloc.offs = 0;
}
void WrappedVulkan::FreeMemoryAllocation(MemoryAllocation alloc)
{
// don't do anything at the moment, we only support freeing the whole scope at once.