- Allow specifying monitor bits-per-channel for dithering output. Not all displays are created equal, so this option is actually important for specifying the exact amount for your display.

This commit is contained in:
Rachael Alexanderson 2018-08-09 15:13:26 -04:00
parent d121fa21bf
commit ecdc485e05
3 changed files with 15 additions and 6 deletions

View file

@ -49,7 +49,7 @@
extern bool vid_hdr_active; extern bool vid_hdr_active;
CVAR(Bool, gl_dither, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL) CVAR(Int, gl_dither_bpc, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG | CVAR_NOINITCALL)
void FGLRenderer::RenderScreenQuad() void FGLRenderer::RenderScreenQuad()
{ {
@ -236,11 +236,11 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
// Full screen exclusive mode treats a rgba16f frame buffer as linear. // 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. // It probably will eventually in desktop mode too, but the DWM doesn't seem to support that.
mPresentShader->Uniforms->InvGamma *= 2.2f; mPresentShader->Uniforms->InvGamma *= 2.2f;
mPresentShader->Uniforms->ColorScale = gl_dither ? 1023.0f : 0.0f; mPresentShader->Uniforms->ColorScale = (gl_dither_bpc == -1) ? 1023.0f : (float)(1 << gl_dither_bpc - 1);
} }
else else
{ {
mPresentShader->Uniforms->ColorScale = gl_dither ? 255.0f : 0.0f; 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->Scale = { screen->mScreenViewport.width / (float)mBuffers->GetWidth(), screen->mScreenViewport.height / (float)mBuffers->GetHeight() };
mPresentShader->Uniforms.Set(); mPresentShader->Uniforms.Set();

View file

@ -39,7 +39,7 @@ EXTERN_CVAR(Float, vid_saturation)
EXTERN_CVAR(Float, vid_brightness) EXTERN_CVAR(Float, vid_brightness)
EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_contrast)
EXTERN_CVAR(Int, gl_satformula) EXTERN_CVAR(Int, gl_satformula)
EXTERN_CVAR(Bool, gl_dither) EXTERN_CVAR(Int, gl_dither_bpc)
//========================================================================== //==========================================================================
// //
@ -163,7 +163,7 @@ static void prepareInterleavedPresent(FPresentShaderBase& shader)
shader.Uniforms->Saturation = clamp<float>(vid_saturation, -15.0f, 15.0f); shader.Uniforms->Saturation = clamp<float>(vid_saturation, -15.0f, 15.0f);
shader.Uniforms->GrayFormula = static_cast<int>(gl_satformula); shader.Uniforms->GrayFormula = static_cast<int>(gl_satformula);
} }
shader.Uniforms->ColorScale = gl_dither ? 255.0f : 0.0f; shader.Uniforms->ColorScale = (gl_dither_bpc == -1) ? 255.0f : (float)(1 << gl_dither_bpc - 1);
shader.Uniforms->Scale = { shader.Uniforms->Scale = {
screen->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(), screen->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(),
screen->mScreenViewport.height / (float)GLRenderer->mBuffers->GetHeight() screen->mScreenViewport.height / (float)GLRenderer->mBuffers->GetHeight()

View file

@ -2105,6 +2105,15 @@ OptionValue "Precision"
1, "$OPTVAL_QUALITY" 1, "$OPTVAL_QUALITY"
} }
OptionValue "DitherModes"
{
0, "$OPTVAL_OFF"
-1, "$OPTVAL_ON"
6, "6 BPC"
8, "8 BPC"
10, "10 BPC"
12, "12 BPC"
}
OptionValue "Hz" OptionValue "Hz"
{ {
@ -2286,7 +2295,7 @@ OptionMenu "OpenGLOptions" protected
Option "$GLPREFMNU_SSAO", gl_ssao, "SSAOModes" Option "$GLPREFMNU_SSAO", gl_ssao, "SSAOModes"
Slider "$GLPREFMNU_SSAO_PORTALS", gl_ssao_portals, 0.0, 4.0, 1.0, 0 Slider "$GLPREFMNU_SSAO_PORTALS", gl_ssao_portals, 0.0, 4.0, 1.0, 0
Option "$GLPREFMNU_FXAA", gl_fxaa, "FXAAQuality" Option "$GLPREFMNU_FXAA", gl_fxaa, "FXAAQuality"
Option "$GLPREFMNU_DITHER", gl_dither, "OnOff" Option "$GLPREFMNU_DITHER", gl_dither_bpc, "DitherModes"
StaticText " " StaticText " "
Slider "$GLPREFMNU_PALTONEMAPPOWER", gl_paltonemap_powtable, 0.2, 3.0, 0.1, 1 Slider "$GLPREFMNU_PALTONEMAPPOWER", gl_paltonemap_powtable, 0.2, 3.0, 0.1, 1
Option "$GLPREFMNU_PALTONEMAPORDER", gl_paltonemap_reverselookup, "LookupOrder" Option "$GLPREFMNU_PALTONEMAPORDER", gl_paltonemap_reverselookup, "LookupOrder"