Eliminating Stutter with Asynchronous Shader Implementation!

Background

Shader compilation stutter is nothing new to most emulator users, especially on RPCS3. However it is worth clearing up some misconceptions that go around regarding how RPCS3 shaders work. I’ll try to quickly go over the history of shader compilation on RPCS3 and hopefully explain why the shader compilation stutter appeared and why some people believe RPCS3 did not have shaders before.

Shader complexity and custom vertex fetch

In early 2017, I embarked on a task to remove the very expensive vertex preprocessing step from the CPU side of RPCS3. This basically meant implementing all those custom vertex types and vertex reading techniques to the vertex shader and providing only raw memory view that the ps3 hardware would be viewing. This greatly improved RPCS3 performance, more than tenfold in some applications. This change is what made RPCS3 usable for playing real commercial games with playable framerates without needing HEDT system. However, the new fetch technique increased the size of the vertex shader and added a complex function to extract vertex data from the memory block. This made the graphics drivers take very long to link the programs, even without optimizations, likely due to use of vector indexing, switch blocks and loops with dynamic exits. Extra operations including bitshifts and masking were also needed to decode the vertex layout block. The code runs very fast, but the linking step is very slow. A shader cache system already existed before and if you ran an area for the first time, there was slight microstuttering that some users did not notice; its this stutter that got much worse. The solution to this: preload the shaders so that you don’t need to compile them next time. This lead to the infamous “Loading Pipeline Object…” screen and the “Compiling shaders…” notification.

Challenges

There are several challenges to tackling RSX shaders. First, the RSX is not a unified architecture like most programmers are used to today. It has separate vertex and fragment pipelines, both with their own separate ISA. They are also very limited and larger programs or more complex programs can result in very messy binaries. One of the largest problems is that the bytecode itself does not contain all the information required to run the program, extra configuration is configured via registers as draw calls are passed in. A good example is that the TEX instruction does not differentiate between texture types, but a texture configuration register exists that allows using the same program to read 1D, 2D, 3D, or CUBE textures as well as their shadow comparison variants. This means you can only know the generated shader once the texture register has been set up. There are other examples of things like these that make it so that you need the game to set up the program environment before the program itself is compilable.
Continue reading Eliminating Stutter with Asynchronous Shader Implementation!

Progress Report: June 2018

In addition to the following report, further details of Nekotekina and kd-11’s work during June and upcoming contributions can be found in their weekly reports on Patreon. This month’s Patreon reports are:

Status update from kd-11 (2018-06-05)
Status update from Nekotekina (2018-06-12)
Status update from kd-11 (2018-06-20)
Status update from Nekotekina (2018-06-27)

Table of Contents

Major Improvements
Games
Commits
Upcoming
Conclusion

On compatibility database statistics, we can see a big decrease in Loadable games due to several recent changes targeting issues that kept those games from progressing further. The Nothing category also went down by 2 games, with only 6 games remaining in it.

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (June 2018)

On Git statistics, there have been 16 605 lines of code added and 10 558 removed through 135 commits by 21 authors.
Continue reading Progress Report: June 2018

Progress Report: May 2018

RPCS3 continues to see major improvements over the month of May, with Nekotekina implementing SPU LLVM (still WiP) and kd-11 continuing with improvements to RPCS3’s RSX emulation. More major AAA exclusives have also started to go ingame for the first time! We also saw new contributors join in and make much appreciated improvements to RPCS3.

In addition to the following report, further details of Nekotekina and kd-11’s work during May and upcoming contributions can be found in their weekly reports on Patreon. This month’s Patreon reports are:

Status update from kd-11 (2018-05-05)
Status update from Nekotekina (2018-05-14)
Status update from kd-11 (2018-05-20)
Status update from Nekotekina (2018-05-29)

Table of Contents

Major Improvements
Games
Commits
Conclusion

The Nothing category is now at an all-time low, reducing by just over half, work is already being done to make this category shrink even further! The Playable category has had another nice increase, as more Playable titles were found. Furthermore, many entries for the same Game Media on the list were merged (due to new reports for different regions being submitted these past months), so the overall game count has decreased, even though there were new unique submissions. For a more detailed look, you can view the compatibility history page to see exactly which games had their status changed this month.

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (May 2018)

On Git statistics, 23 166 lines of code were added and 6 732 were removed by 17 authors.
Continue reading Progress Report: May 2018

Progress Report: April 2018

April has been a month full of advancements in nearly every aspect of RPCS3. Performance boosts, graphics fixes, and compatibility improvements are plentiful.

Table of Contents

Major Improvements
Games
Commits
Conclusion

On Compatibility statistics, we can see a huge increase in Playable titles. A lot of games were retested, and many Ingame or below ones were found to now be Playable. There was also a considerable decrease on the amount of Loadable games and a slight increase in games classified as Nothing, as new games were added into the category.

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (April 2018)

On Git statistics, 7 018 lines of code were added and 4 535 were removed by 12 authors.
Continue reading Progress Report: April 2018

Progress Report: March 2018

March has been an amazing month full of progress for RPCS3. This month marks the first time that games in the “Nothing” category fell beneath 1%! We had massive strides in graphical accuracy, along with improvements in SPU performance and game compatiblity. From giant pull requests that generated tons of hype, to a small typo fix that had unexpectedly wide-ranging impacts, this month has had it all.

Table of Contents

Major Improvements
Games
Commits

Below are the usual compatibility database statistics, with all metrics moving in the right direction. The tiny number of games left in the Nothing category is quite exciting, especially considering this was the largest category not long ago.

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (March 2018)

Continue reading Progress Report: March 2018

Progress Report: February 2018

RPCS3 has reached version 0.0.5! The full change log since 0.0.4 can be read here, but the highlights are massively improved compatibility (nothing section is down to 1.34%!), better AVX-512 and AVX2, as well as input improvements and profiles.
We also saw the end of PSP2 emulation in RPCS3. While it remains alive in a separate branch, the Vita emulator has been removed from master in light of the Vita3K project.
kd-11 also implemented a native user interface, allowing for games to be played fully with a controller, with the small exception of the on-screen keyboard, which doesn’t exist yet.

This report will focus on the changes that happened in February, which include some exciting work slimming down the nothing and loadable sections. RPCS3 is within reach of having every tested PS3 game be at least in the loadable section, if not the intro section!

Table of Contents

Major Improvements
Games
Commits
Upcoming
Conclusion

On compatibility database statistics, there’s not a big difference from last month as less games were tested, even though there were massive changes to the emulator (expect a beefier March report!). We can see an overall ~0.20% decrease on all categories except Ingame, which increases by ~0.80%. Note that we currently only have 34 games left on Nothing, and plan on making that number even smaller very soon!

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (February 2018)

On GitHub statistics, 6 939 lines of code were added and 36 937 were removed through 43 Pull Requests by a total of 15 authors.
Continue reading Progress Report: February 2018

Progress Report: January 2018

Welcome back to the first progress report of the year. Quite a large number of fixes and improvements have been made already, and as you can see below from the big compatibility bump we are starting the year off strong. kd-11 has made some major improvements that increase stability and functionality including increasing performance with Ryzen and implementing a Native UI to RPCS3. While Nekotekina has continued to review people’s changes, making sure everything was in a good enough state to be merged, he continued to work on the core of RPCS3. Megamouse has also made many improvements to the way RPCS3 handles input allowing a bunch of games to progress further and he also fixed other issues with the UI.

Table of Contents

Major Improvements
Games
Commits
Upcoming

On the compatibility database statistics, over a hundred games moved out of the Nothing, Loadable, and Intro sections and in to Ingame or Playable. In addition, the Nothing section has now fallen below 2% of tested games, and hopefully Loadable will follow next. This means RPCS3 is on the right track to ensure accuracy and compatibility with the largest number of titles possible.

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (January 2018)

On GitHub statistics, 7,454 lines of code were added and 2,160 were removed by a total of 14 authors.
Continue reading Progress Report: January 2018

RPCS3 2017 Wrap-up: A Stunning Year of Progress

Introduction

RPCS3 is an open source Sony Playstation 3 emulator for Windows and Linux. Currently, it has two full-time paid developers, and numerous volunteer developers. RPCS3 has existed since 2011, but development took off a year ago when the Patreon launched and Nekotekina followed by kd-11 began working on the emulator full time. This post will summarize what interesting developments and progress has happened in the last year. If you want to see how the codebase has changed over time, you can head over to the full list of merged PRs for 2017 and check it out. As seen on the GitHub statistics page we had 630 pull requests merged during 2017, and many of these contain numerous commits. That is a lot of code!

RPCS3? What Does That Even Mean?

When you think about it there is a tradition of Sony emulator names in this style. You have ePSXe, PCSX2, JPCSP, PPSSPP, and now RPCS3 as examples of PS1, PS2, PSP, and PS3 emulators. There is a story behind all of these names of course, but in the case of this little PS3 emulator it was given this name by the founder DH (who no longer works on the project). It is an abbreviation and combination of Personal Computer (PC) and PlayStation 3 (PS3). PC + PS3 = PCS3. What does the R stand for? DH and BlackDemon recollect that it used to stand for Real as back in 2011 there were only fake malware emulators around. Then at some point DH who is from Ukraine started saying the R stood for Russian which is what we roll with today as Nekotekina who joined in late 2013 and quickly became one of the biggest developers and the architect, is from Russia. So RPCS3 stands for Russian Personal Computer Station 3.

In this image of the old branding from 2016 RPCS3 is written with the Russian letter я, though this letter is in fact not pronounced like a Latin R at all (it is [ja] as in “yard”).

A short introduction

Where Were We One Year Ago?

One year ago in January of 2017 RPCS3 development had stagnated. The emulator itself ran almost no games properly, only roughly 20 titles were playable, and most of these were simple 2D games. Quite a few more did show intros or even go ingame, but due to generally very poor performance, bugs, and crashes almost nothing was really playable.

January 15th, 2017, tkoham opened an issue suggesting that RPCS3 launch a Patreon. A long discussion starting on GitHub and moving on over to a new and at the time “private” Discord channel and a few days later, the Patreon was launched. Shortly after, the Discord server went public and the new website launched. At the time, only a handful of commercial games even booted, and only the simplest of games, such as the Arkedo series, were anything near playable. The UI was unwieldy, installing games was tedious, and manually picking LLE modules was an immense challenge. Development had slowed considerably, with only Nekotekina and a handful of others making occasional commits.
Continue reading RPCS3 2017 Wrap-up: A Stunning Year of Progress

Progress Report: December 2017

What a way to end the year, eh? We started the last month of 2017 with a bang with RPCS3 taking major steps towards emulating many heavy hitting AAA titles, including quite a few exclusives like Uncharted and God of War. Some moved in to Loadable, others Ingame, and a few are even playable now. More can be read about this here. While these changes were made last month and received a post of their own, they had an impact on many other games that were discovered this month, and such incredible work deserves recognition. This progress report will focus on progress over the month of December. First and foremost, below is a video summary and report of various games that improved this month. Take a look, and read on for even more detail!

Table of Contents

Major Improvements
Games
Commits
Upcoming
Conclusion

First of all, let us have a look at the compatibility database statistics. As we predicted last month the number of games in the Nothing category is now less than 100! A year ago this with the Loadable and Intro categories represented the biggest chunk of registered games, most simply did not work more or less.
Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (October 2017)

However we are now making quite a drastic change to how compatibility is counted. Above different versions of the same game are counted separately. So for example instead of simply having one entry for Demon’s Souls, there are currently four entries: the european disc and PSN versions, and the american disc and PSN versions. This could even become six entries if someone were to test the japanese counterparts.

This is a very traditional way for emulators to look at compatibility, but because of the nature of such a “modern” console like PS3, there can be a lot of different versions of the same game. We have different regions: Europe, America, Japan, Asia, Korea, Hong Kong. And for each region the disc version and the PSN version.

So as can be seen below, we are merging all entries of the same game under the same media type (disc or digital), into a single entry.
There are some differences on compatibility between media types, like Demon’s Souls, where only the disc versions are currently playable, while the PSN versions fail to get past a black screen. But every disc version is playable the same, and every PSN version fails the same, so it makes sense to simply count the disc versions Playable once, and the PSN versions as Nothing once in the statistics.
Also note that not every game is merged yet, so the entries count is likely to go down again in the next month.

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (October 2017)

Here is the full log of every game that changed status in December

Speaking of statistics, over on github 13 authors have pushed 95 commits where roughly 115 files were changed, with 5000 lines added, and 1400 lines removed.

Continue reading Progress Report: December 2017

Progress Report: November 2017

November was one of the most interesting months of the year thanks to the huge amount of games that jumped out of Nothing into the Ingame/Playable categories. This is in part thanks to the hard work announced in December 1st, which made many previously non-working big titles now start working on RPCS3. Of course, some of the progress towards this announcement was merged gradually during the month of November. In this Progress Report, major emulation improvements will be detailed, followed by a list of noteworthy, interesting, and representative games that improved from these, and lastly individual contributions will be looked at closer.

Table of Contents

Major Improvements
Games
Commits
Closing Words

First things first, the compatibility statistics. In November we saw the category of games that do absolutely Nothing go down by over 100 games, and this while not taking in account any of the games that had reported improvements in December!
We are therefore making a prediction right now: thanks to the SPU/RSX fixes, amongst several other improvements: the number of known games that do Nothing will be less than 100 before the end of the year!

That is quite the feat because when the RPCS3 project got revitalized in January, thanks to Patreon and the full time employment of Nekotekina we had less than 100 games that were Playable – that to quite a lower standard than today. And the category Nothing didn’t even exist because we argued that “What is the point? Almost every game does Nothing anyway”. How far have we come!

Game Compatibility: Game Status
Game Compatibility: Monthly Improvements (November 2017)

Looking at the GitHub statistics for November 16 authors have pushed 172 commits with roughly 11,000 added lines of code, and 5,000 deletions.

Continue reading Progress Report: November 2017