OpenCL and OpenGL wrappers in development for Microsoft’s platform
Microsoft and Collabora are developing OpenCL and OpenGL mapping layers for DirectX so that software developed for these open standards will run correctly on all DirectX 12-enabled devices.
DirectX is Microsoft’s proprietary hardware-accelerated graphics API for Windows; OpenGL is a cross-platform graphics API; and OpenCL is a cross-platform framework for parallel programming on CPUs and GPUs. Although there are Windows OpenCL and OpenGL drivers for many GPUs, the extent of support varies, and the DirectX implementation may be better optimised. The mapping layers will be delivered as enhancements to the open-source Mesa 3D project, for which Microsoft will provide a new DirectX 3D 12 (D3D12) backend.
Redmond said the main purpose is to “improve support for OpenCL- and OpenGL-based productivity and creative apps where native drivers are not available” rather than for gaming applications.
Collabora’s Erik Faye-Lund explained the project in more detail here. “This means that a GPU vendor only has to implement a D3D12 driver for their hardware in order to support all three APIs,” said the graphics software dev. “This mapping layer is also expected to serve as a starting point in porting older OpenCL and OpenGL applications over to D3D12.”
The versions supported will be OpenCL 1.2 and OpenGL 3.3.
Much of the work is about generating DirectX Intermediate Language (DXIL), which is consumed by DirectX drivers. DXIL is based on LLVM bitcode, but uses an ancient version for compatibility with older drivers. Unfortunately, newer versions of LLVM cannot generate bitcode in the older format, so the team has had to implement a new DXIL emitter, according to Faye-Lund.
“This is just the announcement, and a whole lot of work is left to be done,” said Lund.
The immediate goals are to pass conformance tests for OpenCL 1.2 and OpenGL 3.3, work on application compatibility with the focus on productivity applications, and to upstream the work to the main Mesa codebase. ®