Skip to main content

splice

Function splice 

Source
pub fn splice(
    source: &str,
    module: &str,
    vertex: &str,
    fragment: &str,
) -> String
Expand description

source with each hook mark replaced by the snippet belonging to it.

The splice happens on WESL, before anything is parsed or compiled, so a snippet takes part in the same conditional compilation as the code around it and a diagnostic inside one points at the line it was written on.

ยงPanics

If source does not carry all three marks. They are checked rather than trusted because a mark is a bare comment: losing one while editing a shader would otherwise silently drop every snippet aimed at it.