The shared buffer: replaced when a refit needs more than it holds.
GPU bytes of the buffer in use and of the ones retired, not yet released.
Destroys the buffers replaced since the last call (the frames that used them were submitted).
Makes the buffer hold at least bytes (a refit's boxes): a bigger one replaces it, the old one is retired.
One primitive-box buffer for several mesh refits (P9, "refit buffer pooling", docs/internals/design/memory.md): the boxes (32 bytes per triangle) are written and read only inside each refit's own dispatches, so refits recorded one after another in a pass can take turns with one buffer sized for the largest mesh instead of one buffer each. The dispatches of a pass run in order, each seeing the writes of the ones before.
The rule for sharing: the refits' GpuMeshRefit.encode calls must not overlap (one at a time into a pass, or into passes submitted in order), and GpuMeshRefit.setTree may grow the buffer, which retires the old one until releaseRetired: call it once the frames that used the old buffer were submitted (
DeformingTreesdoes at each update).