Vulkan case study
How game developer Infinite Dreams used Vulkan to improve performance.
Mobile game developers Infinite Dreams develop the popular mobile game Sky Force Reloaded. Sky Force Reloaded features intense action in a rich graphical environment that is highly demanding of both the application processor and the GPU. Sky Force Reloaded was originally built using Unity with OpenGL ES.
Figure 8-3 Sky Force Reloaded
Sky Force Reloaded optimization
The initial development of the game produced the rich graphical experience required. The next stage was optimization.
The game is graphically complex with many things on screen at the same time so the team thought that the biggest area for optimization would be fill rate. Problems with fill rate can usually be eliminated by decreasing the resolution of the framebuffer.
However, when they tried rendering the game in low resolution it still had performance problems. Even on high end devices, it could not always maintain 60 frames per second (FPS). The team found the game was making a large number of draw calls. Sometimes, up to 1000 draw calls per frame.
Every draw call has a computation overhead so making large numbers of draw calls is computationally expensive. This causes the OpenGL ES driver to keep the application processor busy for long periods of time preparing data for the GPU. As a result, this can slow down even high end mobile devices.
To optimize, the team could minimize the number of draw calls or modify them so that the game engine could batch them. However, this is not always possible without reducing the quality of the game.
The team heard about Vulkan and they decided to see if it could improve the performance of the game.
In Unity, Vulkan is just a rendering API and Unity does all the hard work. The team were able to use Vulkan by just activating it in Unity.
To test the difference between OpenGL ES and Vulkan, the team analyzed the game. They found one of the slowest parts of the game, where OpenGL could not deliver 60 FPS. To measure the performance difference between OpenGL ES and Vulkan, the development team created a synthetic benchmark based on this part of the game.
The benchmark uses a repeatable scene for the APIs to render, to provide a consistent test for both APIs.
In the following graph, you can see that Vulkan is able to keep 60 FPS most of the time while OpenGL ES struggles. The overall improvement in performance is 15% above OpenGL ES. The team considered this to be a very good result, considering Vulkan is only a graphics API.
The following image shows results of the benchmark comparing OpenGL ES and Vulkan:
Figure 8-4 Sky Force Reloaded benchmark comparing OpenGL ES and Vulkan
Testing additional performance from Vulkan
With Vulkan able to run at 60 FPS most of the time, the team wondered how much more performance could they achieve with Vulkan.
The developers started adding some additional objects to the benchmark level, to the point where even Vulkan was not able to achieve 60 FPS, causing the gap between OpenGL ES and Vulkan to grow. On average, Vulkan was 32% faster than OpenGL ES.
The following graph shows results of the benchmark comparing OpenGL ES and Vulkan, now with added objects in the scene:
Figure 8-5 Sky Force Reloaded benchmark with added objects
There was definitely some extra performance available, so the team asked themselves how can this extra power be utilized in the game. They added more graphics, particles, objects, and animations. The team found they could make the game look even richer and still maintain 60 FPS. This was all effectively for free, because of Vulkan.
Vulkan video comparison
There is a video comparison available at: https://www.youtube.com/watch?v=VCSkp-QZ37M.
The video shows a side-by-side performance comparison of the Vulkan version versus the OpenGL ES version. On the left-hand side, the game uses OpenGL ES. On the right-hand side, the game uses Vulkan. Both versions are running at 60 frames per second.
At this frame rate, Vulkan can render six times more stars and twice as many bullets compared to the OpenGL ES version. With OpenGL ES, rendering the same number of objects causes the frame rate to drop considerably during busy scenes. Vulkan enables you to add more geometry to the screen in comparison to OpenGL ES at the same frame rate.
The following image shows a frame from the comparison video:
Figure 8-6 Sky Force Reloaded frame comparing OpenGL ES and Vulkan
Vulkan power consumption
Sky Force Reloaded is a very application processor and GPU intensive game. Some players have even complained that the game drained their batteries too quickly. The team did not want to take anything away from the console-like quality of game, so they checked to see if Vulkan could help. They tested with Vulkan to see if it would reduce the power consumption and therefore increase the battery life. Enabling Vulkan in Unity resulted in 10-12% lower power consumption, resulting in 10-12% minutes of extra play time.
There is a video comparison available at: https://www.youtube.com/watch?v=WI7nXq8oozw