diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-06-23 18:08:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-23 18:08:23 +0200 |
| commit | 02909bd1a560673a2d205bc95f5257436d194fad (patch) | |
| tree | f7462671e50770652fae79371645027867d8d560 /Source/Core/VideoCommon/FramebufferShaderGen.cpp | |
| parent | 5bf3d55d3864274814efc883fb54e464ae406cf0 (diff) | |
| parent | daddf4cd9cf7c45820f5cadd1539c6a6b366cfbc (diff) | |
Merge pull request #11850 from Filoppi/post_process_fixes
Video: implement color correction to match the Wii/GC NTSC/PAL color spaces (and gamma)
Diffstat (limited to 'Source/Core/VideoCommon/FramebufferShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/FramebufferShaderGen.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/Core/VideoCommon/FramebufferShaderGen.cpp b/Source/Core/VideoCommon/FramebufferShaderGen.cpp index 84e9e4b843..25b6581469 100644 --- a/Source/Core/VideoCommon/FramebufferShaderGen.cpp +++ b/Source/Core/VideoCommon/FramebufferShaderGen.cpp @@ -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(); } |
