What is HLSLcc and what does it do?
masterHLSLcc is a DirectX shader bytecode cross-compiler. It takes DirectX bytecode as input and translates it into several target languages:
- GLSL (OpenGL 3.2 and later)
- GLSL ES (OpenGL ES 2.0 and later)
- GLSL for Vulkan (intended as input for Glslang to generate SPIR-V)
- Metal Shading Language
It is used by Unity to generate shaders for OpenGL, OpenGL ES 3.0+, Metal, and Vulkan. Key features include temp register type analysis to infer data types, loop transformation to restore for-loop constructs, support for partial precision variables (e.g., min16float), and a reflection interface to retrieve shader inputs and their types.