EmitFragment
On this page

EmitFragment

Interface in Emit

A module emitted without its stage wrapper, plus everything the host must supply or ensure for the result to compile.

import type { EmitFragment } from 'typeshade'

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

Syntax

interface EmitFragment {
readonly source: string;
readonly preamble: readonly string[];
readonly declares: FragmentDeclares;
readonly requires: readonly string[];
}

Description

Produced by emitFragment (WGSL) and emitGlslFragment (GLSL).

Instance properties

sourceread only string

The header-less source: declarations, helpers, and (unless excluded) entry points.

preambleread only readonly string[]

Directive and precision lines the host must place ahead of source, in order. They are returned as data so a composer can merge and de-duplicate them across fragments.

declaresread only FragmentDeclares

The manifest of what source declares.

requiresread only readonly string[]

Symbols the fragment references but does not define: functions declared with externFn, and variables declared with externVar, spelled for the target. A composer can check this list against what the host actually provides. Function names come from call sites that resolve to neither a module function nor a known intrinsic. Sorted and de-duplicated.

See also

Source

src/core/fragment.ts, line 49, at commit 26de7be8

Edit this page Report a problem