Introducing the Vulkan renderer preview
Today we’re releasing the first developer preview of the upcoming Vulkan renderer for Unity, as announced at Google I/O. Vulkan is a new generation graphics and compute API that provides high-efficiency, cross-platform access to modern GPUs in both PCs and on mobile platforms. The recently released Android Nougat version from Google brings official support for the Vulkan API, and we’re working towards enabling our users to boost the graphics performance to the next level.
The main benefit of Vulkan over older mobile rendering APIs such as OpenGL ES 3.x is speed. Vulkan is designed to take advantage of multiple CPU cores by allowing the application to build command lists in multiple threads in parallel. This allows the application to take advantage of all of the CPU cores on the device, improving performance. The Vulkan preview release supports this via the “Enable Graphics Jobs” checkbox in the player settings. However, we’re seeing large performance gains even when running the renderer in a single thread. In one of our internal benchmarks we’re seeing up to 35% improvement in frame times on Android, compared to OpenGL ES 3.1 renderer, even though they’re both running in a single rendering thread!
Get the experimental build from our beta page. The build is based on Unity 5.5 beta 4 release. Remember to back up your projects before trying this out!
To enable Vulkan support, open “Player Settings…”, go to the “Other Settings” pane and clear the “Auto Graphics API” checkbox. You are presented with an ordered list of graphics APIs to choose from. If Vulkan is not on that list, click the ‘+’ sign at the bottom of the list to add it. Then drag Vulkan to be the first item on the list so that it’ll be used whenever supported, and you’re done! All your existing shaders will get translated to Vulkan SPIR-V (unless specifically disabled via #pragma only_renderers or similar), and the idea is that things should “Just Work”.
You can also experiment with the Enable Graphics Jobs checkbox, it can give a nice performance boost especially on multi-core CPUs.
NOTE! When targeting Android, make sure you never have both “Multithreaded Rendering” and “Graphics Jobs (Experimental)” settings enabled at the same time. They are mutually exclusive, and in the final version we’ll silently ignore the Multithreaded Renderer setting if Graphics Jobs are enabled.
Now, just build & run, and if everything went as planned, you should see something like this in the player log at startup:
This preview build has Vulkan support enabled for the following targets:
- Windows standalone (no Vulkan support in the editor yet)
- Linux standalone
On Windows, we’ve been mainly testing on Nvidia and AMD GPUs. Remember to update your GPU drivers! Vulkan is a new technology and the drivers keep improving constantly, so before reporting a crash, check first if an updated driver fixes the problem.
On Android, we’ve tested on the following devices:
- Samsung Galaxy S7 (European version, with ARM Mali GPU). Make sure you have the latest firmware, with build date August 2016 or later. Previous firmwares have older drivers that are known not to work.
- Nvidia Shield Tablet (both versions), Shield Console.
- Google Nexus 6P, 5X (although you might see more issues on these handsets compared to the others).
The following devices are known not to work with the currently available firmware:
- Samsung Galaxy S7 (US version, with Qualcomm GPU). We expect that an upcoming firmware with an updated driver should fix this. UPDATE: Samsung confirmed that they will release a fixed Vulkan driver for the Qualcomm based Galaxy S7 with the next system update in October 2016.
On Linux, only the Nvidia GPUs have been tested. You’ll need to have libvulkan1 installed (either from your distro or via the LunarG Vulkan SDK) and recent enough drivers (367.x or newer). However, we’ve seen random hangs when transitioning from the splash screen into the game itself. So when testing this experimental release, you might consider disabling the Unity splash screen, if you have that option.
As this is an experimental developer preview, there are some known issues we’re working on. We also welcome your feedback! Please let us know of any bugs or issues you find:
- Graphics jobs on Vulkan are especially experimental at this stage. If you see crashes, try disabling Graphics Jobs to see if that’s the one causing it.
- GrabPass is not supported with Graphics Jobs.
- On Nvidia GPUs, when rendering with multiple cameras with MSAA enabled, display corruption may occur.
- On Android the Graphics Jobs are currently configured to run in 2 concurrent threads only. Because of this, you’ll usually get better performance by using the Multithreaded renderer instead (this is the existing client/worker threaded renderer).
- Compute shaders haven’t been thoroughly tested yet, YMMV.
We hope you’ll have fun experimenting with the new renderer. Please talk to us about it at our forums: what works, what doesn’t, what you like about it and what you’re missing. If you believe you’ve found a bug, please report it via our bug reporting system (make sure to mention it refers to the experimental Vulkan build). We’re especially interested in cases where the Vulkan renderer would be slower than GL ES 3.x on Android, or significantly slower than DX11 or DX9 on Windows.