SDL_DrawGPUIndexedPrimitives(3)
π SDL_DrawGPUIndexedPrimitives(3) π
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_DrawGPUIndexedPrimitives β she draws stuff with an index buffer AND instancing on, like the overachiever she is β¨
πΈ NAME πΈ
SDL_DrawGPUIndexedPrimitives β draws data using bound graphics state with an index buffer and instancing enabled. no cap, that's literally the whole job description π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_gpu.h>
void SDL_DrawGPUIndexedPrimitives(
SDL_GPURenderPass *render_pass,
Uint32 num_indices,
Uint32 num_instances,
Uint32 first_index,
Sint32 vertex_offset,
Uint32 first_instance);
she's a void, she returns nothing, she simply serves π«Ά
π DESCRIPTION π
okay so first things first, and this is important: you must NOT call this function before binding a graphics pipeline. like, pipeline first, bestie. the vibe check happens in that order, always. π
now for the tea β β the first_vertex and first_instance parameters are NOT compatible with the built-in vertex/instance ID variables in shaders (think SV_VertexID, that kind of thing). and it's not her fault! GPU APIs and shader languages simply do not define these built-in variables consistently, so they're all out here doing their own thing π
so if your shader depends on those built-ins, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls. that's it. that's the rule. periodt π
π FUNCTION PARAMETERS π
render_passβ a render pass handle. your backstage pass, your VIP wristband, the whole vibe ποΈnum_indicesβ the number of indices to draw per instance.num_instancesβ the number of instances to draw. how many copies we're serving today πfirst_indexβ the starting index within the index buffer. where we begin, babes βvertex_offsetβ a value added to the vertex index before indexing into the vertex buffer. a little nudge, a little offset, we love her for it.first_instanceβ the ID of the first instance to draw.
π¦ AVAILABILITY π¦
this function is available since SDL 3.2.0 β¨ so if you're on 3.2.0 or later, you're good, you're golden, you're glowing π
and that's the whole page, bestie!! no SEE ALSO section on this one, she's short and sweet and she knows it π
kisses, and remember: pipeline bound first, 0 for the correlating param, and always, always slay π
Simple Directmedia Layer Β· SDL 3.4.18 Β· SDL_DrawGPUIndexedPrimitives(3) β mwah, bye!! π
πΈπ«Ά
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms