emitFuncs
On this page

emitFuncs()

Function in Emit

Emit a list of functions as WGSL, joined by blank lines, through the same lowering and optimization passes emitModule runs.

import { emitFuncs } from 'typeshade'

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

Syntax

function emitFuncs(funcs: readonly FuncDecl[]): string

Parameters

funcs readonly FuncDecl[]

Return value

string

Description

Constant folding, dead-code removal and reuse binding apply exactly as they would inside a full module, so the text matches the function section emitModule would write for the same declarations.

A bare list of functions is not a complete module, so validation and the capability check are skipped; only the passes the spelling needs run. emitFragment runs the full set when the declarations form a module.

Targets

TargetSupportNotes
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 542, at commit 26de7be8

Edit this page Report a problem