Documentation Index
Fetch the complete documentation index at: https://rive-editor-sidebar-reorg.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
A GPU canvas. Use .image with renderer:drawImage() to composite
the result. Issue GPU draw calls via beginRenderPass().
Fields
image
Backing image for renderer:drawImage().
width
Width in pixels.
height
Height in pixels.
Native pixel format of the canvas backing texture (‘bgra8unorm’ on D3D, ‘rgba8unorm’ elsewhere).
MSAA resolve requires source and target to have identical formats — always
derive GPUTexture and pipeline formats from this value:
local fmt = canvas.format
GPUPipeline.new({ colorTargets = {{ format = fmt }}, sampleCount = 4 })
Methods
resize
resize(width: number, height: number) -> ()
Resize the canvas. Recreates the backing texture and any depth buffer.
beginRenderPass
beginRenderPass(desc: RenderPassDesc?) -> GPURenderPass
Begin a GPU render pass targeting this canvas.
Omitting desc.color renders to the canvas’s own backing texture.
colorView
colorView() -> GPUTextureView
View of the canvas backing texture. Use as a sampler input in a subsequent pass.