Skip to content

SDL_GPURenderPass

A single pass of drawing commands with color/depth attachments. Freed after end() or GC.

bind_pipeline(pipeline) function

Bind a previously created graphics pipeline (shaders, states, vertex layouts, etc.).

pipeline: The SDL_GPUGraphicsPipeline

Returns: None

viewport(rect) function

Set the viewport for clipping or scaling draws, in pass-local coordinates.

rect: {x,y,w,h}

Returns: None

scissor(rect) function

Set a scissor rectangle for discarding pixels outside it.

rect: {x,y,w,h}

Returns: None

draw(primitiveType, baseVertex, firstVertex, vertexCount) function

Issue a non-indexed draw call.

primitiveType: e.g. SDL_GPU_PRIMITIVETYPE_TRIANGLELIST

baseVertex: Starting vertex offset.

firstVertex: The first vertex to draw.

vertexCount: How many vertices to draw.

Returns: None

draw_indexed(primitiveType, baseVertex, firstIndex, indexCount, instanceCount) function

Issue an indexed draw call from the bound index buffer.

primitiveType: The primitive type constant.

baseVertex: Offset in the vertex buffer.

firstIndex: Which index to start from.

indexCount: Number of indices to draw.

instanceCount: For instanced drawing, or 1 if normal.

Returns: None

end() function

End this render pass, finalizing the draw operations.

Returns: None

bind_index_buffer(buffer, elementSize16bit) function

Bind an index buffer inside this pass, possibly overriding the global one.

buffer: The SDL_GPUBuffer

elementSize16bit: If 2, uses 16-bit indices; if 4, uses 32-bit indices

Returns: None

bind_buffers(firstSlot, arrayOfBuffers) function

Bind multiple vertex buffers at consecutive slots.

firstSlot: The starting vertex buffer slot.

arrayOfBuffers: An array of GPUBuffer objects

Returns: None

bind_samplers(vertexOrFragment, firstSlot, samplerBindings) function

Bind multiple texture/sampler pairs to either vertex or fragment slots.

vertexOrFragment: Boolean, true for vertex stage, false for fragment.

firstSlot: The first sampler slot to bind.

samplerBindings: An array of {texture, sampler}.

Returns: None

bind_storage_buffers(firstSlot, buffers) function

Bind one or more storage buffers for read/write in the pipeline.

firstSlot: Starting buffer slot index.

buffers: An array of SDL_GPUBuffer objects.

Returns: None

bind_storage_textures(firstSlot, textures) function

Bind one or more storage textures for read/write in the pipeline.

firstSlot: Starting texture slot index.

textures: An array of SDL_GPUTexture objects.

Returns: None