libretro / snes9x2005

Snes9x 2005. Port of SNES9x 1.43 for libretro (was previously called CAT SFC).
Other
15 stars 32 forks source link

Backports: Colour operations from Snes9x 1.60 + MIPS optimisations from PocketSNES #76

Closed jdgleaver closed 3 years ago

jdgleaver commented 3 years ago

This PR makes the following changes:

1) At present, the core makes use of two lookup tables for COLOR_ADD and COLOR_SUB operations. This has some performance benefits in certain circumstances, but on cache-starved platforms it is horrible. For example, on an RG350M, these two lookup tables alone are 16 times the size of the L1 cache (or are equal in size to the entire L2 cache). This means cache misses all the way... Snes9x 1.60 removed the lookup tables, replacing them with direct bit twiddling. This requires more computation, but on the platforms targeted by Snes9x2005 this does not outweigh the benefits of loosing the 'memory abuse'. The PR backports this modification. NOTE: The new colour handling code is only compatible with RGB565 and RGB555 pixel formats. This means it works for everything apart from the PSP. We therefore retain the old lookup table code path for this particular platform (I would have attempted to add BGR555 support to the new path, but since I can't test the code I didn't want to risk it...)

2) The MIPS-specific optimisations from PocketSNES (https://github.com/soarqin/PocketSNES/commit/6864951eb9e7070a2ade9dbacb340a265befb2b5#diff-ba2f6a50a415e2ce065406d43ca9cbce86bbf7784e437260193794c1c9d709bb) have been added to the core.

Tested on an RG350M (OpenDingux/MIPS), the performance improvement from these changes is breathtaking. Previously, the core was barely usable. Now almost every game runs full speed with the non-plus core, and a small number of games even run full speed with the Normal2x video filter.

jdgleaver commented 3 years ago

@m45t3r Just pushed another commit - I hope that resolves everything...?