-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vulkan Memory Allocator usage in VulkanStagePool class #19
Comments
Thanks Adam! The Vulkan backend is still a work in progress, but this is very valuable information. And thanks for the library, it saved us a ton of time. |
Ah, thanks for the note Adam, we'll definitely fix this stuff up and update the library! Another issue is that we're not calling the defrag function anywhere... |
There is no need to call defrag function. Currently defragmentation works only with HOST_VISIBLE (CPU) memory anyway. Allocation algorithm should do a good job at finding optimal place for new allocations. |
This implements the following suggestions from Adam Sawicki: (1) Update VkMemAlloc to dev branch. (2) Use VMA_MEMORY_USAGE_CPU_ONLY in the stage pool. (2) Add vmaFlush after every vmaUnmap. We also considered removing Map / Unmap in favor of persistent mapping via VMA_ALLOCATION_CREATE_MAPPED_BIT, but decided to be conservative until we have a chance to rethink our UBO update strategy. Closes #19
This implements the following suggestions from Adam Sawicki: (1) Update VkMemAlloc to dev branch. (2) Use VMA_MEMORY_USAGE_CPU_ONLY in the stage pool. (2) Add vmaFlush after every vmaUnmap. We also considered removing Map / Unmap in favor of persistent mapping via VMA_ALLOCATION_CREATE_MAPPED_BIT, but decided to be conservative until we have a chance to rethink our UBO update strategy. Closes #19
Hello, I'm the author of Vulkan Memory Allocator library. Thanks for using the library in your project.
I would like to suggest that in file
VulkanStagePool.cpp
, in functionVulkanStagePool::acquireStage
, memory usage should beVMA_MEMORY_USAGE_CPU_ONLY
rather thanVMA_MEMORY_USAGE_CPU_TO_GPU
because that's the flag recommended for buffers that are used only as a source of transfer and not directly accessed by GPU while rendering.By the way, I would also suggest to use version of the library from "development" branch, not from "master", as this release is quite old. You can find there functions to flush and invalidate memory (
vmaFlushAllocation
,vmaInvalidateAllocation
), which you should do before/after mapping for memory types that are not coherent. This is important on mobile platforms, and I couldn't find any such calls (likevkFlushMappedMemoryRanges
/vkInvalidateMappedMemoryRanges
) in your current code.The text was updated successfully, but these errors were encountered: