mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- expanded hard limits for saturation to -15.0/15.0
- added menu option for saturation - tried to get the new saturation shader to consume less GPU power by turning it off when it is 1.0
This commit is contained in:
parent
63da6e70c0
commit
bd02893ce7
5 changed files with 14 additions and 8 deletions
|
@ -866,7 +866,7 @@ void FGLRenderer::DrawPresentTexture(const GL_IRECT &box, bool applyGamma)
|
|||
mPresentShader->InvGamma.Set(1.0f / clamp<float>(Gamma, 0.1f, 4.f));
|
||||
mPresentShader->Contrast.Set(clamp<float>(vid_contrast, 0.1f, 3.f));
|
||||
mPresentShader->Brightness.Set(clamp<float>(vid_brightness, -0.8f, 0.8f));
|
||||
mPresentShader->Saturation.Set(clamp<float>(vid_saturation, -3.0f, 3.f));
|
||||
mPresentShader->Saturation.Set(clamp<float>(vid_saturation, -15.0f, 15.f));
|
||||
}
|
||||
mPresentShader->Scale.Set(mScreenViewport.width / (float)mBuffers->GetWidth(), mScreenViewport.height / (float)mBuffers->GetHeight());
|
||||
RenderScreenQuad();
|
||||
|
|
|
@ -107,7 +107,7 @@ static void prepareInterleavedPresent(FPresentStereoShaderBase& shader)
|
|||
shader.InvGamma.Set(1.0f / clamp<float>(Gamma, 0.1f, 4.f));
|
||||
shader.Contrast.Set(clamp<float>(vid_contrast, 0.1f, 3.f));
|
||||
shader.Brightness.Set(clamp<float>(vid_brightness, -0.8f, 0.8f));
|
||||
shader.Saturation.Set(clamp<float>(vid_saturation, -3.0f, 3.0f));
|
||||
shader.Saturation.Set(clamp<float>(vid_saturation, -15.0f, 15.0f));
|
||||
}
|
||||
shader.Scale.Set(
|
||||
GLRenderer->mScreenViewport.width / (float)GLRenderer->mBuffers->GetWidth(),
|
||||
|
|
|
@ -2657,7 +2657,8 @@ MUSIC_DM2INT = "dm2int";
|
|||
DSPLYMNU_GLOPT = "OpenGL Renderer";
|
||||
DSPLYMNU_SWOPT = "Software Renderer";
|
||||
DSPLYMNU_GAMMA = "Gamma correction";
|
||||
DSPLYMNU_CONTRAST ="Contrast";
|
||||
DSPLYMNU_CONTRAST = "Contrast";
|
||||
DSPLYMNU_SATURATION = "Saturation";
|
||||
DSPLYMNU_HWGAMMA = "Hardware Gamma";
|
||||
|
||||
// OpenGL Options
|
||||
|
|
|
@ -742,6 +742,7 @@ OptionMenu "VideoOptions" protected
|
|||
Slider "$DSPLYMNU_GAMMA", "Gamma", 0.75, 3.0, 0.05, 2
|
||||
Slider "$DSPLYMNU_BRIGHTNESS", "vid_brightness", -0.8,0.8, 0.05,2
|
||||
Slider "$DSPLYMNU_CONTRAST", "vid_contrast", 0.1, 3.0, 0.1
|
||||
Slider "$DSPLYMNU_SATURATION", "vid_saturation", -3.0, 3.0, 0.25
|
||||
Option "$DSPLYMNU_HWGAMMA", "vid_hwgamma", "HWGammaModes"
|
||||
|
||||
Option "$DSPLYMNU_VSYNC", "vid_vsync", "OnOff"
|
||||
|
|
|
@ -10,7 +10,11 @@ uniform float Saturation;
|
|||
|
||||
vec4 ApplyGamma(vec4 c)
|
||||
{
|
||||
vec3 valgray = (0.3 * c.r + 0.59 * c.g + 0.11 * c.b) * (1 - Saturation) + c.rgb * Saturation;
|
||||
vec3 valgray;
|
||||
if (Saturation != 1.0) // attempt to cool things a bit, this calculation makes the GPU run really hot
|
||||
valgray = (0.3 * c.r + 0.59 * c.g + 0.11 * c.b) * (1 - Saturation) + c.rgb * Saturation;
|
||||
else
|
||||
valgray = c.rgb;
|
||||
vec3 val = valgray * Contrast - (Contrast - 1.0) * 0.5;
|
||||
val += Brightness * 0.5;
|
||||
val = pow(max(val, vec3(0.0)), vec3(InvGamma));
|
||||
|
|
Loading…
Reference in a new issue