Microsoft Releases Open-Source HLSL to GLSL Shader Cross-Compiler

Microsoft has just released an open-source project called Shader Conductor, which is intended to be for cross-compiling HLSL (High Level Shading Language) for DirectX to GLSL (OpenGL Shading Language). There have been similar projects from third-party sources in the past, like the proposed Cg from Nvidia back in 2012, but this marks the first open-source initiative on Microsoft’s behalf in this particular sphere.

On the official GitHub for this project, Microsoft made sure to mention that Shader Conductor is not a “real compiler” – rather, it glues existing open-source components together to achieve the cross-compiling. The cross-compiler relies on DirectX Shader Compiler and SPIRV-Cross to do the bulk of the lifting.

Microsoft Shader Conductor cross-compiler flow.

This is pure speculation, but this could be a move by Microsoft to further invest in the cloud-based gaming future, which will most likely be using Linux-based servers. Thus, it is highly beneficial to game developers if they are able to easily focus cross-compatibility as far as shaders go.

With Shader Conductor, developers will be able to target HLSL first (which they already do), but more easily convert to GLSL / SPIR-V, ESSL, MSL, and older HLSL models. Furthermore, Shader Conductor supports all stages of shaders such as vertex (transformation and lighting), pixel (2D effects), hull, domain, geometry, and compute.

The prerequisites for Shader Conductor are Git, Visual Studio 2017, CMake, and Python – developers may optionally choose Windows Driver Kit, where DirectXShaderCompiler’s tests are built on the TAEF framework.

The project is still in development stages, although the generation of SPIR-V code is nearly complete. Shader Conductor is currently only usable on Windows platform, but we should expect compatibility on Linux and Mac in the near future.