Emit

Emit

30 members

The WGSL and GLSL ES 3.00 writers, module fragments and the passes that run before them.

The signature, the description and the examples come from the compiler's own source at commit 26de7be8.

autoVars Function
Turns every value that is later assigned to into a WGSL var.
cse Function
Common-subexpression elimination.
emitBinding Function
Emit one BindingDecl as a WGSL @group(…) @binding(…) var line.
emitConst Function
Emit one ConstDecl as a WGSL const line, without the surrounding module.
emitExpr Function
Emit one Expr as WGSL source text, using wgslBackend with the default 'full' parenthesisation.
emitFragment Function
Emit a ModuleDecl as a WGSL fragment for a host that assembles the final module itself: the declarations and helper functions without the enable directive header and, unless opts.entryPoints is true, without the stage entry points.
EmitFragment Interface
A module emitted without its stage wrapper, plus everything the host must supply or ensure for the result to compile.
emitFunc Function
Emit one FuncDecl as a WGSL function, exactly as given.
emitFuncs Function
Emit a list of functions as WGSL, joined by blank lines, through the same lowering and optimization passes emitModule runs.
emitFuncsCsed Function
Alias of emitFuncs.
emitGlslFragment Function
Emit a module as a GLSL ES 3.00 fragment for a host that owns the program: the declarations and helper functions, without #version, without the precision lines and, by default, without the stage entry point.
emitGlslModule Function
Emit a module as GLSL ES 3.00 source.
emitGlslStages Function
Emit both stages of one module, lowering and optimizing it once.
emitModule Function
Emit a ModuleDecl as a complete WGSL module string, ready for device.createShaderModule.
emitModuleAt Function
Emit a ModuleDecl as WGSL at an explicit optimization level.
EmitOptions Interface
Options accepted by emitModule and emitGlslModule.
EmitPlugin Interface
A transform that runs inside module emit.
emitStruct Function
Emit one StructDecl as a WGSL struct block.
f32Lit Function
Spell v as an f32 literal, in the form WGSL and GLSL share: an integer-looking value gets a .0 suffix so a float context never sees an integer literal.
FragmentDeclares Interface
What a fragment declares in the program it is composed into: the manifest a composer checks its host prelude against.
GlslEmitOptions Interface
The options accepted by emitGlslModule, emitGlslStages and emitGlslFragment: the shared EmitOptions plus three that exist only for GLSL ES 3.00, one for each thing the target lacks.
glslEs300Backend Constant
The GLSL ES 3.00 (WebGL2) Backend.
intLit Function
Spell v as the body of an i32 or u32 literal (no suffix), in the form WGSL and GLSL share.
lowerComputeToFragment Function
Rewrite a gather-only @compute module into a @fragment one that WebGL2 runs as a fullscreen draw into an R32UI target, one texel per invocation.
lowerModule Function
Rewrites every matchExpr in a module into a form the backends can emit: a hoisted variable assigned from a switch statement, placed immediately before the statement that contained the expression.
lowerWgsl Function
Run the passes emitModule runs before writing text (validation, the capability check, autoVars, lowerModule and the optimizer at level) and return the resulting ModuleDecl.
OptLevel Type
A named optimization level, spelled like a C compiler's -O flag.
repack Function
Emit manifest again from the portable IR it carries, with options: the same program, its WGSL, GLSL and layouts byte for byte what the build wrote, and the variants the build did not ask for.
wgslBackend Constant
The WGSL target: a Backend that spells types, literals, intrinsics and module declarations for device.createShaderModule.
wgslType Function
Spell a ShaderType as WGSL type syntax.

Edit this page Report a problem