# SDL_GPURenderPass

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


### bind_pipeline(pipeline) <sub>function</sub>

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



**pipeline**: The SDL_GPUGraphicsPipeline


**Returns**: None


### viewport(rect) <sub>function</sub>

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



**rect**: {x,y,w,h}


**Returns**: None


### scissor(rect) <sub>function</sub>

Set a scissor rectangle for discarding pixels outside it.



**rect**: {x,y,w,h}


**Returns**: None


### draw(primitiveType, baseVertex, firstVertex, vertexCount) <sub>function</sub>

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) <sub>function</sub>

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() <sub>function</sub>

End this render pass, finalizing the draw operations.



**Returns**: None


### bind_index_buffer(buffer, elementSize16bit) <sub>function</sub>

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) <sub>function</sub>

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) <sub>function</sub>

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) <sub>function</sub>

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) <sub>function</sub>

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

