libretro / pcsx_rearmed

ARM optimized PCSX fork
GNU General Public License v2.0
168 stars 120 forks source link

unai: Use 8.8 RGB triplet format for gouraud shading #789

Closed pcercuei closed 1 year ago

pcercuei commented 1 year ago

Use a new 'gcol_t' type which fits in 64 bits, and encode each color component into a 8.8 fixed-point format.

This boosts the precision of the gouraud shading algorithm, at almost zero cost.

Fixes #320.

pcercuei commented 1 year ago

@notaz not sure if you want that in your repo too. It didn't apply cleanly on top of your master branch.

notaz commented 1 year ago

almost zero cost

I wonder if this is true for old ARM CPUs as you disabled some ARM specific stuff there.

pcercuei commented 1 year ago

Try it? I don't have any hardware to test it on.

notaz commented 1 year ago

Unfortunately your change breaks transparencies on ARM when dithering is off: a

Seems to be related to MSB_PRESERVED thing, which is set only on ARM, question is why it doesn't break before your change?

As for performance, it's ~1% hit with dithering on and ~3-4% when off for Crash3 on quite old Cortex-A8, which I'd describe "not great, not terrible" I guess.

pcercuei commented 1 year ago

But it does break on master as well. I can reproduce it on PC by setting #define MSB_PRESERVED (!CF_DITHER).

notaz commented 1 year ago

ARM was doing something different from the fallback then. I can assure you ARM has no issues before your change for both dithering on and off.

pcercuei commented 1 year ago

Should be working now.