emitModuleAt()
Function in Emit
Emit a ModuleDecl as WGSL at an explicit optimization level.
import { emitModuleAt } from 'typeshade'
The signature, the description and the examples come from the compiler's own source at commit 26de7be8.
Syntax
const emitModuleAt: (m: ModuleDecl, level: OptLevel) => stringParameters
mModuleDecllevelOptLevel
Return value
string
Description
emitModuleAt(m, 'O2')
produces the same string as emitModule(m); 'O0' skips the optimizer and writes the
lowered module as authored; 'O1' runs only the passes that cannot change a computed
value. Useful for debug builds and for comparing emitted size across levels. See
OptLevel.
Targets
| Target | Support | Notes |
|---|---|---|
| WGSL (WebGPU) | Supported | Writes WGSL for WebGPU. |
| GLSL ES 3.00 (WebGL2) | Does not apply | |
| CPU oracle | Does not apply |
See also
Source
src/core/backends/wgsl.ts, line 596, at commit 26de7be8