Write once. Run on every GPU.
CrossTL translates shaders and compute kernels through CrossGL, a universal IR that bridges Metal, DirectX, OpenGL, Vulkan, WebGPU, CUDA, HIP, Rust, Mojo, and more — in both directions.
shader MainShader {
vertex { … }
fragment { … }
}
One source. Every backend.
Write CrossGL and switch targets instantly. Same shader, idiomatic output for each platform.
shader MainShader {
vertex {
input vec3 position;
input vec2 texCoord;
output vec2 vUV;
void main() {
vUV = texCoord;
gl_Position = vec4(position, 1.0);
}
}
fragment {
input vec2 vUV;
output vec4 fragColor;
void main() {
vec3 col = vec3(vUV.x, vUV.y, 0.5);
fragColor = vec4(col, 1.0);
}
}
}#include <metal_stdlib>
using namespace metal;
struct VertexIn {
float3 position [[attribute(0)]];
float2 texCoord [[attribute(1)]];
};
struct VertexOut {
float4 position [[position]];
float2 vUV;
};
vertex VertexOut vertex_main(VertexIn in [[stage_in]]) {
VertexOut out;
out.vUV = in.texCoord;
out.position = float4(in.position, 1.0);
return out;
}
fragment float4 fragment_main(VertexOut in [[stage_in]]) {
float3 col = float3(in.vUV.x, in.vUV.y, 0.5);
return float4(col, 1.0);
}Built for real GPU work
Not a transpiler toy — a production IR with lossless round-trips and full pipeline coverage.
One IR, twelve backends
Author in CrossGL once and emit idiomatic Metal, HLSL, GLSL, SPIR-V, WGSL, CUDA, HIP, Rust, Mojo, and Slang — graphics, compute, and systems targets from a single source.
12 targetsTrue bidirectional round-trips
DirectX, Metal, and OpenGL are first-class source and codegen backends. Import native shaders into CrossGL and back out losslessly — attributes, layouts, and semantics preserved.
Import + exportFull GPU pipeline coverage
Vertex, fragment, compute, geometry, tessellation, mesh/task, and full ray-tracing stages — with cbuffers, UAVs, argument buffers, structured buffers, wave ops, and atomics.
7 shader stagesOpen source, battle-tested
Apache-2.0 and published on PyPI. 321 backend-parity tests keep DirectX, Metal, and GLSL round-trips verified. No CrossGL account or API key required for local use.
321 tests · $0Five stages, one IR
Lex
Tokenize source shaders and kernels.
Parse
Build a typed abstract syntax tree.
Analyze
Type checking and scope resolution.
CrossGL IR
Lower into the universal intermediate representation.
Codegen
Emit idiomatic code for any backend.
Twelve targets and counting
Graphics, web, compute, and systems languages — with bidirectional support on the cornerstone APIs.
Metal
Apple GPU
GraphicsHLSL
DirectX 11 / 12
GraphicsGLSL
OpenGL
GraphicsSPIR-V
Vulkan
GraphicsWGSL
WebGPU
WebGLSL ES
WebGL 2.0
WebSlang
Real-time shading
GraphicsCUDA
NVIDIA compute
ComputeHIP
AMD compute
ComputeRust
GPU-oriented
SystemsMojo
Compute modules
SystemsCrossGL
.cgl IR
IRbi = bidirectional (native import + codegen). WebGL and WGSL are currently codegen targets.
Port whole codebases, both ways
Import existing HLSL, Metal, or GLSL into CrossGL, then re-emit anywhere. For large repos, scan first, translate the project, and get a portability report with diagnostics, artifact provenance, and manual migration actions.
- Reverse-translate native shaders into CrossGL
- Scan repos for portability before you commit
- Project reports with diagnostics and provenance
# scan a repo for portability
$ crosstl scan ./engine --target metal
# translate the whole project
$ crosstl translate-project ./engine \
--target metal \
--report out/report.json
✓ 128 shaders → Metal · 0 blocking issues
# import native HLSL back into CrossGL
$ crosstl translate pbr.hlsl --backend cgl12
Backends
321
Parity tests
7
Shader stages
Apache-2.0
License
Ship one shader everywhere
Install the open-source package and translate across every major GPU platform — no CrossGL account or API key required.