Windows will receive support for OpenCL 1.2 and OpenGL 3.3 in the future. That reports software company Collabora, which is working with Microsoft to bring the APIs to devices with DirectX 12 support. It is still unclear when this will happen.
Collabora reports that the company uses the Mesa 3D Graphics Library for this. That is an open source implementation of various graphical techniques, including OpenCL and OpenGL. Collabora uses the Gallium interface as the basis for the OpenGL layer. NIR is used for the OpenCL compiler. In practice, this project should lead to all devices that support DirectX 12, eventually being able to work with OpenCL and OpenGL.
To make OpenCL compatible with DirectX, the developers use LLVM and Khronos’ SPIR-V-LLVM translator to create “SPIR-V representations” of the OpenCL kernel. This kernel is then translated to NIR, where some optimizations are made. Finally, the NIR kernel is translated to DXIL, a programming language for DirectX. Allows it to run on DirectX 12 GPUs.
The translation from OpenCL to DirectX is multiple. Image via Collaborator
For OpenGL, Microsoft and Collabora use the Gallium driver for D3D12. This driver takes OpenGL commands and translates them to DXIL, then runs them through the driver on a DirectX12 GPU. According to Collabora, there are some “interesting details” that could make this difficult, but the company says it will share these details later.
Collabora does report that there is still a lot of work to do before users can expect OpenCL and OpenGL support in their DirectX12 devices. The company has yet to reach the desired feature level. Collabora aims to pass the OpenCL 1.2 and OpenGL 3.3 conformance tests. Work also needs to be done on compatibility with applications, with a focus on productivity programs for the time being. The company does not specify a release period. Collabora does share the source code of the project. In time, the source code should be available in the Mesa repository.