Microsoft Adds SPIR-V To DXIL Library In Mesa - With A Focus On WebGPU Support

Written by Michael Larabel in Microsoft on 22 December 2020 at 06:22 PM EST. 9 Comments
Microsoft continues pushing new code into Mesa 21.0 as its efforts around Mesa continue to ramp up principally around GPU acceleration within Windows Subsystem for Linux (WSL) as well as allowing the likes of OpenGL and OpenCL to function under Windows 10 in the absence of native GL/CL drivers by using Mesa to translate the APIs for consumption by Direct3D 12 drivers.

The newest code volleyed into Mesa 21.0 this evening is the "spirv_to_dxil" library for translating SPIR-V to DXIL in going from that intermediate representation that can be used by OpenGL/OpenCL/Vulkan into the Microsoft DXIL intermediate language. The DXIL intermediate language is a lower-level, direct mapping of HLSL that can be consumed by GPU drivers.

What's this new SPIR-V to DXIL library for? Asked about it in the merge request, it's part of their work around the tentative WebGPU W3C standard and getting that accelerated over Direct3D drivers. WebGPU is the in-progress W3C standard backed by Microsoft and others as the successor to WebGL. WebGPU is based on modern graphics/compute concepts. The WebGPU shading language is WGSL as an intermediate representation very close to SPIR-V.

Since WebGPU's WGSL is so close to SPIR-V, Microsoft is looking to leverage Mesa and go from WGSL to SPIR-V and translate through to NIR before outputting as DXIL that can be consumed by Windows Direct3D drivers. This saves Microsoft from having to write an entire WGSL to DXIL path of their own.

So this is looking like Mesa will have yet another usage on Windows for supporting WebGPU's WGSL within web browsers atop Direct3D drivers. But for now this SPIR-V to DXIL library is very basic and reportedly just compiling a basic shader. Given how increasingly and widely used SPIR-V is as an open-source graphics/compute IR, this library may also find other use-cases moving forward.

The initial code merged today with several follow-up commits.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week