live shader workbench
hologram.bwsl / starfield hologram
BWSL
variants
IR
GPU
shader language / graphics pipeline

BWSL

A shader language for variant-heavy graphics code.

Write the pipeline once, express permutations as typed state, and compile clean specialized shaders for SPIR-V, GLSL, HLSL, and Metal.

Variant space
typed
Backends
4 targets
Runtime
WASM + CLI
Killer Feature

Variants without shader sprawl

Declare the variant space once, use it like normal code, and let the compiler specialize the selected path. GPU Particles uses one pipeline to become a sphere, vortex, or helix without duplicating the shader.

particles.bwsl
Dead code eliminated
65float3 spherePos = float3(
66 sinPhi * cosTheta,
67 cosPhi,
68 sinPhi * sinTheta
69) * baseRadius;
70
71// Add swirl motion
72float swirlAngle = resources.time * 0.5 + t * 6.28318;
73float swirlRadius = 0.1 * sin(resources.time * 2.0 + id * 0.1);
74spherePos.x += cos(swirlAngle) * swirlRadius;
75spherePos.z += sin(swirlAngle) * swirlRadius;
76
77float3 particlePos = spherePos;
78
79if (variants.shape == ParticleShape::Vortex) {
80 float vortexTurn = t * 24.0 + resources.time * 1.2 + id * 0.013;
81 float vortexHeight = (t - 0.5) * 2.6;
82 float vortexRadius = 0.18 + t * 1.05;
83 vortexRadius += 0.12 * sin(resources.time * 2.0 + id * 0.17);
84
85 particlePos = float3(
86 cos(vortexTurn) * vortexRadius,
87 vortexHeight,
88 sin(vortexTurn) * vortexRadius
89 );
90 particlePos.xz += float2(cos(theta), sin(theta)) * 0.08 * sin(resources.time + id * 0.09);
91} else if (variants.shape == ParticleShape::Helix) {
92 float helixTurn = t * 25.13274123 + resources.time * 0.95;
93 float helixAxis = (t - 0.5) * 2.1;
94 float strandPhase = fract(id * 0.5) < 0.5 ? 0.0 : 3.14159265;
95 float helixRadius = 0.32 + 0.05 * sin(t * 12.56637 + resources.time * 1.4);
96
97 particlePos = float3(
98 helixAxis,
99 cos(helixTurn + strandPhase) * helixRadius,
100 sin(helixTurn + strandPhase) * helixRadius
101 );
102 particlePos.y += 0.04 * sin(resources.time * 2.0 + id * 0.05);
103}

Built for Modern Graphics

Shader work has outgrown simple text files. BWSL gives passes, resources, and variants a first-class language.

Tame Variant Sprawl

Declare axes once, branch normally, and let the compiler generate the exact shader paths.

Pipeline-First Design

Passes, targets, and render state live beside the shader code that uses them.

Type-Safe Bindings

Validate uniforms, structs, and resource layouts at compile time, not runtime.

Cross-Platform Output

Target SPIR-V, GLSL, HLSL, and Metal Shading Language from a single codebase.

Modern Ergonomics

Use modules, imports, and compile-time evaluation without sacrificing GPU-level control.

Rich Standard Library

Drop-in helpers for math, color, noise, PBR, and post-processing.

A Quick Tour

Start with variants, then layer in the language features that make them scale.

Variantsvariants.bwsl
pipeline Particles {
enum ParticleShape {
Sphere
Vortex
Helix
}
variants {
shape: ParticleShape = ParticleShape::Sphere;
}
pass "MainPass" {
vertex {
float3 particlePos = spherePos;
if (variants.shape == ParticleShape::Vortex) {
particlePos = vortexPosition(...);
} else if (variants.shape == ParticleShape::Helix) {
particlePos = helixPosition(...);
}
}
}
}

Production Ready. Open Source.

Built for the Real World

BWSL was built because modern rendering engines need more than isolated GLSL or HLSL strings. The language is designed from the ground up to understand pipelines, resources, and variants natively.

The compiler ships as a fast, native CLI for Windows, macOS, and Linux, alongside a WASM build that powers the browser playground.

Permissive License

Use BWSL anywhere: personal experiments, open-source engines, or commercial AAA titles. The Apache 2.0 license gives you the freedom and legal protection to build with confidence.

The compiler, standard library, and playground are entirely open source and available on GitHub.

License summary
  • Commercial and private use
  • Modification and distribution
  • Express patent grant from contributors
  • License and copyright notice required
  • Changes must be documented

Start writing better shaders

Read the language guide or jump straight into the interactive browser playground.