New DirectX Shader Compiler based on Clang/LLVM now available as Open Source


The DirectX HLSL (High Level Shading Language) compiler is now available as an open source project built on the Clang/LLVM framework.

Microsoft drives the leading GPU shader language

Since 2002, HLSL has been a key focus of industry collaboration on GPU programming. As the shader language for the popular DirectX12 API, HLSL is at the forefront of innovation in gaming on both Windows 10 and Xbox. Due to the clear importance of industry collaboration, we have made our latest technology available to a broader audience. This release brings industry collaboration on GPU programming and shader compiler development into a new era of opportunity.

The DirectX Shader Compiler is now open source

Yes, the source is public. Because the source is available, developers can check to see how the compiler works at the smallest level of detail. You can download it, modify it, and make it a part of any system you are building. You can port it to other platforms. You can also contribute your ideas and code to the project directly, or collaborate with other partners (including hardware vendors) on new contributions.

The HLSL compiler is now based on Clang/LLVM technology

The Clang/LLVM framework is a large-scale compiler framework suitable for compiling massive codebases. Using Clang for the shader front-end enables robust operation immediately, plus easier extensibility and innovation over time. Using the LLVM framework, the new compiler emits a new binary shader format known as DXIL. The large Clang/LLVM ecosystem of tools, utilities, documentation, expertise, etc. is now available to help with integrating shaders into major products.

HLSL now supports new wave intrinsics

While the primary focus of the new codebase has been on consistency and scale, a new GPU programming model is enabled in HLSL via the wave intrinsics. These new routines help developers write shaders that take explicit advantage of the SIMD nature of GPU processors to improve performance for algorithms like geometry culling, lighting, and I/O.

User impact

The broader collaboration opportunities of open source, combined with the production scale technology of the Clang/LLVM foundation should result in faster creation of more complex shaders in apps and games. User will see these as much richer visual experiences arriving in shorter timeframes.

For more information

Check out the project readme and wiki pages: https://github.com/Microsoft/DirectXShaderCompiler

Comments (10)

  1. Daniel Berlin says:

    It looks like you guys changed the license headers on all the LLVM code you used, like https://github.com/Microsoft/DirectXShaderCompiler/blob/master/include/llvm/IR/Instruction.h#L5-L7

    This is … not right 🙂

    1. Warren says:

      Hey Daniel, I don’t understand your concern as this is a completely innocuous change. Please elaborate.

    2. Chas.Boyd says:

      Daniel, thanks for the feedback. Yes, we did take a change in copyright policy about 24 hrs after first public release. More info on the github comment thread. Please keep comments coming if there are changes desired. -Chas.

  2. Warren says:

    (** I am not a lawyer! **) I would think the LLVM copyright was completely satisfied due to the (1) headers referencing ‘LICENSE.TXT’ and (2) the actual license text requiring “Redistributions of source code must retain the above copyright notice” (which is in the LICENSE.TXT — NOT the source file).

    Again, I’m not a lawyer but this all seems reasonably addressed to me. 😛

    1. Warren says:

      Addendum: scratch that, I see that the issue isn’t the license but the copyright claim. Ignore me. 🙂

  3. deadpin says:

    Cool to finally move a bit past the pre-DX9 era 🙂

    Is there any data you can share on how it compares to the existing toolset though? Are compile times better or worse? Is the quality of the code generated better or worse in typical situations (UE4 shaders perhaps)? Timeline on when the new toolset should completely replace existing one?

  4. Andrew says:

    This is awesome. I would like to see backends for Vulkan etc. HLSL has always been the best SL.

  5. Daniel says:

    Is it possible to download this yet?

Skip to main content