SDL_DrawGPUIndexedPrimitives - Man Page

Draws data using bound graphics state with an index buffer and instancing enabled.

Header File

Defined in SDL3/SDL_gpu.h

Synopsis

#include "SDL3/SDL.h"

void SDL_DrawGPUIndexedPrimitives(
    SDL_GPURenderPass *render_pass,
    Uint32 num_indices,
    Uint32 num_instances,
    Uint32 first_index,
    Sint32 vertex_offset,
    Uint32 first_instance);

Description

You must not call this function before binding a graphics pipeline.

Note that the first_vertex and first_instance parameters are NOT compatible with built-in vertex/instance ID variables in shaders (for example, SV_VertexID); GPU APIs and shader languages do not define these built-in variables consistently, so if your shader depends on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls.

Function Parameters

render_pass

a render pass handle.

num_indices

the number of indices to draw per instance.

num_instances

the number of instances to draw.

first_index

the starting index within the index buffer.

vertex_offset

value added to vertex index before indexing into the vertex buffer.

first_instance

the ID of the first instance to draw.

Availability

This function is available since SDL 3.2.0.

Info

SDL 3.2.2 Simple Directmedia Layer SDL3 FUNCTIONS