ComposeOptions
Interface in Variants
Options for composeModule.
import type { ComposeOptions } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
interface ComposeOptions { readonly allowUnswapped?: boolean;}Description
The default is strict: a placeholder that receives no swap and a swap key that matches no placeholder are both errors at compose time.
Strictness matters because a placeholder left in place is easy to miss. The WGSL emitter
writes it as a bare // __placeholder: <tag> comment and the shader still compiles and
renders, while the GLSL emitter and compileModule (the same module evaluated on the
CPU in double precision) throw only when they reach it. Set allowUnswapped only when
leaving a placeholder open is deliberate.
Instance properties
allowUnswappedoptionalread onlybooleanLet a placeholder with no matching swap stay in the module. The WGSL emitter writes it as the comment
// __placeholder: <tag>; the GLSL emitter andcompileModulethrow when they reach it. Off by default, where an un-swapped placeholder is a compose-time error.
See also
Source
src/core/passes/compose.ts, line 25, at commit 26de7be8