March Progress Report
Added 2020-04-04 01:47:10 +0000 UTC
Another month has passed, and another batch of bugs were fixed. Today we will take a look at some of the improvements that Ryujinx received lately.
GPU emulation improvements:
In the previous post, we discussed 32-bit support that allowed a lot of games that previously didn't even boot to become fully playable. One of those games is Rune Factory 4 Special, a remaster of the 3DS game of the same name (minus the Special part).
One of the surprises I had while trying to run it, was that most of the geometry was not being rendered properly. Most models seemed to be inside out, an issue oddly similar to the one that Xenoblade 2 has (and discussed in the previous post), but in this case the problem is completely different.
Let's take a look at how it used to render:

Hmm, that can't be good...
Luckily the problem was pretty easy to spot and fix. This was caused by unimplemented shader instruction. This game makes use of double-precision operations on the shader, and it's the first game we see doing that. Normally, the shader uses single-precision types, since their precision is normally good enough, and they are much faster than double-precision on GPUs.
With the missing instructions implemented, the game now renders much better:


Please note that this game is not currently playable on the website builds due to a separate issue, but it is playable with the shader cache. We will talk more about that on the next progress report.
Another game that was improved significantly was Hatsune Miku: Project Diva MEGA 39's. Released in February, the game had severe graphical issues caused due to the lack of proper depth testing.

The issue was caused by an unimplemented feature on the GPU command processor, that caused some register values to be lost and as a result, depth testing was not being done. The depth test is used by the GPU to ensure that objects are rendered in the correct order, and objects that are closer to the camera on the scene are rendered in front of the objects behind it.
Fortunately, the issue was not that hard to fix, and the game now looks much better:



Unfortunately, the game still suffers from an audio issue and is not enjoyable in its current state. But we are working on that and may have some news soon!
Shaders are also a common source of graphical bugs. One of them prevented some objects from being rendered on the game LoveR Kiss.

The issue was caused by an error on the shader code, which caused it to fail to compile. When a shader fails to compile, all subsequent draws need to be ignored, and the result is usually what you see above, objects not being rendered, which results in those black regions where you'd expect to see... something.
The issue was caused by a mismatch of texture sampler type on the shader. Something easy to spot and also easy to fix, fortunately.

Another game that suffered from shader issues was the big release of the month, Animal Crossing: New Horizons. One of the most noticeable issue was the black sand. This one was easy to spot, but not so easy to fix. It was caused by an unimplemented shader instruction. Due to lack of documentation, and complexity of the instruction, it took a while to implement. But after implementing, the black sand issue was fixed.


Another issue was the wrong color on the edges of the terrain.

This one was caused by a lack of proper support for constant attributes. NVN (the Nintendo Switch graphics API used by most games) sets attributes that are not used to a constant value. The emulator incorrectly ignored that, which caused shaders to use garbage data and add that to the output color, which caused the wrong colors you can see on the above screenshot. After this was fixed, it now renders properly.

And finally, another minor improvement is the implementation of scissor tests on the GPU. Scissor tests are pretty simple, they are used to discard part of the image that is rendered. So you can, for example, cut out part of an image.

On the above screenshot, scissors are used to limit the rendering to the area between the two arrows, otherwise it would overflow and draw on top of the character model on the left side.
EliseZeroTwo also implemented two missing shader instructions, those instructions effectively don't do anything on the emulator, but it used to show a warning on the console/log because the instruction was unknown. Now those false warnings were removed, which is a good thing since it used to confuse some users.
XploitR added support for forced anisotropic filtering, a graphics enhancement option that can improve graphics in some games. The new option is now available on the configuration menu and can be accessed on the "System" tab.
CPU emulation improvements:
We already talked about GPU improvements that fixed graphical bugs on the game Rune Factory 4 Special. But the game also required a few CPU instructions that were previously not implemented to work. Those were implemented by gdkchan and allowed the game to boot.

LDj3SNuD also implemented a few missing ARM64 instructions, which allowed a few games that previously didn't work to reach an in-game state! Some of those games are Sonic Forces and Tales of Vesperia, which can now reach an in-game state, and depending on your hardware, might be playable.


Inverted color channels on this game is a separate issue.
Some ARM32 crypto instructions were also implemented by Riperiperi, they are used by Mario Kart 8 Deluxe in multiplayer mode (which is not currently working, but should in the future). Also thanks to Riperiperi, we had a great boost in speed, mostly visible on 32-bit games, after a optimization on the way how the CPU emulator handles function calls. This resulted in an improvement of around 1.25x to 1.75x in speed, depending on the game.
Another improvement to crypto instruction was made by Riperiperi recently. If you have tested Animal Crossing on Ryujinx, you may have noticed a severe slowdown every time the game was saved on the first preview builds. This was caused by the slow implementation of AES crypto instruction on the CPU emulator. Riperiperi optimized those, which resulted in smooth saving without any slowdown, which enhances the gameplay experience, especially since the game auto-saves a lot.
HLE improvements:
Some of the improvements we had on our HLE (High-Level Emulation, basically, the implementation of the Nintendo Switch OS on the emulator) was an update to support the new audio renderer revision "REV8", required by the recently released first-party title Animal Crossing, and a few other games. Also of note is the implementation of the "GetRegionCode" function on the settings service, also used by Animal Crossing.

Another feature requires by animal crossing is multi-commit support on the filesystem service. This is required for saves. This was recently implemented on Libhac (an open-source switch filesystem implementation library that Ryujinx uses) by Moosehunter. Thanks to that, the game can now save properly.
GUI improvements:
We recently got a few complaints from some users about a design flaw on the GUI. Pressing Escape would immediately stop emulation and return to the game list. It is pretty easy to accidentally press the key and lose all progress. To make things worse, this key can be also used to exit full-screen mode, which makes further increases the likelihood of someone accidentally pressing it and losing all the progress on a game.

Thanks to EliseZeroTwo, a new confirmation dialog was added, that now asks if the user wants to stop the emulation, before taking any action. This prevents loss of progress.
Another recent addition was the introduction of the GPU vendor name on the bottom bar, made by Ac_K. This helps troubleshooting graphics issues. Users may often post screenshots with broken rendering, and in some cases this is caused by the GPU being used. In some cases (gaming laptops for example), the user may have two GPUs, the integrated one, and another dedicated one. For something like an emulator, they should be using the dedicated one, however, depending on the settings, the system may instead pick the integrated one. Including the information on the bottom bar helps us (and also some users) to identify this problem easily and advise users to switch to the correct GPU, without needing to look at logs.
Game of the Month:
In the last progress report, we introduced this new section where we take a look at how a Nintendo Switch game released on the month runs on this emulator. And at this point, you probably already know which game we will be talking about this time. Yes, it's the big release of the month, Animal Crossing: New Horizons!

The game has been working since release, but not without bugs, unfortunately. One of those issues is that a more recent version of the game (starting at version 1.1.0) requires some functions on the BCAT service that are not implemented.
With those issues fixed, we can progress further, to the point illustrated in the above screenshot. But at this point, we found another issue... The game tends to "crash" randomly in that part, mostly because the GPU emulator receives invalid command buffers. The GPU emulator receives garbage commands, tries to process them, and this causes it to fail left and right. Another common issue here is the game randomly freezing in this part. It is still the same problem, the GPU trying to process GPU commands that are not GPU commands, but just garbage. This may cause the GPU to wait for an event that will never occur, for example, and this causes it to freeze.
But, for better or for worse, the random nature of that bug means that we can get past that part, and proceed to create our character and island. If you do get past this initial section where it tends to crash, the game seems to be much more stable afterward.

Here we can customize the character to our liking. This part also had a bug caused by the lack of GPU scissors support on the GPU emulator, as we discussed earlier (which is not visible on the above screenshot, it is only on the "eyes" tab).

After some dialogs and some wait, we can finally arrive on our new island! On the screenshot above, you can also see the black sand issue that was discussed before.

The game currently has very few graphical issues, however, it does currently suffer from audio issues. They are mainly caused by a lack of proper audio mixing, but there's also another bug causing some sound effect to either loop endlessly or stop playing completely. Those issues should be addressed on the upcoming audio rewrite, we hope to share some news about that soon.
Other than those issues, from what we could test, the game is playable, and of course, the goal is only making the emulation better and better, so stay tuned for news!
Closing words:

We would like to thank all our current contributors, and you for your support! It's thanks to your support and our developers that we are where we are today.
Please share your thoughts about this progress report on the comments section below, we are always looking to improve, so feel free to suggest improvements!

And that's it for now. Stay at home and don't forget to wash your hands!
Comments
A lot of good work! Especially so quickly! Thanks for all your efforts.
ChickenNuggets
2020-04-08 18:24:54 +0000 UTCLooks like it was a lot of work! Thank you for your efforts!!!
Miguel González
2020-04-05 19:03:55 +0000 UTC