Yes, you’ve read correctly. Many of the much awaited exclusives are now finally starting to be emulated by RPCS3. In this blog post, you’ll learn which games we know to have improved and how we’ve done it.
But first, check out this awesome teaser:
Table of Contents
SPU Improvements by Jarves
There were two main changes to the SPU emulation that brought us to this point of allowing so many newer titles to progress past ‘Intro.’ Let’s take a quick look at both individually.
SPU Interrupt Fix
Many titles in RPCS3 ‘hang’, but in the case of the titles mentioned above, they do not actually crash, and the fps counter would still change with just a black screen. This normally would be mistaken for RPCS3 just being slow and the game taking a bit to load, but opening up the debugger in RPCS3 tells a different story. The games would loop over the same code on both the PPU side and SPU side. In this case, they are waiting on something, but what?
SPU MFC Queue Stall Fix
This commit first requires a quick tutorial on how the Cell processor actually works:
For design reasons relating to performance and speed (explaining this more could be a blog post on its own!), the SPU, unlike the PPU core, doesn’t actually have direct access to main memory, and instead each core has their own tiny 256kb of Local Storage (LS) memory. In order for the SPU to access main memory, and get data in and out of their respective LS, memory transfers are ‘queued’ to what’s known as the Memory Flow Controller (MFC). The MFC is then responsible for the actual copying and transfer of memory. On top of that, there are multiple different types of transfers and the MFC can not only choose to execute transfers out-of-order, the SPU can request certain transfers are held, forcing something that would normally be in-order, to not be.
That last statement from above is key; the emulation of the MFC in RPCS3 has only ever supported in-order executing. Up until these new titles started booting did we finally see SPU code actually request a transfer be held, or stalled, so there was never a reason to change or implement it. I’ve not only fixed the emulation of MFC so it stalled, or held, certain requests by the SPU, I also added out-of-order execution when encountering these special transfer requests. This ended up bringing a slightly more accurate MFC emulation, along with killing some random crashes in these new titles.
After these needed SPU changes were made to get games booting, kd-11 tackled some of the graphic issues in them.
RSX Improvements by kd-11
It has been an exciting month since it was decided earlier on to finally present the SPU improvements code by Jarves. While this means that more games successfully boot, it also means rpcs3 graphics back-end is exposed to games utilizing more advanced techniques and new bugs were inevitably going to get introduced.
Before, I tackled any new games that would be bootable, I decided to take a look at games that were already relatively stable that presented similar looking bugs based on early game screenshots of God of War 3. It is usually a lot easier to debug a game that boots successfully since you can make progress a lot faster if the code doesn’t randomly crash every few seconds. For this task, I decided to look into Dark Souls 2 which had multiple problems from tone-mapping to depth precision.
1. Dark Souls 2
Earlier in the month, hcorion fixed a mouse bug that was keeping Dark Souls 2 from booting. The game was relatively stable but had graphical artifacts that I identified as being related to the HDR pipeline.
After pouring through traces for a few days, it became apparent that some instruction to clamp negative values was missing. Searching for this led nowhere until I found that instructions in the target shader differed very slightly with those from other shaders in that 3 extra unused bits were being manipulated. Quick tests showed that these bits could add extra precision and clamping modifiers and implementing this into the emulator fixed the random bright spots.
The next challenge was the missing shadows. Looking through the traces showed that a color texture was being bound for use instead of a depth texture which made no sense. It was then when I discovered there was a problem with render target address aliasing. It is not possible to determine via addresses or MRT configuration if a memory block will be used for depth or color if set to both. It is also valid to do so on the PS3. The value to be written is determined by other settings such as depth test status or color write mask. After tuning the checks to only always allow one type of target to exist, shadows were working, but flames and collectibles were visible through walls.
Looking through again showed the game was writing to addresses as color buffers in RGBA then binding the memory as the depth buffer. This is allowed since its all just bits to the RSX. This prompted the creation of an overlay pass system to handle data casts between incompatible types such as color to depth. With the depth working properly it was time to fix the final issue – depth was not working correctly. In fact it looked as though only 8 bits of precision were available which is very poor.
I recognized this error from previous work handling data casts between depth textures and RGBA color and it was reported in other titles such as God of War collection and Castlevania: LOS2. The issue came down to respecting texture channel swizzles where the components are shuffled around during readback. After setting this up, Dark Souls 2 was more or less looking great.
2. God of War: HD Collection
As a consequence of properly fixing the depth casting/interpretation as RGBA color, games like God of War Collection also got partially fixed and I embarked to fix the remaining glitches.
The major issue with flickering around some objects like flames or the blades of chaos were fixed by fixing the depth, but shadows were not working on OpenGL. Quick testing showed that face winding on OpenGL was broken and was promptly fixed.
3. Demon’s Souls and Vulkan ZCull
This took a few days to implement and tune for accuracy and it works very well, albeit a little slow and very demanding on system resources. Tuning in the near future will fix that issue as well. This finally resolved the “sun shining indoors” bug when playing Demon’s Souls using Vulkan.
Other fixes applied to Dark Souls 2 such as implementing precision modifiers also fixed the last remaining visual bugs on the game such as the Valley of Defilement being overly bright to the point where geometry can be seen popping into view and also the dark tone on the character creation and profile loading screens.
Testers had reportedly gotten Uncharted 1 to boot as well as its demo. There were many problems with it, including spamming the infamous “Texture upload requested but texture not found” error as well as broken HDR pipeline and misaligned screen-space effects. Luckily this one was not too difficult since most of the work was already done when investigating Dark Souls 2. A few texture cache fixes later and the game was graphically okay, with the exception of broken shadows, but that could wait since there were more pressing issues.
5. Ratchet & Clank
Ratchet & Clank HD I, II, III and IV games were also booting with the SPU fixes, but there was a minor problem where there was no display output.
To be more accurate, sampled clamped edge artifacts were all over the screen meaning that a texture was accessed outside its boundary in the vertical axis. The issue came down to a bad interpretation of the s1 data type when inserted via immediate commands.
Another issue was missing loading screens which were fixed by aligning data writes in the float3 format to 16 bytes (essentially float4 configuration).
6. God of War 3
This one hit the existing RSX emulation pipeline hard and highlighted so many bugs. First was to get bugs related to texture readback (Write Color Buffers) out of the way. With this fixed, nothing improved, but investigations led to the reimplementation of the pack and unpack fragment shader instructions.
This game uses a lot of tricks to achieve scaling on floating point textures which was not possible natively on DX9-class hardware. This requires packing bits into 8 bit values, writing to RGBA8, scaling down, then reconstructing the floating point textures again, averaging, then the cycle repeats until the proper value is written to the final 1×1 target. This still does not fix the final problem with the game which is that it exploits register aliasing, which is difficult to implement. As such, brightness calibration is still off.
On the PS3, one 128-bit register can hold 8 half-floats or 4 full single precision floats. Writing to a half value will modify some bits in the float value that occupies the same memory region.
Fixes for this will be coming soon to rpcs3 once the implementation is ready.
List of known Improved Games
Note: This is far from being a complete list of improved games. There are surely many other games that also improved from the aforementioned changes. Obviously, there’s no way for us to test even half of the huge library that is the PS3’s. It’s up to you to retest your games and find out if and how they improved.
God of War I & II
Huge improvements made it so both God of War I and II are now Playable. Jarves’ SPU fixes fixed freezing cutscenes and finally brought us working Audio (previously the game was completely dead silent).
On the graphical side, kd-11 fixed broken lighting and shadows. This allows the game’s beauty to be finally fully enjoyed on RPCS3, as graphics are now perfect.
God of War III
Oh boy. The game everyone kept asking endlessly for us to get fixed. It seems the time has finally come, as God of War III finally not only started properly booting with Jarves’ SPU fixes, it actually now goes Ingame!
But as nothing is a sea of roses, when we went Ingame, we found ourselves looking to an incredibly slow and graphically broken game (as we were already expecting from such an early emulator like RPCS3).
The game was running at ~1fps on battles, but the important detail here was that we were using SPU Interpreter, as SPU Recompiler wasn’t working due to an unimplemented instruction.
Jarves promptly implemented the missing instruction, and back ingame we went, this time with ~3fps instead of ~1fps. Although it may not seem like a lot, it is a ~3x increase on speed. Not bad as a first step towards achieving good framerates.
God of War: Ascension
There’s still a weird looking bug with clipping on this one. Nevertheless, it also now goes Ingame!
Uncharted 1 now goes Ingame! Performance is not ideal yet, but progress on graphics has been done already as described by kd-11 in his above writeup.
Uncharted 2 previously crashed after the loading icon (spinning dagger). Now it shows intro and a few videos, and will crash after playing them.
Uncharted 3 Beta now shows title screen, Uncharted 3 Demo shows menus and Uncharted 3 (Disc) shows the Naughty Dog intro screen, but unfortunately none go Ingame yet.
Ratchet & Clank I, II, III, IV (Deadlocked/Gladiator)
Jarves’ fixes yet again saving the day, making all four mentioned Ratchet & Clank HD Remasters now go Ingame. After kd-11 fixed the R&C graphical issue (mentioned in RSX Improvements), all games started rendering proper graphics.
Sadly though, these games currently suffer from heavy flickering in textures, which is something we plan to debug and hopefully fix soon.
Ratchet & Clank: Tools of Destruction
LittleBigPlanet II now goes Ingame, although for now it needs existing save data utility from a console (dev_hdd0/game/BCUS98245_USER1) in order to work.
LittleBigPlanet III also goes Ingame, also needing existing save data utility from a console (dev_hdd0/game/BCUS98362_USER1).
WipEout HD now goes past menus and goes Ingame, ready to race! Though do note it may be unstable, but despite that, the framerate is quite good.
As most of you figured out from our progress report.. Yes, the last screenshot that was on it was inFamous 1. This game now boots and goes Ingame as well, however as stated in the video the full game gets stuck during the tutorial section and you can’t control your character. To get around this you can either load a save or play the demo version. Graphics are sadly heavily broken right now.
And just like inFamous 1, inFamous 2 now boots to get ingame you need to play the demo version, as it currently requires the SPU interpreter option and doesn’t work with ASMJIT performance is lower than Infamous 1. Graphics are broken just like its predecessor.
Playstation All-Stars Battle Royale
Playstation All-Stars now goes Ingame while also rendering correct graphics. Sadly, the game is unstable with Vulkan and performance isn’t the best.
Albeit a bit unstable at times, Heavenly Sword goes Ingame with good graphics.
Gran Turismo HD Concept
This title now also goes Ingame, and you can play through races. Graphics look good, but as of now they occasionally flicker. It also runs a bit slow, as one would expect.
Gran Turismo 5 Prologue
Gran Turismo 5 Prologue now goes to Menu, unfortunately with broken graphics.
Gran Turismo 5
Gran Turismo 5 now shows the copyright screen.
Gran Turismo 6
The Last of Us
Yet another step towards getting the big boi to run in RPCS3. The Last of Us now goes further than the initial loading screen to display the Health Disclaimer and play some audio before dying.
Killzone 3, which previously showed only a black screen, now shows Intro screens.
Motorstorm RC now goes Ingame with a few graphical bugs.
These changes are a huge step in PS3 emulation, and now allow for huge AAA titles which whose emulation was eagerly awaited to start functioning.
While the games shown here aren’t in a Playable state yet, they’re now closer to reach such status than ever, as now most go Ingame and can be further debugged within RPCS3.
Lastly, do note that we haven’t extensively tested these changes with a broad range of games, so it’s up to you to find out which other games also improved, as surely many did!
This blog post was written by Ani, ssshadow, Jarves and kd-11.