GPU: device & frameSDL 3.2
SDL_BindGPUVertexBuffers
Tells the next draws which GPU buffers to read vertices from.
Signature
void SDL_BindGPUVertexBuffers(SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUBufferBinding *bindings, Uint32 num_bindings);
How it works
Each SDL_GPUBufferBinding is {buffer, offset}: a buffer created with SDL_GPU_BUFFERUSAGE_VERTEX and the byte where the data starts. Slots match the vertex buffer descriptions in the pipeline: slot 0 for positions and colours in the simple case.
Parameters
render_passSDL_GPURenderPass *
The open render pass.
first_slotUint32
The first slot to fill, usually 0.
bindingsconst SDL_GPUBufferBinding *
Array of {buffer, offset}.
num_bindingsUint32
How many bindings.
Example
example.cpp
1SDL_GPUBufferBinding vb{vertexBuffer, 0};
2SDL_BindGPUVertexBuffers(pass, 0, &vb, 1);