HLSL to GLSL shader language translator
DX9 style HLSL in, GLSL / GLSL ES out.
For an opposite tool (GLSL ES to HLSL translator), look at Google's ANGLE.
See badly maintained change log.
- Only Direct3D 9 style HLSL is supported. No Direct3D 10/11 "template like" syntax, no geometry/tesselation/compute shaders, no abstract interfaces.
- I bumped into some issues of HLSL2GLSL's preprocessor that I am not fixing. Most issues were with token pasting operator. So I preprocess source using mojoshader's preprocessor. Grab latest from mojoshader hg, it's awesome!
- On Windows, the library is built with
_HAS_ITERATOR_DEBUGGING=0,_SECURE_SCL=0defines, which affect MSVC's STL behavior. If this does not match defines in your application, totally strange things can start to happen!
- The library is not currently thread-safe.
Used in Unity and bitsquid engine, and seems to work quite ok.
Support for DX11 features will probably not be added due to the bad condition the original code is in (very obscure and inefficient), instead maybe a new cross-compiler will be made.
No optimizations are performed on the generated GLSL, so it is expected that your platform will have a decent GLSL compiler. Or, use GLSL Optimizer, at Unity we use it to optimize shaders produced by HLSL2GLSL; gives a substantial performance boost on mobile platforms.