Khronos unveils OpenGL 4.5, broadens OpenCL 2.0 language support
New SPIR spec makes compute kernel compilation a breeze
Siggraph 2014 As the 41st Siggraph computer graphics conference kicks off in Vancouver this week, industry standards body the Khronos Group has announced updates to two of its most important specs.
The first is OpenGL 4.5, the latest version of the cross-platform, language-independent 2D and 3D vector graphics API that has enjoyed regular, annual updates since shortly after the Khronos Group took over its management in 2006.
"OpenGL 4.5 has some new functionality that's been requested by the developer community for some time, so we're happy to get that in," Khronos Group president Neil Trevett, who is also VP of mobile content for Nvidia, said in a phone chat with The Register.
In terms of market share, OpenGL's main competitor is Microsoft's DirectX, and with Redmond due to release DirectX 12 next year, the Khronos Group has taken steps to make it easier to port 3D graphics between OpenGL and DirectX implementations.
"There are some pointless differences between OpenGL and DirectX that are the historical way it's ended up, the most obvious one being the coordinate system is flipped between the two," Trevett said. "For a few versions of OpenGL now we've actually been putting in some of the DirectX ways of doing things into GL that you can use, optionally, if you want."
But Trevett pointed out that although the majority of Windows game development has moved toward DirectX, OpenGL still has advantages, even in that market.
"Even on PCs, DirectX 12 [will be] restricted to the latest versions of Windows," Trevett said. "At Nvidia, for example, we sell gaming GPUs into China where they're still running Windows XP. We can't ship DirectX 11 or DirectX 12 there but we can certainly ship OpenGL. And so even on Windows, there are significant areas of opportunity that OpenGL is enabling."
In a surprise move, however, the Khronos Group announced on Monday that Microsoft has actually joined its ranks for the first time. For now, its particular focus will reportedly be WebGL, but as a result of its participation we may see more bridges built between OpenGL and DirectX in future.
Bridging OpenGL for desktop and mobile
Increasingly important, however, is the mobile market, where Microsoft is less prominent and OpenGL enjoys a significant foothold. Major GPU vendors unveiled the first certified implementations of the OpenGL ES 3.1 mobile spec in July – the "ES" stands for "embedded systems" – and now OpenGL 4.5 makes it easier than ever to develop OpenGL ES applications on the desktop.
"With OpenGL 4.5 you can request an OpenGL ES 3.1 context, which means basically you can turn your desktop GPU into a mobile GPU. It lets you develop mobile applications knowing the graphics API you're using is identical to the graphics API you're going to find on your mobile device," Trevett explained.
OpenGL 4.5 also takes some of the recent "robustness" extensions to the spec – shorthand for "things that make the GPU reliable" – and brings them into the core standard, making them more pervasively available to developers on all platforms.
Finally, the new standard adds support for Direct State Access (DSA), which allows OpenGL objects to be accessed and modified more easily for increased efficiency.
Simultaneous with the announcement of the new OpenGL spec on Monday, Nvidia has shipped beta OpenGL 4.5 drivers, so developers can begin experimenting with the new features immediately.
OpenCL lobs a SPIR at compiler makers
Yet graphics aren't the only focus for the Khronos Group at this year's Siggraph. The group has also unveiled an important update to its OpenCL computation spec, the most recent version of which, OpenCL 2.0, was released in November 2013.
So far, developers have had to write OpenCL kernels in the OpenCL C language if they want to use version 2.0 features. But on Monday, Khronos unveiled a provisional specification for version 2.0 of the Standard Portable Intermediate Representation (SPIR, pronounced "spear"), its architecture-neutral binary format, which will make it possible to write OpenCL 2.0 code in a variety of front-end languages.
SPIR 2.0 is based on the standard intermediate representation (IR) from version 3.4 the LLVM compiler project, plus some extensions that are needed for executing parallel code. This means that rather than targeting each architecture individually, compilers can simply output SPIR and rely on the OpenCL implementation to handle the underlying hardware.
"The hardware clients don't have to worry about the multiplicity of languages and frameworks," Trevett told The Reg. "They just have to ingest SPIR and make sure that they execute it efficiently."
While SPIR 1.2 only implemented the features found in OpenCL 1.2, Trevett said SPIR 2.0 can now handle every feature that's available in OpenCL 2.0, including pipes, generic address space, device-side kernel enqueuing, and a subset of C++11 atomics.
The version of the SPIR 2.0 spec that was published on Monday may not be the final one, however.
"We think we're done at Khronos but we'd like a round of feedback before we finalize the spec. So we're encouraging developers who care about this kind of thing to go to the forum and provide us some feedback," Trevett said.
In addition, Khronos will be hosting Siggraph birds-of-a-feather discussion meetings on OpenGL, OpenGL ES, and OpenCL at the Mariott Pinnacle Hotel in Vancouver on Wednesday. ®
Sponsored: Becoming a Pragmatic Security Leader