GPU: device & frameSDL 3.2

SDL_BindGPUGraphicsPipeline

Selects the pipeline (shaders + fixed settings) for the next draw calls in this pass.

Signature

void SDL_BindGPUGraphicsPipeline(SDL_GPURenderPass *render_pass, SDL_GPUGraphicsPipeline *graphics_pipeline);

How it works

A pipeline bundles everything about HOW to draw: the vertex and fragment shaders, the vertex layout, blending, culling, depth testing. Binding it is cheap; creating it (SDL_CreateGPUGraphicsPipeline) is expensive, so create all pipelines at load time.

Parameters

render_passSDL_GPURenderPass *

The open render pass.

graphics_pipelineSDL_GPUGraphicsPipeline *

The pipeline to use.

Example

example.cpp
1SDL_BindGPUGraphicsPipeline(pass, pipeline);
2SDL_BindGPUVertexBuffers(pass, 0, &vb, 1);
3SDL_DrawGPUPrimitives(pass, 3, 1, 0, 0);
Official SDL wiki