ExternVarDecl
Interface in IR
A host-provided global, the declaration behind externVar.
import type { ExternVarDecl } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
interface ExternVarDecl { readonly name: string; readonly type: ShaderType; readonly spelling?: { readonly wgsl?: string; readonly glsl?: string }; readonly stage?: 'vertex' | 'fragment' | 'compute';}Description
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.
Instance properties
nameread onlystringtyperead onlyShaderTypespellingoptionalread only{ readonly wgsl?: string; readonly glsl?: string }Per-target spelling. A missing side falls back to
name.stageoptionalread only'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.
See also
Source
src/core/ir/nodes.ts, line 565, at commit 26de7be8