Function: expand()
expand(
text,defines):string
Defined in: src/gfx/graphics/webGpu/shader/util/PreprocessorExpr.ts:265
Single-pass identifier expansion.
Replaces each bare identifier in text with its defines value.
- arguments of
defined(X)are preserved (sodefined(FOO)never collapses todefined(1)). true/false/definedkeywords are never substituted.- unknown identifiers pass through unchanged.
- self-referential
#define A A+1does not loop — only the outer scan runs, the substitutedAinside the RHS is not re-expanded.
Function-like macros are not supported; prefer fn in shader code.
Parameters
text
string
defines
Record<string, any>
Returns
string

