shadercross.online
A tiny online API that compiles HLSL shaders to SPIR-V, MSL, or DXIL — powered by SDL_shadercross, the official cross-compiler for the SDL3 GPU API.
You may use this API for quick compilation of HLSL shaders to one of the 3 platform specific (DXIL, SPIR-V, MSL) shader formats. This may come in handy if you don't want to build SDL_shadercross or have problems doing so, as it's quite big and could be tricky to build. Offline shader compilation is also useful if you don't want to include SDL_shadercross as runtime dependency.
Please, use API fairly - there are rate limits that you may hit if you use it too much, as it's provided free of charge. Your request also may be stalled for some time if existing "workers" are overloaded.
API Endpoint:
POST
https://shadercross.online/compile/hlsl/{target}/{shader_type}
Where:
-
target- one of possible output formats:spirv,msl,dxilorjsonfor metadata only -
shader_type- one of possible shader types:vertex,fragment -
entrypoint- optional query parameter, specifies the entrypoint of the shader. Default ismain -
debug- optional query parameter, if set totrue, the compiler will generate debug information in the output shader. Default isfalse
HLSL shader code should be sent as-is in text as request body. Response will be either
text/plain (MSL), application/octet-stream (SPIR-V, DXIL) or application/json depending on the target format.
Both shader source code and compilation result are deleted right after the request is finished.
Example usage (via curl)
Compile HLSL to SPIR-V (binary):
curl --data-binary @shader.hlsl -H "Content-Type: text/plain" \
"https://shadercross.online/compile/hlsl/spirv/vertex" -o out.spv
Compile HLSL to Metal (text), custom entrypoint:
curl --data-binary @shader.hlsl -H "Content-Type: text/plain" \
"https://shadercross.online/compile/hlsl/msl/fragment?entrypoint=PSMain"