- add vid_hdr cvar that enables higher than 8bpc output for monitors that support it

This commit is contained in:
Magnus Norddahl 2018-07-29 18:48:28 +02:00
commit 5b8a016cad
3 changed files with 78 additions and 37 deletions

View file

@ -47,6 +47,8 @@
#include "gl/textures/gl_hwtexture.h"
#include "r_videoscale.h"
extern bool vid_hdr_active;
void FGLRenderer::RenderScreenQuad()
{
mVBO->BindVBO();
@ -224,6 +226,12 @@ void FGLRenderer::DrawPresentTexture(const IntRect &box, bool applyGamma)
mPresentShader->Uniforms->Saturation = clamp<float>(vid_saturation, -15.0f, 15.f);
mPresentShader->Uniforms->GrayFormula = static_cast<int>(gl_satformula);
}
if (vid_hdr_active && framebuffer->IsFullscreen())
{
// 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->Scale = { screen->mScreenViewport.width / (float)mBuffers->GetWidth(), screen->mScreenViewport.height / (float)mBuffers->GetHeight() };
mPresentShader->Uniforms.Set();
RenderScreenQuad();