> ## Documentation Index
> Fetch the complete documentation index at: https://rive.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# GPURenderPass

An active render pass. Issue all draw calls before calling finish().

## Methods

### `setPipeline`

<div class="signature">
  ```lua theme={null}
  setPipeline(pipeline: GPUPipeline) -> ()
  ```
</div>

Bind a pipeline for subsequent draw calls.

### `setVertexBuffer`

<div class="signature">
  ```lua theme={null}
  setVertexBuffer(slot: number, buffer: GPUBuffer) -> ()
  ```
</div>

Bind a vertex buffer to slot (0-based).

### `setIndexBuffer`

<div class="signature">
  ```lua theme={null}
  setIndexBuffer(buffer: GPUBuffer, format: ('uint16' | 'uint32')?) -> ()
  ```
</div>

Bind an index buffer. format defaults to 'uint16'.

### `setBindGroup`

<div class="signature">
  ```lua theme={null}
  setBindGroup(groupIndex: number, bg: GPUBindGroup, dynamicOffsets: {number}?) -> ()
  ```
</div>

Bind a pre-created BindGroup to a group slot.
dynamicOffsets: one byte offset per dynamic UBO in this group
(dynamic UBOs are declared on the pipeline via
`BindGroupLayoutEntry.hasDynamicOffset`). Order matches the UBOs' appearance
in `BindGroupDesc.ubos`. Typical 3D pattern: shared texture
BindGroup at group 1, per-object UBO dynamic offset at group 0.

### `setViewport`

<div class="signature">
  ```lua theme={null}
  setViewport(x: number, y: number, w: number, h: number) -> ()
  ```
</div>

Set the render viewport in pixels. Origin is top-left on all backends except GL (bottom-left).

### `setScissorRect`

<div class="signature">
  ```lua theme={null}
  setScissorRect(x: number, y: number, w: number, h: number) -> ()
  ```
</div>

Set the scissor rectangle in pixels.

### `setStencilReference`

<div class="signature">
  ```lua theme={null}
  setStencilReference(ref: number) -> ()
  ```
</div>

Set the stencil reference value.

### `setBlendColor`

<div class="signature">
  ```lua theme={null}
  setBlendColor(r: number, g: number, b: number, a: number) -> ()
  ```
</div>

Set the constant blend color for 'constant' / 'one-minus-constant' factors.

### `draw`

<div class="signature">
  ```lua theme={null}
  draw(vertexCount: number, instanceCount: number?, firstVertex: number?) -> ()
  ```
</div>

Non-indexed draw. instanceCount defaults to 1, firstVertex to 0.

### `drawIndexed`

<div class="signature">
  ```lua theme={null}
  drawIndexed(indexCount: number, instanceCount: number?, firstIndex: number?) -> ()
  ```
</div>

Indexed draw. instanceCount defaults to 1, firstIndex to 0.

### `finish`

<div class="signature">
  ```lua theme={null}
  finish() -> ()
  ```
</div>

Submit the pass. Any further method calls on this object will error.
