Microsoft Makes More Of Their DirectX Compiler Code Open-Source

Back in 2017 was the initial open-source DirectX Shader Compiler milestone and since then Microsoft has continued iterating on it with better Linux support, new features, and ironing out other gaps in this “DirectXShaderCompiler” project. On Friday they released the newest version of this DirectX Shader Compiler that features another newly open-sourced component.

Microsoft on Friday made their Feburary 2025 release of their DirectX Shader Compiler featuring various fixes and improvements to the code since last July in their previous release.

Notable with this February 2025 update is Microsoft open-sourced their DirectX Intermediate Language (DXIL) Validator Hash. Going back to last July they laid out feature plans for an open-source implementation of the DXIL DLL. This is a two-step approach to open-source the DXIL DLL code as well as refactoring it.

Last summer they announced plans for open-sourcing the DXIL Validator Hash. There they explained of the DXIL Validator Hash:

“The constraints placed on a DXIL module are enforced by the DXIL Validator, which acts as a binary analysis tool running on the generated DXIL binary and verifying that it conforms to DXIL’s specified requirements.

The validator comes in two forms, the internal validator which is fully open source and built into DXC’s dxcompiler dynamic library, and the external validator which is built from a mixture of open source and closed source code and distributed in the DXIL dynamic library with DXC’s Linux and Windows releases.

The only difference between the internal and external validators is that the external validator contains the algorithm to compute the Validator Hash, and on successful validation it writes the hash into the compiled shader binary.

The DirectX runtime validates the hash on each shader by computing the hash from DXIL and comparing the computed value against the value written in the shader binary. This validation is performed on all shaders unless you are using the AgilitySDK with the D3D12ExperimentalShaderModels experimental feature enabled (see: D3D12EnableExperimentalFeatures on learn.microsoft).

The DXIL Validator Hash is not cryptographically strong and was never intended as a security feature. The sole purpose of the validator hashing flow is to provide users and drivers with confidence about the correctness of the generated shader binary and detect invalid program constructs that can’t currently be caught earlier in the compiler.”

Microsoft proceeded to open-source the DXIL hash code as the first step of the initiative.

Open-source DXIL hash

That code is now part of this February 2025 DirectX Shader Compiler release as they further build-out the DXIL capabilities. Developers outside of Microsoft previously reverse-engineered the hashing algorithm while now it’s officially open-source. This will help in situations like those compiling shaders for DirectX outside of Windows hosts or the selective Linux binaries Microsoft has provided in the past.