Home

WGSLs

WGSLs, shorthand for shader programs written in the WebGPU Shading Language (WGSL), are the shaders used with the WebGPU API. WGSL is the shading language designed for the WebGPU API, providing a safe, portable, and vendor-neutral framework for graphics and compute tasks across web and native implementations.

Design and features: WGSL is strongly typed and uses explicit memory and resource semantics. It defines scalar,

Program structure: Shaders expose entry points annotated with stage information, such as vertex, fragment, or compute.

Status and usage: WGSLs are part of the WebGPU ecosystem and are supported by several WebGPU implementations

See also WebGPU, SPIR-V, GLSL, HLSL.

vector,
and
matrix
types,
including
f32,
i32,
u32,
and
composite
types
like
vec2<f32>,
vec3<f32>,
and
mat4x4<f32>.
It
supports
structs,
arrays,
and
storage
and
uniform
buffers,
textures,
and
samplers.
Resource
bindings
are
declared
with
group
and
binding
qualifiers,
and
shader
inputs/outputs
use
location-like
decorations.
The
language
aims
to
minimize
ambiguity
and
a
safe
memory
model.
Data
exchanged
between
stages
uses
output
and
input
variables
with
location
attributes.
WGSL
requires
explicit
binding
of
resources
and
often
uses
layout
declarations
to
describe
how
buffers,
textures,
and
samplers
are
grouped
and
bound.
These
explicit
qualifiers
help
ensure
consistent
behaviour
across
devices
and
driver
implementations.
and
by
native
projects
such
as
Dawn
and
wgpu.
It
is
intended
to
be
compiled
by
GPU
backends
into
device-specific
instructions.
While
still
evolving,
WGSL
is
the
central
shading
language
for
WebGPU,
providing
a
common
substrate
for
web
graphics,
compute,
and
general
GPU
programming.