mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-06-18 08:11:40 +00:00
Video: implement color correction to match the NTSC and PAL color spaces (and gamma) that GC and Wii targeted.
To further increase the accuracy of the post process phase, I've added (scRGB) HDR support, which is necessary to fully display the PAL and NTSC-J color spaces, and also to improve the quality of post process texture samplings and do them in linear space instead of gamma space (which is very important when playing at low resolutions). For SDR, the quality is also slightly increased, at least if any post process runs, as the buffer is now R10G10B10A2 (on Vulkan, DX11 and DX12) if supported; previously it was R8G8B8A8 but the alpha bits were wasted. Gamma correction is arguably the most important thing as Dolphin on Windows outputted in "sRGB" (implicitly) as that's what Windows expects by default, though sRGB gamma is very different from the gamma commonly used by video standards dating to the pre HDR era (roughly gamma 2.35). Additionally, the addition of HDR support (which is pretty straight forward and minimal), added support for our own custom AutoHDR shaders, which would allow us to achieve decent looking HDR in Dolphin games without having to use SpecialK or Windows 11 AutoHDR. Both of which don't necessarily play nice with older games with strongly different and simpler lighting. HDR should also be supported in Linux. Development of my own AutoHDR shader is almost complete and will come next. This has been carefully tested and there should be no regression in any of the different features that Dolphin offers, like multisampling, stereo rendering, other post processes, etc etc. Fixes: https://bugs.dolphin-emu.org/issues/8941 Co-authored-by: EndlesslyFlowering <EndlesslyFlowering@protonmail.com> Co-authored-by: Dogway <lin_ares@hotmail.com>
This commit is contained in:
parent
0584f8ae2a
commit
a2702c6e27
27 changed files with 755 additions and 141 deletions
|
@ -672,7 +672,7 @@ std::string GenerateImGuiVertexShader()
|
|||
return code.GetBuffer();
|
||||
}
|
||||
|
||||
std::string GenerateImGuiPixelShader()
|
||||
std::string GenerateImGuiPixelShader(bool linear_space_output)
|
||||
{
|
||||
ShaderCode code;
|
||||
EmitSamplerDeclarations(code, 0, 1, false);
|
||||
|
@ -680,8 +680,13 @@ std::string GenerateImGuiPixelShader()
|
|||
code.Write("{{\n"
|
||||
" ocol0 = ");
|
||||
EmitSampleTexture(code, 0, "float3(v_tex0.xy, 0.0)");
|
||||
code.Write(" * v_col0;\n"
|
||||
"}}\n");
|
||||
// We approximate to gamma 2.2 instead of sRGB as it barely matters for this case.
|
||||
// Note that if HDR is enabled, ideally we should multiply by
|
||||
// the paper white brightness for readability.
|
||||
if (linear_space_output)
|
||||
code.Write(" * pow(v_col0, float4(2.2f, 2.2f, 2.2f, 1.0f));\n}}\n");
|
||||
else
|
||||
code.Write(" * v_col0;\n}}\n");
|
||||
|
||||
return code.GetBuffer();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue