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 graphic 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 ensure that all devices that support DirectX 12 can also use OpenCL and OpenGL in the long term.
To make OpenCL compatible with DirectX, developers use LLVM and Khronos’ SPIR-V- LLVM translator to create ‘SPIR-V representations’ of the OpenCL kernel. This kernel is then translated into NIR, where some optimizations are made. Ultimately, the NIR kernel is translated into DXIL , a programming language for DirectX. This allows it to run on DirectX 12 GPUs.
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 can make this difficult, but the company says to share these details later.
Collabora does report that there is still a lot of work to do before users can expect support for OpenCL and OpenGL in their DirectX12 devices. For example, the company still has to achieve the desired feature level . Collabora wants to pass the conformity tests for OpenCL 1.2 and OpenGL 3.3. Compatibility with applications still needs to be worked on, for the time being mainly focusing on productivity programs. The company therefore does not indicate a release period. Collabora does share the source code of the project. Eventually, the source code must be available in the Mesa repository .