SDL_GPUINDIRECTDRAWCOMMAND(3type)
π SDL_GPUIndirectDrawCommand π
okay bestie, welcome to the SDL3 datatypes section of the manual, and today's main character is SDL_GPUIndirectDrawCommand β literally the glow-up struct you hand to the GPU when you want it to draw stuff indirectly. no cap. β¨
β¨ NAME β¨
SDL_GPUIndirectDrawCommand β a structure specifying the parameters of an indirect draw command. it's giving "here's the recipe, GPU, you do the cooking" π
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_gpu.h>
typedef struct SDL_GPUIndirectDrawCommand
{
Uint32 num_vertices; /**< The number of vertices to draw. */
Uint32 num_instances; /**< The number of instances to draw. */
Uint32 first_vertex; /**< The index of the first vertex to draw. */
Uint32 first_instance; /**< The ID of the first instance to draw. */
} SDL_GPUIndirectDrawCommand;
look at her. four little Uint32s, zero drama, maximum power. π
π DESCRIPTION π
okay so here's the tea you actually need, and it's important, so sit down π«Ά
the first_vertex and first_instance parameters are NOT compatible with the built-in vertex/instance ID variables in shaders (think stuff like SV_VertexID, iykyk). like, at all. not even a little.
the reason is so unserious: GPU APIs and shader languages just do not define these built-in variables consistently across the board. so if your shader is out here depending on them, the only way to keep behavior consistent and portable is to always pass 0 for the correlating parameter in the draw calls. always. no exceptions, bestie. π
fr fr, this is one of those "it works on my machine" traps that will absolutely humble you on a different backend. pass 0 and stay safe. π
β AVAILABILITY β
this struct is available since SDL 3.2.0. she's not new new, but she's not ancient either. a modern icon. π
π¦ SEE ALSO π¦
SDL_DrawGPUPrimitivesIndirect(3)β go read it, it's her bestie π
and that's the whole page!! mwah π
Simple Directmedia Layer wrote this one, it's from SDL 3.4.18, and it lives in the SDL_GPUIndi...DrawCommand(3type) corner of the manual β okay bye, go pass 0 in your draw calls, ily!! πβ¨π
π¦ 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