Here comes Vulkan: The next generation of the OpenGL graphics API
OpenGL is 22... it's time for a replacement – Khronos Group
GDC 2015 The Khronos Group, non-profit custodian of the OpenGL cross-platform graphics API, has announced its replacement, called Vulkan.
Vulkan, previously known as glNext, is being presented in detail at The Game Developers Conference (GDC) currently under way in San Francisco.
Khronos has also announced OpenCL 2.1, an updated version of its API for general-purpose parallel programming. OpenCL is typically used to take advantage of the multiple cores in a GPU to accelerate applications that require intensive processing. Both standards are designed for cross-platform implementation, unlike platform-specific APIs such as DirectX for Windows or the Metal API on Apple hardware.
Underpinning both Vulkan and OpenCL 2.1 is a new version of SPIR (Standard Portable Intermediate Representation), an intermediate language developed by Khronos for parallel compute and graphics. As with the popular LLVM project, using an intermediate language enables support for multiple programming languages and toolsets. The new SPIR-V includes the flow control, graphics and parallel constructs necessary for high performance graphics programming. Support for the OpenGL Shader Language (GLSL), for defining drawing effects, is under development, and future support for a C++ shader language is likely. Use of an intermediate language enables simplification of GPU drivers since they only need to consume SPIR-V code. The use of SPIR-V in both Vulkan and OpenCL 2.1 is a significant move towards convergence of the two standards.
Why does OpenGL need reworking? OpenGL is 22 years old and was originally designed for graphics workstations, rather than today’s platforms, which include mobile chipsets with shared memory between CPU and GPU. In OpenGL, “the driver does lots of work: state validation, dependency tracking, error checking, which limits and randomizes performance,” says Khronos. In Vulkan, the application has direct control over the operation of the GPU via a simplified driver. “The GPU has been laid bare for you. You can screw it up, but in the right hands this gives you maximum system performance, and gives the developer lots of flexibility,” Nvidia’s Neil Trevett, president of the Khronos Group, told El Reg.
In OpenGL, the shader language compiler is part of the driver, whereas Vulkan consumes SPIR-V. This also means that developers will no longer need to ship shader source code. Vulkan is also better for multi-core programming, with multiple command buffers than execute in parallel. “In the traditional OpenGL architecture, creating command buffers and submitting them to the GPU was difficult to split up into multiple threads, and often OpenGL applications are CPU limited, the GPU can’t be fed fast enough. Now you can create as many buffers as you want in parallel. This was the one thing we couldn’t fix in OpenGL,” Trevett says.
Vulkan will be a single API that will span desktop, games console, mobile and embedded platforms. It is “a ground-up redesign, we’re not backwards compatible with OpenGL,” says Trevett. The actual specification of Vulkan is not yet released, but Khronos is expecting initial specifications and implementations later in 2015.
Support for Vulkan is widespread, including from big names such as Intel, Apple, ARM, Nvidia, AMD, and chipset vendors such as Qualcomm, Imagination and Mediatek. Khronos also has active participation from games engine developers such as Epic, Valve, Unity and Blizzard, who are well placed to take advantage of what Vulkan offers.
The first versions of SPIR used LLVM, but SPIR-V does not, though Khronos promises to have open source translators between LLVM and SPIR. Why not just use LLVM? “It’s a governance issue. LLVM in their charter may change anything at any time. What it means for kernels trying to define stable hardware APIs is that we could find ourselves broken if LLVM jinked left. In the hardware community that was unacceptable,” says Trevett.
In OpenCL 2.1, aside from SPIR-V support, the big change is that it now supports C++ as a kernel language, executing on the GPU. “It’s the big ask from the developer community,” Trevett told The Reg. The OpenCL C++ kernel language is a subset of C++ 14 and includes lambda functions, classes, templates and operator overloading, among other features. C++ support will make it easier to write or port code for high performance computing to execute on the GPU or other accelerator boards that implement the standard.
OpenCL 2.1 is a provisional specification, and Vulkan not yet released, so you will not be playing Vulkan-powered games in the near future. As such things go though, the standards are progressing swiftly. It is a major change, promising better performance and easier programming though an industry standard cross-platform API. ®
Sponsored: Customer Identity and Access Management