Migrate to Clay main branch rather than release (#27)

Co-authored-by: Zachary Levy <zachary@sunforge.is>
Reviewed-on: #27
This commit was merged in pull request #27.
This commit is contained in:
2026-05-09 01:55:25 +00:00
parent 43f08ed30c
commit 0ecd93a334
11 changed files with 233 additions and 114 deletions
+7 -1
View File
@@ -684,7 +684,13 @@ upload_backdrop_primitives :: proc(device: ^sdl.GPUDevice, pass: ^sdl.GPUCopyPas
sdl.GPUBufferUsageFlags{.GRAPHICS_STORAGE_READ},
)
prim_array := sdl.MapGPUTransferBuffer(device, GLOB.backdrop.primitive_buffer.transfer, false)
// cycle=true: this is a persistent per-frame streaming transfer buffer. The previous
// frame's UploadToGPUBuffer is almost certainly still in flight when we map here
// (allowedFramesInFlight defaults to 2 on Metal). Without cycling, the CPU memcpy below
// races the GPU's blit read on the same MTLBuffer.contents. Cycling rebinds the
// container's active internal buffer to an unbound one (or allocates a new one) — O(1)
// in steady state, no fence wait. See SDL_gpu_metal.m's METAL_INTERNAL_PrepareBufferForWrite.
prim_array := sdl.MapGPUTransferBuffer(device, GLOB.backdrop.primitive_buffer.transfer, true)
if prim_array == nil {
log.panicf("Failed to map backdrop primitive transfer buffer: %s", sdl.GetError())
}