Collabora developers presented a new Gallium controller for Mesa

collaborate controller

Recently Collabora developers released through a blog post, the new Gallium controller for Mesa, that implements an intermediate layer to organize OpenCL 1.2 and OpenGL 3.3 API about drivers with DirectX 12 (D3D12) support and that their source code is released under the MIT license.

The proposed controller will allows you to use Mesa on devices which are not initially compatible with OpenCL and OpenGL and also as a starting position to port OpenGL / OpenCL applications to work on D3D12. For GPU manufacturers, the subsystem allows to provide support for OpenCL and OpenGL, with drivers only supporting D3D12.

In their blog post, the developers share:

For the past few months, we've been working on two exciting new projects at Collabora, and it's finally time to share information about them with the world ...

Of immediate plans, it is observed the achievement of the complete approval of the tests of OpenCL 1.2 and OpenGL 3.3 support, verification of compatibility with applications and inclusion of best practices in the main composition of Mesa.

About the new controller

The development of the new controller is carried out in conjunction with Microsoft engineers to develop D3D11On12 tools to D3D11 transfer kits and D3D12 D3D12TranslationLayer library, as well as standard graphic primitive implements on top of D3D12.

The implementation includes Gallium driver, OpenCL compiler, the OpenCL runtime, and the NIR-to-DXIL shader compiler, which converts the intermediate representation of NIR shaders used in Mesa to the binary DXIL format (DirectX intermediate language), compatible with DirectX 12 and based on bit code LLVM 3.7 (Microsoft's DirectX Shader Compiler is essentially an extended fork of LLVM 3.7). The OpenCL compiler was prepared based on the experience of the LLVM project and the SPIRV-LLVM toolkit.

This work builds on many previous works. First of all, we are building this using Mesa 3D, with the Gallium interface as the basis for the OpenGL layer and NIR as the basis for the OpenCL compiler. We are also using LLVM and the Khronos SPIRV-LLVM translator as a compiler.

Additionally, we are leveraging Microsoft's experience in creating their D3D12 translation layer, as well as our own experience in developing Zink.

The OpenCL source code is compiled with clang into the intermediate LLVM pseudocode (LLVM IR), which is then converted to an intermediate representation of the OpenCL kernel in the SPIR-V format.

The cores in the SPIR-V representation are transferred to Mesa, translated into NIR format, optimized, and transferred to NIR-to-DXIL to generate suitable DXIL computational shaders for GPU execution using DirectX 12 based runtime. Instead of using Clover in the OpenCL Mesa Implementation, a new OpenCL runtime is proposed, which allows more direct conversions to the DirectX 12 API.

OpenCL and OpenGL drivers are prepared using the Gallium interface provided in Mesa, which allows you to bypass OpenGL specifics when creating drivers and translate OpenGL calls into entities that are closer to the graphical primitives that modern GPUs operate on.

The Gallium driver accepts OpenGL commands and with the participation of the NIR-to-DXIL translator, builds command buffers that run on the GPU using the D3D12 driver.

Finally, developers mention this is early work and that they expect the controller to improve over time:

This is just the announcement, and a lot of work remains to be done. We have something that works in some cases at the moment, but we are just beginning to scratch the surface.

First of all, we need to get to the level of features that we are heading for. Our goals at this time is to pass conformance testing for OpenCL 1.2 and OpenGL 3.3. We have a long way to go, but with a little hard work and sweat I'm sure we'll get there.

If you are interested in knowing more about it, you can check the original note in the following link or for those who are interested in reviewing the source code can do so from this link.

The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.