Skip to main content

Module compose

Module compose 

Source
Expand description

Composing a WESL module of the built-in shader package into WGSL.

Every built-in entry shader — lit, line, blit, fullscreen_vertex — is a module of the package generated at build time from shaders/*.wesl. This module is the one place that turns one of them into a WGSL string: it sets the conditional-compilation flags, keeps the module’s own entry points, and, when a caller extends a shader, mounts the spliced source in place of the package’s copy. Both the built-in pipelines and a caller’s own pipeline reach the same facilities here; nothing in the composition is private to one built-in implementation.

Enums§

ComposeError
Failure reasons reported by compose.

Constants§

FRAGMENT_HOOK
The comment the built-in entry shaders mark their fragment-stage splice with.
MODULE_HOOK
The comment the built-in entry shaders mark their module-scope splice with.
VERTEX_HOOK
The comment the built-in entry shaders mark their vertex-stage splice with.

Functions§

compose
Compose module of the built-in WESL package into one WGSL module.
splice
source with each hook mark replaced by the snippet belonging to it.
splice_at 🔒
source with the line carrying the first mark replaced by snippet.