Universal Shader Translator
Write Once. Deploy Everywhere.
CrossTL is a universal programming language translator that converts shaders and compute kernels across Metal, HLSL, GLSL, Vulkan, CUDA, Rust, and Mojo.
See it in action
Write CrossGL code and translate to any target with a single click.
CrossGL Playground
main.cgl
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);
}311+
Commits
75+
Stars
85+
Forks
321
Tests Passing
How it works
Three steps from CrossGL code to any GPU platform.
01
Write
Author shaders in CrossGL's universal syntax. One language for every target.
02
Translate
Select your target backend. CrossTL generates optimized, idiomatic code.
03
Deploy
Ship to any GPU platform. Metal, DirectX, Vulkan, CUDA, and beyond.
Supported targets
Translate to any major shader and compute language.
Metal
HLSL
GLSL
Vulkan
CUDA
Rust
Mojo
Start building with CrossTL
Get your API key and translate shaders across every major platform in seconds.
