RenderPass
On this page

RenderPass

Interface in Runtime

A render pass of a frame: draws recorded into it.

import type { RenderPass } from 'typeshade/runtime'

The signature, the description and the examples come from the compiler's own source at commit af54ddad5.

Syntax

interface RenderPass {
readonly raw: object;
draw<B>(pipeline: RenderPipeline<B>, bindings: NoInfer<B>, geometry: Geometry): void;
setViewport( x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number, ): void;
setScissorRect(x: number, y: number, width: number, height: number): void;
setBlendConstant(color: ArrayLike<number>): void;
setStencilReference(reference: number): void;
}

Description

raw is the GPURenderPassEncoder.

Instance properties

rawread only object

Escape hatch (Rule 11.17): the pass’s GPURenderPassEncoder, for the host’s own draws (WebGL2 throws).

Instance methods

draw <B>(pipeline: RenderPipeline<B>, bindings: NoInfer<B>, geometry: Geometry): void

Record a draw: bindings are the ones the pipeline’s entries reach (change 0030).

setViewport (x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): void

WebGPU setViewport. x and y are whole numbers within the viewport bounds. width and height are whole numbers from 0 to the viewport limit. 0 <= minDepth <= maxDepth <= 1. An omitted minDepth is 0, and an omitted maxDepth is 1. Default: the whole attachment. A depth range other than 0 to 1 for a fragment that writes frag_depth is not supported yet on the WebGL2 tier (Rule 11.11). To learn that on WebGPU, run the host a second time with createRuntime({ prefer: ['webgl2'] }).

setScissorRect (x: number, y: number, width: number, height: number): void

WebGPU setScissorRect. Whole numbers from 0 up. A fraction is refused. The rectangle is clipped to a Texture or canvas target. A host GPUTextureView target has no size the runtime knows, so its rectangle passes through and WebGPU validates it. Default: the whole attachment.

setBlendConstant (color: ArrayLike<number>): void

WebGPU setBlendConstant. Four numbers, each from 0 to 1. Default [0, 0, 0, 0] at each pass start. The length is checked. A draw whose pipeline declares blendConstant uses that value instead.

setStencilReference (reference: number): void

WebGPU setStencilReference. A whole number from 0 to 255. A fraction is refused. Default 0 at each pass start. A draw of a pipeline that declares depth.stencil.reference uses that value instead.

Source

src/runtime/runtime.ts, line 168, at commit af54ddad5

Edit this page Report a problem