libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.31k stars 1.84k forks source link

[Vulkan + HDR] Many shaders oversaturate / burn / darken colors #14582

Closed aitorciki closed 2 years ago

aitorciki commented 2 years ago

Description

After (and including) Retroarch 1.11, many shaders (e.g. crt-easymode-halation or newpixie.crt) render an oversaturated and dark image when using Vulkan and HDR on Windows 10 + Nvidia. The problem affects all cores.

The issue can not be reproduced on 1.10 or prior, and thus seems related to https://github.com/libretro/RetroArch/commit/a058c78fd04398c0c83c7e5925a178bacf265fff.

RetroArch 1.10.1 (clean install), bsnes + crt-easymode-halation: RetroArch bsnes 115 2022-11-03 01_04_40

RetroArch 1.11.1 (clean install), bsnes + crt-easymode-halation: RetroArch bsnes 115 2022-11-03 01_03_15

LibretroAdmin commented 2 years ago

What happens on D3D11/D3D12? Is the output there more in line with the first screenshot?

aitorciki commented 2 years ago

D3D10, D3D11 and D3D12 are all unaffected and render as expected, in line with the first screenshot (as of RetroArch 1.12.0).

RetroArch 1.12.0, D3D10 (crt-easymode-halation) (captured through Xbox Game Bar, looks darker than on display but reds aren't off): RetroArch bsnes 115 2022-11-03 11_52_01

RetroArch 1.12.0, D3D11 (crt-easymode-halation): RetroArch bsnes 115 2022-11-03 11_56_59

RetroArch 1.12.0, D3D12 (crt-easymode-halation): RetroArch bsnes 115 2022-11-03 11_53_10

LibretroAdmin commented 2 years ago

What about the GLCore video driver? Does it have similar issues as Vulkan, or is that more in line with D3D10/11/12?

aitorciki commented 2 years ago

AFAICT GLCore doesn't support HDR, and the issue only shows up with HDR enabled.

LibretroAdmin commented 2 years ago

Yes, you're right, sorry for bringing it up.

Themaister commented 2 years ago

Is this a shader that relies on tonemap to HDR, or is this a shader that is emitting HDR10 on its own?

hizzlekizzle commented 2 years ago

easymode-halation shouldn't be doing any tonemapping of its own and should be outputting the regular R8G8B8A8_UNORM.

Themaister commented 2 years ago

bilde

I reproduced this. inverse_tonemap = 0.0 and hdr10 = 0.0. So there is no tonemap to PQ happening here on Vulkan for some reason.

LibretroAdmin commented 2 years ago

hi there @aitorciki , do you know how to compile / build RetroArch from a PR?

https://github.com/libretro/RetroArch/pull/14587

If you could test this PR and let us know if this resolves your issues, thanks.

If you cannot do this, we could always opt to merge this and then ask you to test a nightly build later on to see if it fixes the issue.

LibretroAdmin commented 2 years ago

Guess I'll go ahead and merge this so you can test it in the next nightly, and so it will be ready for the next stable.

LibretroAdmin commented 2 years ago

@aitorciki Let us know your results.

aitorciki commented 2 years ago

Hi there! Nightly tested, I can't reproduce the color issue anymore testing with many of the previously offending shaders 👍