- add gl_dither for toggling dithered output on and off

This commit is contained in:
Magnus Norddahl 2018-08-08 21:58:23 +02:00
commit d121fa21bf
6 changed files with 19 additions and 3 deletions

View file

@ -49,6 +49,8 @@
extern bool vid_hdr_active;
CVAR(Bool, gl_dither, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
void FGLRenderer::RenderScreenQuad()
{
mVBO->BindVBO();
@ -234,6 +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 ? 1023.0f : 0.0f;
}
else
{
mPresentShader->Uniforms->ColorScale = gl_dither ? 255.0f : 0.0f;
}
mPresentShader->Uniforms->Scale = { screen->mScreenViewport.width / (float)mBuffers->GetWidth(), screen->mScreenViewport.height / (float)mBuffers->GetHeight() };
mPresentShader->Uniforms.Set();