Skip to main content

compose

Function compose 

Source
pub fn compose(
    module: &str,
    features: &[(&'static str, bool)],
    replacement: Option<&str>,
) -> Result<String, ComposeError>
Expand description

Compose module of the built-in WESL package into one WGSL module.

module names a top-level module of the package (lit, line, blit, …). features are the conditional-compilation flags set before composing; the module’s own declarations — its entry points among them — stay under their own names, so a pipeline can address them.

When replacement is Some, that source replaces the package’s own copy of module: it is mounted at exactly that one path, so the imports around it (unlit_wgpu::… and the shader’s own package::… alike) still resolve to the package that owns them. It is how a caller’s snippets are spliced into an entry shader without that shader gaining a private copy of the compiler.