- use the exact sRGB->linear transfer function in HDR mode as the 2.2 gamma approximation is visibly inaccurate in this case

This commit is contained in:
Magnus Norddahl 2019-05-01 00:55:31 +02:00
commit 1973001834
5 changed files with 24 additions and 4 deletions

View file

@ -225,11 +225,12 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
{
// Full screen exclusive mode treats a rgba16f frame buffer as linear.
// It probably will eventually in desktop mode too, but the DWM doesn't seem to support that.
mPresentShader->Uniforms->InvGamma *= 2.2f;
mPresentShader->Uniforms->HdrMode = 1;
mPresentShader->Uniforms->ColorScale = (gl_dither_bpc == -1) ? 1023.0f : (float)((1 << gl_dither_bpc) - 1);
}
else
{
mPresentShader->Uniforms->HdrMode = 0;
mPresentShader->Uniforms->ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)((1 << gl_dither_bpc) - 1);
}
mPresentShader->Uniforms->Scale = { screen->mScreenViewport.width / (float)mBuffers->GetWidth(), screen->mScreenViewport.height / (float)mBuffers->GetHeight() };