GPU: shaders, pipelines & buffersSDL 3.2
SDL_ReleaseGPUTransferBuffer
Frees a transfer buffer as soon as it is safe (after the GPU finished copying from it).
Signature
void SDL_ReleaseGPUTransferBuffer(SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer);
How it works
For a one-time upload (a mesh loaded at startup) release the staging buffer right after submitting: SDL keeps it alive until the copy is done. For data that changes every frame, keep one transfer buffer and reuse it with cycle = true instead of creating and releasing one per frame.
Parameters
deviceSDL_GPUDevice *
The device.
transfer_bufferSDL_GPUTransferBuffer *
The transfer buffer to free.
Example
example.cpp
1SDL_SubmitGPUCommandBuffer(cmd);
2SDL_ReleaseGPUTransferBuffer(device, staging); // freed once the copy finishes