HLSL to GLSL language translator based on ATI's HLSL2GLSL. Used in Unity.
Перейти к файлу
scrawl 5a30d2c9df GCC compiling fix (std::abs) 2012-04-20 19:55:36 +02:00
OGLCompilersDLL cleanup 2010-10-12 16:18:55 +03:00
hlslang GCC compiling fix (std::abs) 2012-04-20 19:55:36 +02:00
hlslang.xcodeproj mac: turn off RTTI, exceptions, switch to -O3 2011-07-06 13:46:55 +03:00
include option to emit GLES-like precision qualifiers; breaks the interface. Might not work. 2010-10-13 12:16:13 +03:00
tests tests: update after output changes 2012-02-19 18:21:52 +02:00
tools initial hlsl2glsl from ATI 2010-02-23 14:26:22 +02:00
.gitignore update gitignore for cmake 2011-08-16 16:12:46 +03:00
CMakeLists.txt linux: cmake fixes 2011-08-16 16:36:32 +03:00
LICENSE.txt cleanup license file 2010-10-12 16:11:02 +03:00
README.md Updated README to reflect the fact that the library is not thread-safe. 2011-12-19 16:43:42 -05:00
hlslang.sln tests: MSVC tester 2010-07-28 10:28:55 +03:00
hlslang.vcproj remove useless include file 2010-07-28 15:15:40 +03:00

README.md

HLSL to GLSL shader language translator

DX9 style HLSL in, GLSL / GLSL ES out.

A continued development from ATI's HLSL2GLSL. I'm changing it to make it work for Unity's use cases; might totally not work for yours!

For an opposite tool (GLSL ES to HLSL translator), look at Google's ANGLE.

Changes from original HLSL2GLSL 0.9

  • Made it build with VS2008 on Windows and XCode 3.2 on Mac. Build as static library.
  • Feature to produce OpenGL ES-like precision specifiers (fixed/half/float -> lowp/mediump/highp)
  • Fixes to ternary vector selection (float4 ? float4 : float4)
  • Fixes to bool->float promotion in arithmetic ops
  • Fixes to matrix constructors & indexing (GLSL is transposed in regards to HLSL)
  • Support clip()
  • Support Cg-like samplerRECT, texRECT, texRECTproj
  • Support VPOS and VFACE semantics
  • Fix various crashes & infinite loops, mostly on shaders with errors
  • Cleaner and more deterministic generated GLSL output
  • Unit testing suite
  • Simplified interface, code cleanup, unused code removal, merge copy-n-pasted code, simplify implementation etc.

Notes

  • 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=0 defines, 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.

Status

Seems to work quite well for Unity's shaders. When/if we bump into any issues; we'll just fix them.

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, we use it to optimize shaders produced by HLSL2GLSL; gives a substantial performance boost on mobile platforms.