WESL Logo

#WESL: Community Extended WGSL

WESL is an extended version of WebGPU’s WGSL shading language.


WESL is fully compatible. Everything you know from WGSL just works.

WESL adds features:

Linkers combine WESL and WGSL modules together for WebGPU.

WESL linkers are available now in both Rust and TypeScript. Use them at runtime or at build time.

#WESL Example

import package::colors::chartreuse;    // 1. modularize shaders in separate files
import random_wgsl::pcg_2u_3f;         // 2. use shader libraries from npm/cargo

fn random_color(uv: vec2u) -> vec3f {
  var color = pcg_2u_3f(uv);

  @if(DEBUG) color = chartreuse;       // 3. set conditions at runtime or build time

  return color;
}

#Who Can Use WESL?

WESL is designed for anyone writing shaders in WebGPU. It’s simple to use in even tiny projects, language and framework agnostic.

WESL is also flexible enough support the needs of more complex frameworks as well including Bevy, TypeGPU, and @timefold/webgpu.

#Tooling

A suite of convenience tools is on the way, including:

#Getting Started

Check out the Getting Started page for installation instructions. It’s very easy! Rust projects can use the wesl crate. JavaScript/TypeScript projects can use the wesl package and bundler plugins.

Visit the Code Examples for demos of WESL usage.

Try compiling WESL online in the WESL Playground.

For a more detailed explanation of the various extensions, visit the Specification.

See also recent Presentations.

#What’s Next for WESL?

You tell us! reflection, generics, swizzles, something else?

Future features are nominated by the community:

The current tools also support some experimental features that we haven’t yet tried to firm up for specification, including: @else conditions, WESL plugin extensions, and more. See the documentation on individual tools in Rust and JavaScript/TypeScript for details.

#Questions, Remarks, Complaints

WESL is still in the early stages of specification and development, so expect frequent updates. We welcome any feedback! The best way to reach us is by opening a GitHub Issue.

Join our Discord Server to get involved or stay up to date with WESL’s development. We are always open to new contributors.