Using Vulkan in Unity

Implementing Vulkan can be a complex job, but Unity handles the complexity on behalf of game developers. This means that switching from OpenGL or OpenGL ES to Vulkan does not require any development work. Unity implements the change on its own. 

Differences between OpenGL ES and Vulkan

There are many differences between Vulkan and the OpenGL and OpenGL ES APIs. These differences include Vulkan: 

  • Providing a unified API for mobile, desktop, console, and embedded systems, and being portable across a wide range of implementations.  
  • Using a simpler driver to minimize overhead and reduce application processor bottlenecks. The driver has lower latency and is more efficient than OpenGL, so the application achieves better performance. The application, instead of the driver, manages resources and has direct, low-level control of the GPU. 
  • Supporting multithreading across multiple application processors. The game can therefore use multiple application processors efficiently, lowering processing load and power consumption. The application itself manages threads and synchronization. 
  • Using command buffers instead of direct function calls to execute commands. You can use multithreading to create parallel buffers, and submit buffers to different device queues, for example graphics, compute, and DMA. Having separate queues provides flexibility for job creation. Multithreading runs the game on multiple application processor cores, which improves performance. Also, using multiple processors at a lower clock rate, instead of a faster clock rate single processor, reduces power consumption. 
  • Using SPIR-V, a multi-API, intermediate language for parallel compute and graphics. Using SPIR-V means that there is no front-end compiler in the Vulkan driver. This makes the driver simpler, and the shader compilation faster. You can use the same SPIR-V front-end compiler on multiple platforms to generate pre-compiled shaders. With SPIR-V, you do not have to ship shader source code with your application. You also have the option to use different shading languages in the future. 
  • Loading validation layers in your development environment for testing and debugging, and shipping to production without those layers.  
  • Performing multi-pass rendering, where each sub-pass in a group provides a different output. Vulkan optimizes the order of grouped sub-passes so that each sub-pass can access information provided by the previous sub-passes. This helps Vulkan reduce memory use and hold data on the fast on-chip memory, which saves bandwidth and power.  

Note: Mutli-passing is more efficient on tile-based GPUs like Mali GPUs. 

Changing the API in Unity to Vulkan

Unity 2019.3 and newer use Vulkan by default. If you are on an older version, or want to change APIs for an existing game, you will need to manually add it to the API list and make it your new default API.

To add the Vulkan API and make it default:

  1. Select File > Build Settings…
  2. Click Player Settings…
  3. Uncheck Auto Graphics API in the Other Settings panel to allow manual API selection.
  4. Click the plus button and select Vulkan from the list.  Vulkan is added as the last option on the list. 
  5. To use Vulkan, either:
  • Move it to the top of the API list, as shown in this image:

Selecting Vulkan as the default graphics API

  • Remove all other APIs from the list by selecting an API and clicking the minus button.


Previous Next