SDL_GPUCOMPUTEPIPELINECREATEINFO(3type)
π SDL_GPUComputePipelineCreateInfo π
okay bestie so this is a page from the SDL3 DATATYPES section of the SDL manual, and it's all about one lil struct: SDL_GPUComputePipelineCreateInfo. It's giving "paperwork but make it gpu" π
β¨ NAME β¨
SDL_GPUComputePipelineCreateInfo β a structure specifying the parameters of a compute pipeline state.
Like, it's the lil info card you hand over when you want SDL to build you a compute pipeline. No cap. π«Ά
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_gpu.h>
typedef struct SDL_GPUComputePipelineCreateInfo
{
size_t code_size; /**< The size in bytes of the compute shader code pointed to. */
const Uint8 *code; /**< A pointer to compute shader code. */
const char *entrypoint; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */
SDL_GPUShaderFormat format; /**< The format of the compute shader code. */
Uint32 num_samplers; /**< The number of samplers defined in the shader. */
Uint32 num_readonly_storage_textures; /**< The number of readonly storage textures defined in the shader. */
Uint32 num_readonly_storage_buffers; /**< The number of readonly storage buffers defined in the shader. */
Uint32 num_readwrite_storage_textures; /**< The number of read-write storage textures defined in the shader. */
Uint32 num_readwrite_storage_buffers; /**< The number of read-write storage buffers defined in the shader. */
Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */
Uint32 threadcount_x; /**< The number of threads in the X dimension. This should match the value in the shader. */
Uint32 threadcount_y; /**< The number of threads in the Y dimension. This should match the value in the shader. */
Uint32 threadcount_z; /**< The number of threads in the Z dimension. This should match the value in the shader. */
SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
} SDL_GPUComputePipelineCreateInfo;
π¦ DESCRIPTION π¦
so basically, every field in this struct is a lil fact about your compute shader that SDL needs to know before it can do its thing. Let's go through them one by one, no skipping, we're thorough in this house π
size_t code_sizeβ the size in bytes of the compute shader code that's being pointed to. Yes bestie, in bytes, it said what it said.const Uint8 *codeβ a pointer to the actual compute shader code. There it is. The whole point.const char *entrypointβ a pointer to a null-terminated UTF-8 string that specifies the entry point function name for the shader. So like, which function do we start at? Tell it. Be specific.SDL_GPUShaderFormat formatβ the format of the compute shader code.Uint32 num_samplersβ the number of samplers defined in the shader.Uint32 num_readonly_storage_texturesβ the number of readonly storage textures defined in the shader.Uint32 num_readonly_storage_buffersβ the number of readonly storage buffers defined in the shader.Uint32 num_readwrite_storage_texturesβ the number of read-write storage textures defined in the shader.Uint32 num_readwrite_storage_buffersβ the number of read-write storage buffers defined in the shader.Uint32 num_uniform_buffersβ the number of uniform buffers defined in the shader.Uint32 threadcount_xβ the number of threads in the X dimension. β οΈ This should match the value in the shader. Don't lie to it.Uint32 threadcount_yβ the number of threads in the Y dimension. Again: this should match the value in the shader.Uint32 threadcount_zβ the number of threads in the Z dimension. You already know: this should match the value in the shader.
and then, the plot twist of it all:
SDL_PropertiesID propsβ a properties ID for extensions. Should be0if no extensions are needed. Like, zero. The number zero. If you're not doing extensions, it's a0, periodt. π
lowkey important: those three threadcount_* fields are not vibes-based. They should match the value in the shader, fr fr. Mismatches are not the move. π
β AVAILABILITY β
This struct is available since SDL 3.2.0. So if you're on something older than that... yeah. Upgrade era. π
π SEE ALSO π
and that's the whole page bestie, you ate it, go build a compute pipeline π§β¨
Simple Directmedia Layer β’ SDL 3.4.18 β mwah, that's the version and the source, ty for coming to my ted talk, ily, bye πππ
π¦ 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