SDL_PushGPUVertexUniformData(3)

πŸ’– SDL_PushGPUVertexUniformData(3) πŸ’–

okay bestie, so this one is a function from the SDL3 FUNCTIONS crew, and it's literally the "here's your data, babe" moment for vertex uniforms. no cap.


✨ NAME ✨

SDL_PushGPUVertexUniformData β€” pushes data to a vertex uniform slot on the command buffer. it's giving "delivery girl but for GPU data" πŸŽ€


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_gpu.h>

void SDL_PushGPUVertexUniformData(
    SDL_GPUCommandBuffer *command_buffer,
    Uint32 slot_index,
    const void *data,
    Uint32 length);

returns void, so she does her job and doesn't even ask for a thank you. iconic behavior tbh πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so like, every draw call that comes after this in the same command buffer is gonna use this uniform data. that's the whole vibe. subsequent draw calls in this command buffer will use this uniform data. periodt.

now here's the part where you gotta pay attention, bestie, because this is the lowkey trap:

the data you push has to respect std140 layout conventions. in practical terms that means you must make sure your vec3 and vec4 fields are 16-byte aligned. no "but it looked fine on my machine", fr fr. align them.

and if you wanna know the detailed tea about how a shader actually reaches in and grabs uniform data, go read up on SDL_CreateGPUShader. she's the source of truth. πŸ‘‘


πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • command_buffer β€” a command buffer. that's the lil clipboard of GPU to-dos you're writing into 🫢
  • slot_index β€” the vertex uniform slot you wanna push data to. pick your slot, bestie ✨
  • data β€” client data to write. this is your payload, your lil package πŸ“¦
  • length β€” the length of the data to write. tell her how much she's carrying, don't make her guess 😭

🌈 AVAILABILITY 🌈

this cutie has been available since SDL 3.2.0. so if you're on anything older… girl. upgrade. πŸ™ˆ



Simple Directmedia Layer 🩷 SDL 3.4.18 β€” mwah, that's the version tag, and this whole page was cooked up on that SDL 3.4.18 date stamp. go forth and push those uniforms, main character. slay πŸ’œπŸ¦‹βœ¨

πŸ“¦ where this page comes from