Rakashazi / emu-ex-plus-alpha

Multi-platform computer & game console emulation system including supporting code (EmuFramework) and core engine (Imagine)
GNU General Public License v3.0
707 stars 153 forks source link

Problem with SRGB and Prescale 2× #220

Closed M-a-r-k closed 2 years ago

M-a-r-k commented 3 years ago

I noticed a strange issue with Prescale 2× image effect and SRGB. (Testing with Snes9x EX 1.5.54 on Huawei P Smart 2019 phone.)

In theory, Prescale 2× being enabled should cause no change at all in the output image when:

However, when SRGB is enabled there is a noticeable difference in image quality with Prescale 2×.

Run 240p Test Suite and select Gray Ramp. Without Prescale 2×, the stripes look as they should. Each shade is distinguishable.

However if you enable Prescale 2×, the output is different. Some stripes are exactly the same color (e.g. 2nd & 3rd from left in lower half of screen). And some stripes have a pinkish tint.

Change effect format from RGBA8888 to RGB565 and the output becomes much more wrong. Some stripes are much more obviously green or pink.

M-a-r-k commented 3 years ago

This issue actually applies whichever image effect is used, hq2x and Scale2x too. It's not specific to Prescale 2x.

Rakashazi commented 2 years ago

I was working on the texture format and color space handling in the last commit and this should now be fixed. The problem was the sRGB conversion happening at the wrong step in the rendering chain and creating incorrect output. The app now adjusts all texture formats every time a change like enabling/disabling an effect happens and also enforces RGBA8888 everywhere while sRGB mode is selected so color precision isn't lost. Let me know if it's fixed when you test the nightly or on the upcoming 1.5.57 update.