SDL_GPUInd...DrawCommand(3type)

πŸ’– SDL_GPUIndexedIndirectDrawCommand πŸ’–

okay bestie so this is a page from the SDL3 DATATYPES collection, and today's main character is SDL_GPUInd...DrawCommand β€” yes the title is abbreviated like that, no we don't know why, we just vibe with it. 🫢


✨ NAME ✨

SDL_GPUIndexedIndirectDrawCommand β€” a struct that specifies the parameters of an indexed indirect draw command. it's giving "draw instructions but make them indirect". πŸ’…


✨ SYNOPSIS ✨

#include <SDL3/SDL_gpu.h>

typedef struct SDL_GPUIndexedIndirectDrawCommand
{
    Uint32 num_indices;    /**< The number of indices to draw per instance. */
    Uint32 num_instances;  /**< The number of instances to draw. */
    Uint32 first_index;    /**< The base index within the index buffer. */
    Sint32 vertex_offset;  /**< The value added to the vertex index before indexing into the vertex buffer. */
    Uint32 first_instance; /**< The ID of the first instance to draw. */
} SDL_GPUIndexedIndirectDrawCommand;

look at her. five fields. not one of them extra. iconic. πŸ‘‘


✨ DESCRIPTION ✨

okay so IMPORTANT, listen up: the first_vertex and first_instance parameters are NOT compatible with built-in vertex/instance ID variables in shaders (think SV_VertexID, for example). not "kinda incompatible", not "depends", literally NOT compatible. 😭

why though? because GPU APIs and shader languages do not define these built-in variables consistently. every one of them does its own little thing. 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. periodt. πŸŽ€

like fr fr, if you're out here relying on those built-ins and passing nonzero values, you're not portable, you're just brave. πŸ™ˆ

✨ AVAILABILITY ✨

this struct has been available since SDL 3.2.0. so if you're on something older… bestie. upgrade. 🌈


✨ SEE ALSO ✨


and that's the whole page, no notes, ate and left no crumbs. πŸ’–βœ¨

signing off from the Simple Directmedia Layer crew β€” this was SDL 3.4.18, and the doc itself is dated SDL_GPUInd...DrawCommand(3type), which is a whole mood honestly. πŸ¦‹πŸŽ€πŸ«Ά

πŸ“¦ where this page comes from