Vulkan joins the roster!
July 31st 2022 marks the one-year anniversary of the hotly anticipated test release of Vulkan and now, finally, the time has arrived. One year of testing, nearly 40,000 lines of code and over 700 reports spanning 122 people have brought us here and we are so ready to tell you about this journey, what it means for us, and of course what it means for YOU!
What is Vulkan?
Vulkan is a graphics API. Think of it as the bridge between your graphics card (GPU) and any 3D application. Many of these exist that you may already have heard of, including: OpenGL, DirectX11 and DirectX12, with Ryujinx exclusively using OpenGL up to this point.
Sounds cool. Why do I care?
Vulkan is a much more modern and "lower-level" API than OpenGL, and as such, gives developers much more granular control over the GPU hardware; a blessing and a curse in all regards. While this level of detail can be beneficial when trying to accurately emulate a system, it can also provide for hours of misery having to do quite literally everything manually. OpenGL, by contrast, is a much higher level API that, while not providing as much direct access to the GPU, will let the driver take up a lot of the slack on the development side and does not require as much hand-holding as Vulkan.
Unfortunately this is where things get... unfortunate. Leaving core rendering functions up to the GPU driver relies on said driver to conform fully to the OpenGL specification, and also not be buggy when doing so. This last memo seems to have got lost somewhere in the mail for AMD and Intel, and a follow-up doesn't appear to have been sent. This has left owners of those products in a difficult spot since Ryujinx started to render graphics; they can either deal with graphical bugs and poor performance or use Linux (where open-source drivers provide a much cleaner experience). As Linux is not for everyone, a real solution was needed, and luckily every major GPU vendor in Nvidia, AMD and Intel all provide drivers that are highly conformant to the Vulkan specification.
Compatibility aside, Vulkan can also natively use a shading language called SPIR-V which is much much faster at compiling shaders than the rather sluggish GLSL that OpenGL uses. If nothing else, this will likely be the change regular users or Nvidia GPU owners will notice most!
What's changing and how will it affect me?
First of all, you need to know that any shader caches you've cultivated over the years will sadly cease to exist once you update beyond version 1.1.200 and boot a game. While this does mean that you will start from scratch in every title, they should be much quicker and less painful to rebuild thanks to SPIR-V's compile speed! Should you choose to use Vulkan.
Other than this... not much. AMD and Intel users will want to immediately set Vulkan as their backend and never look back while Nvidia users have the luxury of choice. While in most cases Vulkan will likely be the better pick due to its lower shader stutter, there may be some games that render/perform better in one or the other, so the world truly is your oyster. Shaders built for one backend will rebuild into the complimentary set for the other when you switch, so nothing is lost by trying both. A good strategy may be to undergo the initial stutter with Vulkan and then switch to OpenGL if it performs a little better. Your choice.
A caveat though: VRAM usage gets higher on Vulkan, and resolution scaling more expensive. And that's where...
...comes in! Some games, namely Astral Chain, use ASTC (Adaptive Scalable Texture Compression) to compress their textures. The Nintendo Switch itself supports decompressing these textures natively, but not our desktop graphics cards, which need to put in extra work to render them. This means these textures can grow to be 4 times as large as they are originally, causing your VRAM to become bloated.
Texture Recompression, which can now be found in the graphics tab, recompresses ASTC textures, making them look slightly worse, but saving your PC from a driver crash. This applies to both Vulkan and OpenGL, though it becomes more of a problem on Vulkan. OpenGL is pretty smart and will move things around between VRAM and DRAM to prevent a driver crash on low VRAM systems, and it does this by itself. Vulkan does not extend such courtesy, and as such please be increasingly aware of low VRAM cards, especially when resolution scaling. Texture recompression helps in some specific cases but it is not a catch-all.
We recommend enabling this setting for any GPUs with less than 4GB VRAM.
Is asynchronous shader compilation (async shaders) planned?
No. With the use of both parallel shader compilation and SPIR-V as the shading language, shader stutters should be relatively few and far between on a solid system. Skipping a draw to avoid a stutter is ultimately a hack, and not every shader can be compiled asynchronously anyway. Such a setting would never completely eliminate stutter, and in most scenarios it would simply cause major graphical bugs for very little reward.
That being said, the lead developers are not against an outside contributor trying their luck in this field. If the solution proposed meets their standards and works completely globally across every title then good luck to them!
On the flip side, there are other ways to further reduce shader compilation stuttering, and stuttering in general. Rest assured, the lead developers are aware of this.
Shader compile comparison vs OpenGL
Content warning: gore. Resident Evil Revelations 2 is used in the following comparison and may not be suitable for everyone.
Taking an RX 570 for a walk
We and our wider community have done extensive testing throughout the year on how these changes impact not just NVIDIA, but all vendors. However, the most common alternative by far is, of course, AMD. Below is a performance comparison between OpenGL and Vulkan with an RX 570 running the latest recommended drivers.
A few standouts here are Mario Kart 8 Deluxe which shoots up a staggering 121FPS (163% improvement over OpenGL) and Super Mario Odyssey with 63FPS (413% boost from OpenGL)! All of these framerates were also much more stable on Vulkan, which will be especially important in multiplayer scenarios. Mario Kart 8 Deluxe barely reached above 60FPS before and regularly dipped below in high player count matches; now any dedicated GPU shouldn't face much of a challenge.
Before and After art gallery: Intel
What AMD suffered in performance, Intel suffered in graphical bugs... and performance. Luckily, their Vulkan drivers are somewhat reasonable, but we sure hope their upcoming ARC lineup pack a little more punch than their current integrated options as far as performance goes.
Vendor agnostic fixes
Vulkan doesn't just provide a welcome relief to GPUs with sub-par OpenGL drivers; it can also resolve a few limitations OpenGL in general experiences. The following improvements were observed on all GPUs, including the golden child NVIDIA.
Bugs with black textures in random places is a problem that plagues a lot of Unreal Engine 4 games using the OpenGL renderer, such as Live a Live, Life is Strange and Bravely Default II. These aren't an issue in Vulkan thanks to its much higher texture limit. OpenGL is limited to 32.
Little Noah also sees a complete revamp of its visuals to something much closer to what we're sure is intended.
Known issues to resolve after merge
- AMD GCN cards (anything RX 400/500 and prior) exhibit major graphical glitches in Mario Kart 8 Deluxe due to a broken copy dependency. This was uncovered after the recent changes to fix graphical corruption in Breath of the Wild and Fire Emblem Warriors: Three Hopes, where we force a copy instead of using a broken Vulkan flag for cubemaps on these GPUs. By using a copy, we discovered an issue where data was being lost during this process, and is the cause of the nuclear disaster you see below.
- A few games will crash at boot or shortly after the menus with a "stack smashing detected" error on the RADV linux drivers. The cause is currently unknown.
- A couple of high-profile and niche games do not boot on AMD Vulkan: The Witcher 3, Xenoblade Chronicles 3, likely a few more.
Well this is quite emotional isn't it? It feels like a huge milestone, because it sure as hell is one. The fight against shader stutter is being won, the path forward for AMD and Intel GPU owners is starting to clear and our GPU developers in gdkchan and riperiperi can maybe take a well-deserved rest. Don't be shy to congratulate the dev team for this achievement and thank them for their tireless work!