emitModule
On this page

emitModule()

Function in Emit

Emit a ModuleDecl as a complete WGSL module string, ready for device.createShaderModule.

import { emitModule } from 'typeshade'

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

Syntax

const emitModule: (m: ModuleDecl, opts?: EmitOptions) => string

Parameters

m ModuleDecl
optsoptional EmitOptions

Return value

string

Description

Runs validation, the capability check, the lowering passes and the optimizer, then assembles the enable directives, structs, bindings, constants and functions.

opts is an optional EmitOptions: plugins for emit-time transforms such as the production ones on the typeshade/emit-prod subpath, and parens to choose how many parentheses the expressions carry.

Targets

TargetSupportNotes
WGSL (WebGPU) Supported

Writes WGSL for WebGPU.

GLSL ES 3.00 (WebGL2) Does not apply
CPU oracle Does not apply

In the guide

See also

Source

src/core/backends/wgsl.ts, line 573, at commit 26de7be8

Edit this page Report a problem