- Add new "scene" target for custom postprocess shaders

- Add "gl_custompost" cvar to turn off custom postprocess shaders completely
- Made "scene" affect the screen before 2D drawing, made "screen" affect the entire screen after 2D drawing
This commit is contained in:
Rachael Alexanderson 2017-07-02 21:04:22 -04:00 committed by Magnus Norddahl
parent e161bba146
commit 1cfaae78d9

View file

@ -147,6 +147,8 @@ CUSTOM_CVAR(Bool, gl_paltonemap_reverselookup, true, CVAR_ARCHIVE | CVAR_NOINITC
}
CVAR(Bool, gl_custompost, true, 0)
EXTERN_CVAR(Float, vid_brightness)
EXTERN_CVAR(Float, vid_contrast)
@ -175,7 +177,7 @@ void FGLRenderer::PostProcessScene(int fixedcm)
ColormapScene(fixedcm);
LensDistortScene();
ApplyFXAA();
RunCustomPostProcessShaders("screen");
RunCustomPostProcessShaders("scene");
}
#include "vm.h"
@ -214,6 +216,9 @@ DEFINE_ACTION_FUNCTION(_Shader, SetUniform1i)
void FGLRenderer::RunCustomPostProcessShaders(FString target)
{
if (!gl_custompost)
return;
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
{
PostProcessShader &shader = PostProcessShaders[i];
@ -864,6 +869,8 @@ void FGLRenderer::CopyToBackbuffer(const GL_IRECT *bounds, bool applyGamma)
m2DDrawer->Draw(); // draw all pending 2D stuff before copying the buffer
m2DDrawer->Clear();
RunCustomPostProcessShaders("screen");
FGLDebug::PushGroup("CopyToBackbuffer");
if (FGLRenderBuffers::IsEnabled())
{