OverrideDecl
이 페이지에서

OverrideDecl

인터페이스, IR 분류

A pipeline specialization constant, the declaration behind overrideConst.

import type { OverrideDecl } from 'typeshade'

시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.

구문

interface OverrideDecl {
readonly name: string;
readonly type: ShaderType;
readonly default: number | boolean;
}

설명

On WGSL it emits a module-scope override name: type = default;, which the host specializes through createRenderPipeline({ constants: { name } }). On GLSL ES 3.00 it emits #define name default after the #version line, and the host specializes it by emitting again with emitGlslModule(m, stage, { overrideValues }). The value is chosen when the pipeline is created, so a single authored module yields as many driver-specialized variants as the host needs, and the driver eliminates the branches a constant turns dead. Only WGSL scalar types are allowed (bool, i32, u32, f32); a vector, matrix, array or struct type is rejected at authoring with SD0014.

인스턴스 속성

name읽기 전용 string
type읽기 전용 ShaderType
default읽기 전용 number | boolean

The default value emitted into the override declaration or #define: the value a pipeline gets when the host supplies nothing for this constant.

함께 보기

소스

src/core/ir/nodes.ts, 406행, 커밋 c66579bf 기준

이 페이지 편집 문제 보고