SDL_CreateGPUComputePipeline(3)

✨ NAME ✨

SDL_CreateGPUComputePipeline β€” bestie, this is the one that creates a pipeline object so you can do a whole compute workflow πŸ’…βœ¨

It lives in the SDL3 FUNCTIONS family, and the manual page you're reading is SDL_CreateGPUComputePipeline(3). Hiii, welcome, let's get into it 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_gpu.h>

SDL_GPUComputePipeline * SDL_CreateGPUComputePipeline(
    SDL_GPUDevice *device,
    const SDL_GPUComputePipelineCreateInfo *createinfo);

Two args, one pointer back. Iconic honestly.


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so here's the tea β˜• β€” your shader resource bindings have to be authored in a particular order, and that order depends on which shader format you're rolling with. This is not a suggestion, it's the vibe check your shaders must pass. πŸ”₯

🌈 For SPIR-V shaders

Use these resource sets, in this exact order:

  • 0: Sampled textures, followed by read-only storage textures, followed by read-only storage buffers
  • 1: Read-write storage textures, followed by read-write storage buffers
  • 2: Uniform buffers

πŸŽ€ For DXBC and DXIL shaders

Use this register order:

  • (t[n], space0): Sampled textures, followed by read-only storage textures, followed by read-only storage buffers
  • (u[n], space1): Read-write storage textures, followed by read-write storage buffers
  • (b[n], space2): Uniform buffers

πŸ’œ For MSL/metallib

Use this order:

  • [[buffer]]: Uniform buffers, followed by read-only storage buffers, followed by read-write storage buffers
  • [[texture]]: Sampled textures, followed by read-only storage textures, followed by read-write storage textures

There are optional properties you can hand over through props 🎁 β€” and these are the ones that are supported:

  • SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING: a name that can be displayed in debugging tools.

That's it, that's the list. A cute lil name for your pipeline so the debugger doesn't just call it "thing #4" 😭


πŸ’– FUNCTION PARAMETERS πŸ’–

  • device β€” a GPU Context. Your whole GPU situation lives here, bestie.
  • createinfo β€” a struct describing the state of the compute pipeline to create. This is where you say what you want it to be, no cap.

πŸ‘‘ RETURN VALUE πŸ‘‘

Returns a compute pipeline object on success πŸ’…, or NULL on failure β€” and if you get that NULL, call SDL_GetError() for more information, because she WILL tell you what went wrong. Go read it, fr fr. 🫢


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. If you're on anything older, it's giving... not available, sorry babe. πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

The whole trilogy β€” create it, bind it, release it. Main character energy all around. ✨


Simple Directmedia Layer wrote this whole thing, and the version on this page is SDL 3.4.18 πŸ’– That's the source and the version, folded into one cute lil sign-off. Now go make that compute pipeline, bestie, you got this πŸŒΈπŸ¦‹πŸ’…

πŸ“¦ where this page comes from