WESL Logo

Simple Templating

(TBD)

Several community projects have found the need to modify WGSL at runtime or compile time based on variables known to the host code.

For example the host code might a the WorkgroupSize for use in WGSL @workgroup_size() declarations, or set the BlockSize for WGSL arrays in an image processing algorithm, or even set the array type for a generic function.

Typically the the host code passes a record of name-value pairs, and corresponding names are replaced in the WGSL code.

WGSL supports override declarations for a similar purpose, but overrides are not applicable everywhere in WGSL.

Issues