From 19a5a2fd2b8d1bcb1690f4fe0f0166f5ec33be4d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 11 Aug 2018 09:27:35 +0200 Subject: [PATCH] - fixed dither math. --- src/gl/renderer/gl_postprocess.cpp | 4 ++-- src/gl/renderer/gl_stereo3d.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 9edd43c2a..d327e9eb3 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -236,11 +236,11 @@ 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->ColorScale = (gl_dither_bpc == -1) ? 1023.0f : (float)(1 << gl_dither_bpc - 1); + mPresentShader->Uniforms->ColorScale = (gl_dither_bpc == -1) ? 1023.0f : (float)((1 << gl_dither_bpc) - 1); } else { - mPresentShader->Uniforms->ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)(1 << gl_dither_bpc - 1); + 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() }; mPresentShader->Uniforms.Set(); diff --git a/src/gl/renderer/gl_stereo3d.cpp b/src/gl/renderer/gl_stereo3d.cpp index 829dbb1f1..2684622d8 100644 --- a/src/gl/renderer/gl_stereo3d.cpp +++ b/src/gl/renderer/gl_stereo3d.cpp @@ -163,7 +163,7 @@ static void prepareInterleavedPresent(FPresentShaderBase& shader) shader.Uniforms->Saturation = clamp(vid_saturation, -15.0f, 15.0f); shader.Uniforms->GrayFormula = static_cast(gl_satformula); } - shader.Uniforms->ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)(1 << gl_dither_bpc - 1); + shader.Uniforms->ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)((1 << gl_dither_bpc) - 1); shader.Uniforms->Scale = { screen->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(), screen->mScreenViewport.height / (float)GLRenderer->mBuffers->GetHeight()