Documentation Index
Fetch the complete documentation index at: https://rive-update-scripting-docs-503.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
A GPU canvas — a 1× presentation target, same role as a WebGPU surface
texture. Use .image with renderer:drawImage() to composite the
result. Render to it via context:beginRenderPass({ color = {{ view = canvas:colorView(), ... }} }). MSAA requires a user-allocated
GPUTexture.new({ sampleCount = N, renderTarget = true }) as the
color view, with the canvas’s colorView() set as resolveTarget.
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 1× backing texture. Any
user-allocated MSAA / depth textures must be recreated by the
script to match the new dimensions.
colorView
colorView() -> GPUTextureView
View of the canvas backing texture. Use as a color attachment, an
MSAA resolve target, or a sampler input in a subsequent pass.