#Global buffer update strategy

10 messages · Page 1 of 1 (latest)

worldly path
#

Heya, I've got a few global buffers for vertex, index and transforms. Geometry buffers are updated when there's a new resource but transforms are always prepared each frame based on instanced batching and culling. What should be some of my concerns for synchronization etc?

  • Should transforms be double buffered (or per frame-in-flight)?

  • Should I pre-allocate big buffers to avoid re-creating? (max verts, indices, transforms)

  • For geometry, should I queue additions and only update the new buffer region?

  • In that case, what do I do for deletions?

I'd think I wouldn't want to keep geometry data around on the CPU side forever, so I'm unsure how I'd rebuild the buffers on deletions or resizes without reloading all models.

fallen bronze
#

"Should transforms be double buffered (or per frame-in-flight)?" Yes, as they are written by the CPU and read by the GPU

#

"Should I pre-allocate big buffers to avoid re-creating? (max verts, indices, transforms)" Yes

#

You can also avoid using a lot of buffers by putting different types of data in the same buffer

worldly path
fallen bronze
#

For example yes

#

But it's especially for things you pass to shaders

wicked junco
#

I'd recommend using BDA to fetch vertex data, and only use HW bindings for Index Buffer (They're not even bindings)

#

because you gain flexibility whether you suballocate from same VkBuffer, or have on vkBuffer per geometry, etc.