Skip to content

fix(rrm): replace AppendToGlobalBuffer with RecordStagingCopy in UploadBuffer - #777

Merged
JeanPhilippeKernel merged 1 commit into
developfrom
fix/rrm-upload-buffer-pool-leak
Sep 10, 2026
Merged

fix(rrm): replace AppendToGlobalBuffer with RecordStagingCopy in UploadBuffer#777
JeanPhilippeKernel merged 1 commit into
developfrom
fix/rrm-upload-buffer-pool-leak

Conversation

@JeanPhilippeKernel

Copy link
Copy Markdown
Owner

Closes #770

What

UploadBuffer was calling AppendToGlobalBuffer(buf, ...) which routes through RecordGlobalBufferCopy. That function only has SHADER_READ in the barrier access mask — it is designed for mesh geometry that is accessed exclusively as an SSBO via gl_BaseVertex indexing. Generic device-local buffers (bone matrices, particle vertex buffers) need VERTEX_ATTRIBUTE_READ and INDEX_READ as well, which RecordStagingCopy provides.

Fix

Replace the AppendToGlobalBuffer call with the same explicit staging path that UpdateBuffer's device-local branch uses:

  • Allocate a host-staging buffer
  • Copy CPU data into it via vmaCopyMemoryToAllocation
  • Record a vkCmdCopyBuffer + full barrier via RecordStagingCopy
  • Track the staging buffer in m_batch_frames for retirement

The standalone destination buffer (buf) is already allocated and stored correctly. Only the upload path changes.

Test plan

  • Build passes clean
  • Engine runs at 120 fps, no validation errors
  • No callers of UploadBuffer exist yet — first real caller is SkinningUploadSystem (Sprint 7)

…adBuffer (closes #770)

AppendToGlobalBuffer uses RecordGlobalBufferCopy which only transitions to
SHADER_READ — missing VERTEX_ATTRIBUTE_READ and INDEX_READ. Generic device-local
buffers (bone matrices, particle VBs) need the full barrier that RecordStagingCopy
provides. The staging buffer is now tracked in m_batch_frames for proper retirement.
@JeanPhilippeKernel JeanPhilippeKernel self-assigned this Sep 10, 2026
@JeanPhilippeKernel JeanPhilippeKernel added enhancement New feature or request area-rendering area-linux Work on Linux system area-window Work on Window system area-macOS Work on macOS system labels Sep 10, 2026
@JeanPhilippeKernel
JeanPhilippeKernel merged commit 231a4ce into develop Sep 10, 2026
17 checks passed
@JeanPhilippeKernel
JeanPhilippeKernel deleted the fix/rrm-upload-buffer-pool-leak branch September 10, 2026 06:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-linux Work on Linux system area-macOS Work on macOS system area-rendering area-window Work on Window system enhancement New feature or request vulkan-api

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(rrm): UploadBuffer doesn't track its VB region in GeometryPool — pool leak when first caller lands

1 participant