SDL Wiki
(This is the documentation for SDL3, which is under heavy development and the API is changing! SDL2 is the current stable version!)

SDL_CreateGPUShader

Creates a shader to be used when creating a graphics pipeline.

Header File

Defined in <SDL3/SDL_gpu.h>

Syntax

SDL_GPUShader* SDL_CreateGPUShader(
    SDL_GPUDevice *device,
    const SDL_GPUShaderCreateInfo *createinfo);

Function Parameters

SDL_GPUDevice * device a GPU Context.
const SDL_GPUShaderCreateInfo * createinfo a struct describing the state of the shader to create.

Return Value

(SDL_GPUShader *) Returns a shader object on success, or NULL on failure.

Remarks

Shader resource bindings must be authored to follow a particular order depending on the shader format.

For SPIR-V shaders, use the following resource sets:

For vertex shaders:

For fragment shaders:

For DXBC Shader Model 5_0 shaders, use the following register order:

For DXIL shaders, use the following register order:

For vertex shaders:

For pixel shaders:

For MSL/metallib, use the following order:

Version

This function is available since SDL 3.0.0.

See Also


CategoryAPI, CategoryAPIFunction, CategoryGPU


[ edit | delete | history | feedback | raw ]

[ front page | index | search | recent changes | git repo | offline html ]

All wiki content is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).
Wiki powered by ghwikipp.