SakeTami
dobiestation
dobiestation

patreon


The VU Recompiler has been merged!


As of today, the VU recompiler has been merged. You can check out the PR here, if you wish: https://github.com/PSI-Rockin/DobieStation/pull/129

This is exciting stuff! After two months of hard work, DobieStation has passed an important milestone. And it wasn't done alone: refraction, a member of the PCSX2 team who has previously helped DS, has done a great job ironing out the trickier VU quirks (of which there are many). Aside from the recompiler, others have been working on nice quality of life improvements. kojin is working on a redesigned UI with a game list and controller support, and ScrelliCopter has added CSO support.

It's not all peaches and roses though. There remains a bug in the JIT causing incorrect division results under certain circumstances. More damning, however, is that the VU JIT by itself only speeds up a select few games. While profiling reveals that the JIT is indeed much faster than the interpreter on the emulation thread, most 3D games are bottlenecked by the software renderer, which runs on a single thread and has no texture caching. Anyone that has used PCSX2's well-optimized software renderer can imagine how slow that may be.

So, the next step for speed is to implement a GS recompiler. This may seem crazy to some - after all, how do you recompile a GPU? It's not so bad, as it turns out. The GS is fixed-function and has no shaders. This means that the rendering pipeline is completely immutable while a primitive is being rasterized. In the current renderer, we have to perform many checks and tests on a single pixel, which shows things down. The recompiler can create a function that hardcodes all these checks, resulting in greater efficiency without any loss in accuracy. It also provides the opportunity for us to use SIMD instruction sets like SSE and AVX, allowing us to process multiple pixels at once.

The good news is that the VU JIT provides the backbone we need to implement additional recompilers. The cache and emitter code can be used as-is, for instance. This will be a great boon not only for the GS recompiler, but also future recompilers for the EE and potentially even IOP. The VU IR is flexible and will assist greatly in implementing new backends in the future, such as for ARM.

As far as accuracy goes, I also want to revamp the timings in DobieStation. It's a hacky mess that was implemented a year ago, and quite a few games have problems with it: interrupts happening too soon or too late, DMA buffers being overwritten, jumps to nonexistent memory regions... bad stuff. These changes will be happening concurrently with the GS and EE recompilers and should put DobieStation in a good place for a first release.

If you know how to write PS2 homebrew and are interested in contributing to PS2 emulation, contact me! There's many unknown timings in the PS2 hardware such as in the IOP peripherals and the IPU that I'd like to address, but I need data from real hardware to do so.


More Creators