efficient per frame texture update with no allocations #3102
Unanswered
eladm-ultrawis
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Ok, exploring bgfx implementation, I can see that it is indeed allocating staging memory each frame. and there is no way to create any kind of reusable staging buffer. Also, it seems that the library is using vkAllocateMemory directly for each allocation and does not implement efficient allocation mechanism (such as AMD memory allocator). profiling a simple bgfx frame that uses vulkan, it seems most of the CPU time is spent on vkAllocateMemory / vkFreeMemory in case the user is updating a texture or uses transient buffers. @bkaradzic any pointers on that? can these issues be mitigated somehow with better usage patterns? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am learning to use bgfx with a Vulkan backend.
My goal is to update a 2D texture each frame from host memory. The src buffer is the same for each frame.
With Vulkan, I would typically allocate a staging buffer on host memory (pinned) and each frame I would initiate vkCmdCopyBufferToImage command along with the relevant barriers and layout transitions.
However, when doing the following with bgfx:
It seems bgfx is allocating a stage buffer each frame - I can spot vkAllocateMemory and vkFreeMemory on each frame along with vkCreateBuffer.
So my questions are:
Beta Was this translation helpful? Give feedback.
All reactions