ExternVarDecl
인터페이스, IR 분류
A host-provided global, the declaration behind externVar.
import type { ExternVarDecl } from 'typeshade'
시그니처, 설명, 예제는 커밋 c66579bf의 컴파일러 소스에서 그대로 가져온 영어 원문입니다.
구문
interface ExternVarDecl { readonly name: string; readonly type: ShaderType; readonly spelling?: { readonly wgsl?: string; readonly glsl?: string }; readonly stage?: 'vertex' | 'fragment' | 'compute';}설명
A host-provided global, the declaration behind externVar. It is the variable
counterpart of externFn.
It emits nothing on either backend: the host’s prelude declares the symbol. The
declaration exists so that reads of it type-check, survive renaming, and appear in
reflect().requires, where a host can check them against what its prelude provides.
spelling maps the logical name onto what each target writes, so moving to a host
that exposes the same value differently (a WGSL struct member or a bound uniform in
place of a GLSL prelude global) is a change to the spelling map and leaves the shader
source alone.
인스턴스 속성
name읽기 전용stringtype읽기 전용ShaderTypespelling선택 사항읽기 전용{ readonly wgsl?: string; readonly glsl?: string }Per-target spelling. A missing side falls back to
name.stage선택 사항읽기 전용'vertex' | 'fragment' | 'compute'Restrict the symbol to one stage, for a host global only that stage’s prelude provides. Advisory metadata for
reflect().requires; nothing gates on it.
함께 보기
소스
src/core/ir/nodes.ts, 565행, 커밋 c66579bf 기준