GPU: shaders, pipelines & buffersSDL 3.2
SDL_ReleaseGPUBuffer
Frees a GPU buffer as soon as the GPU has finished using it.
Signature
void SDL_ReleaseGPUBuffer(SDL_GPUDevice *device, SDL_GPUBuffer *buffer);
How it works
Frames already submitted may still read the buffer, so SDL waits until that work is done before really freeing it. You can call it right away without a crash; just do not use the pointer afterwards.
Parameters
deviceSDL_GPUDevice *
The device.
bufferSDL_GPUBuffer *
The buffer to free.
Example
example.cpp
1SDL_ReleaseGPUBuffer(device, vertexBuffer);
2vertexBuffer = nullptr;