Introduction to Vulkan: Migrating from OpenGL ES

An overview of the differences between OpenGL ES and the new graphics API Vulkan, as well as outlining the benefits and pitfalls of transitioning to Vulkan

This document provides a quick introduction to the new graphical rendering API, Vulkan®. It focusses primarily on how Vulkan compares to another open standard API, OpenGL® ES, and the benefits and pitfalls for developers of migrating to Vulkan. In addition, this document will briefly discuss the advantages of Vulkan when compared to other new generation APIs, such as DirectX® 12 or Metal, as well as some of the technical aspects of Vulkan which may be unfamiliar to an OpenGL ES developer.

But first...

What is Vulkan?

Vulkan is a new low-level graphics and compute API that allows developers much greater control over the hardware. It has been designed to take advantage of many of the features of modern devices.

The most important features of Vulkan for developers are:
  • better use of multi-core CPUs
  • reduced driver overhead
  • cross-platform support

Each of these will be discussed in several places throughout this document.

When used correctly, Vulkan should lead to better and more consistent application performance when compared to other high-level APIs such as OpenGL ES. The trade-off is that a significantly greater amount of work is required to initially set up an application in Vulkan. The benefits of this extra work may not be apparent in simple applications, but in more complex ones Vulkan can have a noticeable performance edge over OpenGL ES.

To give an idea of the potential benefits of Vulkan, the video below shows the same demo running on both OpenGL ES 3.0 and Vulkan with CPU usage and FPS in the bottom left-hand corner.

Important: This is an exaggerated scenario that is intended to highlight Vulkan's strengths. Here OpenGL ES is being used in a way that is not really designed to be.

For more information on the design and implementation of the demo shown in the video see Gnomes per second in Vulkan and OpenGL ES.

The current API market

Moving to Vulkan is very comparable to transitioning from fixed-function to shader-based pipelines. This was a huge change for developers and there was a lot to learn, but in the end it gave a greater amount of flexibility, control and freedom. Ultimately shader-based pipelines truly revolutionised the industry and it is hard to imagine going back to fixed-function.

The releases of new rendering APIs such as DirectX 12, Metal, and Vulkan have made it clear that all modern APIs are heading in a similar direction, with a focus on low-level control and low overhead, as well as providing both graphics and compute capabilities. Moving to any one of these next generation APIs will genuinely be a move into the future, so the obvious question is:

Why choose Vulkan?

One of the biggest advantages of using Vulkan is that it supports a myriad of platforms. This puts it ahead of its competitors. There is only one platform that Vulkan does not support (at least not directly) which is macOS. However, there are wrappers available, such as MetalVK, that work on top of the supported low-level API. This multi-platform aspect of Vulkan enables developers to save a lot of time and money on learning and supporting all the new APIs.

Another advantage of Vulkan over the others is that it enjoys quite wide early adoption by game engine developers. The biggest game engines used by most developers today already have full Vulkan support. These include Unity, Unreal® Engine 4, CryEngine, and more. This means a developer can take full advantage of Vulkan without the hassle having to create an engine from scratch.

Despite its apparent complexity Vulkan can actually be quite a bit easier to learn than some of its competitors. This is particularly true for developers who have experience with older APIs such as OpenGL ES. Vulkan has the same graphics pipeline, so it is only a matter of learning the new interface (API) to control it. This also means that porting techniques from older APIs can be easier as well.