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 onlyobjectEscape 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): voidRecord a draw:
bindingsare the ones the pipeline’s entries reach (change 0030).setViewport(x: number, y: number, width: number, height: number, minDepth?: number, maxDepth?: number): voidWebGPU 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
minDepthis 0, and an omittedmaxDepthis 1. Default: the whole attachment. A depth range other than 0 to 1 for a fragment that writesfrag_depthis not supported yet on the WebGL2 tier (Rule 11.11). To learn that on WebGPU, run the host a second time withcreateRuntime({ prefer: ['webgl2'] }).setScissorRect(x: number, y: number, width: number, height: number): voidWebGPU setScissorRect. Whole numbers from 0 up. A fraction is refused. The rectangle is clipped to a Texture or canvas target. A host
GPUTextureViewtarget has no size the runtime knows, so its rectangle passes through and WebGPU validates it. Default: the whole attachment.setBlendConstant(color: ArrayLike<number>): voidWebGPU 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
blendConstantuses that value instead.setStencilReference(reference: number): voidWebGPU 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.referenceuses that value instead.
Source
src/runtime/runtime.ts, line 168, at commit af54ddad5