SDL_GPUVertexAttribute(3type)
π SDL_GPUVertexAttribute β ok bestie, let's talk vertex attributes
Manual name: SDL3 DATATYPES β¨ (yes it's a type page, not a function page, and that's on purpose, slay)
πΈ NAME πΈ
SDL_GPUVertexAttribute β a structure specifying a vertex attribute. it's giving "one little piece of data about one little vertex" π
β¨ SYNOPSIS β¨
#include <SDL3/SDL_gpu.h>
typedef struct SDL_GPUVertexAttribute
{
Uint32 location; /**< The shader input location index. */
Uint32 buffer_slot; /**< The binding slot of the associated vertex buffer. */
SDL_GPUVertexElementFormat format; /**< The size and type of the attribute data. */
Uint32 offset; /**< The byte offset of this attribute relative to the start of the vertex element. */
} SDL_GPUVertexAttribute;
okay so real quick, field by field, no gatekeeping π«Ά
locationβ the shader input location index. this is the lil number that tells the shader which input slot you're feeding πbuffer_slotβ the binding slot of the associated vertex buffer. which buffer are we pulling from, bestie? π¦formatβ the size and type of the attribute data, as anSDL_GPUVertexElementFormat. it's giving "how big, and what kind" πoffsetβ the byte offset of this attribute relative to the start of the vertex element. the little scootch from the beginning of the element πΈ
π DESCRIPTION π
THE ONE RULE: all vertex attribute locations provided to an SDL_GPUVertexInputState must be unique.
not me saying it twice because it matters. every single location you hand to an SDL_GPUVertexInputState has to be different from every other one. no duplicates, no twinning, no copy-paste oopsies. π
bestie this is not a suggestion, it's a requirement. two attributes sharing a location is a vibe check you will FAIL. π
π AVAILABILITY π
this struct is available since SDL 3.2.0. periodt. π
π SEE ALSO π
SDL_GPUVertexBufferDescription(3type)SDL_GPUVertexInputState(3type)SDL_GPUVertexElementFormat(3type)
go read those too, they're all in the same friend group π
sign-off time β¨ brought to you by Simple Directmedia Layer, version SDL 3.4.18, and this page is literally titled SDL_GPUVertexAttribute(3type). ily, go slay your vertex buffers π¦ππΈ
π¦ 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