GPU: device & frameSDL 3.2
SDL_DrawGPUPrimitives
Draws: runs the bound pipeline over num_vertices vertices, num_instances times.
Signature
void SDL_DrawGPUPrimitives(SDL_GPURenderPass *render_pass, Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance);
How it works
The SDL_GPU version of glDrawArrays / vkCmdDraw. The vertices are grouped into primitives according to the pipeline's primitive type (a triangle list takes them three by three). Instancing draws the same vertices several times; the shader tells the copies apart by the instance index.
SDL_DrawGPUIndexedPrimitives does the same with an index buffer.
Parameters
render_passSDL_GPURenderPass *
The open render pass.
num_verticesUint32
How many vertices (3 for one triangle).
num_instancesUint32
How many copies; 1 for a normal draw.
first_vertexUint32
Index of the first vertex to use, usually 0.
first_instanceUint32
First instance index, usually 0.
Example
example.cpp
1SDL_DrawGPUPrimitives(pass, 3, 1, 0, 0); // one triangle