RenderState
인터페이스, 런타임 분류
The fixed-function state of a render pipeline, which the host writes: the compiler knows its entries' inputs and outputs, and the runtime fills and checks those.
import type { RenderState } from 'typeshade/runtime'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface RenderState { readonly vertex?: string; readonly fragment?: string | null; readonly targets?: readonly TargetState[]; readonly depth?: { readonly format: string; readonly compare?: string; readonly write?: boolean; }; readonly primitive?: { readonly topology?: string; readonly cullMode?: 'none' | 'front' | 'back'; readonly frontFace?: 'ccw' | 'cw'; }; readonly multisample?: { readonly count?: number }; readonly constants?: Constants;}인스턴스 속성
vertex선택 사항읽기 전용stringThe vertex entry; the program’s only one when omitted.
fragment선택 사항읽기 전용string | nullThe fragment entry; the program’s only one when omitted, none for a depth-only pass.
targets선택 사항읽기 전용readonly TargetState[]One per colour output, by location. Omitted:
rgba8unormfor each.depth선택 사항읽기 전용{ readonly format: string; readonly compare?: string; readonly write?: boolean; }The depth attachment’s format, and how the pipeline tests and writes it:
comparedefaults to'less'andwritetotrue. A reversed projection compares'greater', and a pass drawn behind everything else (a sky) compares'always'and does not write. Omitted: no depth test, for a pass with no depth attachment.primitive선택 사항읽기 전용{ readonly topology?: string; readonly cullMode?: 'none' | 'front' | 'back'; readonly frontFace?: 'ccw' | 'cw'; }What the vertices make:
topologydefaults to'triangle-list',cullModeto'none'andfrontFaceto'ccw'.multisample선택 사항읽기 전용{ readonly count?: number }The sample count of the targets it draws into: 1 when omitted, 4 for a multisampled target.
constants선택 사항읽기 전용ConstantsThe values of the program’s overrides (surface §15), by the names the source declares:
{ quality: 3 }. The vertex and the fragment stage are each created with them, as WebGPU’sconstants. An override the record leaves out takes the default its declaration states, so omitted, every override does. Anf32takes a finite number no larger than 3.4028234663852886e38 in magnitude, ani32or au32a whole number in its range, and aboola boolean or a number, where 0 is false. A name the program does not declare is aTypeErrorthat names the program’s overrides, and a value its type cannot hold one that says what the type takes. Two states that differ in an override are two pipelines, and the same values give the same pipeline back.
소스
src/runtime/program.ts, 64행, 커밋 c66579bf 기준