From 2f37c4b272f9c248e46aaefd7e9939356e4e0d96 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Sun, 23 Jul 2017 11:24:04 -0400 Subject: [PATCH] - added vid_scalemode == 4 to super-sample the screen --- src/gl/renderer/gl_postprocess.cpp | 14 ++++++++++++-- src/gl/system/gl_swframebuffer.cpp | 12 ++++++++++++ src/menu/videomenu.cpp | 9 ++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/gl/renderer/gl_postprocess.cpp b/src/gl/renderer/gl_postprocess.cpp index 0fff621981..6f863ec654 100644 --- a/src/gl/renderer/gl_postprocess.cpp +++ b/src/gl/renderer/gl_postprocess.cpp @@ -153,6 +153,8 @@ EXTERN_CVAR(Float, vid_contrast) EXTERN_CVAR(Float, vid_saturation) EXTERN_CVAR(Int, gl_satformula) +extern bool bSuperSampled; + void FGLRenderer::RenderScreenQuad() { mVBO->BindVBO(); @@ -854,8 +856,16 @@ void FGLRenderer::DrawPresentTexture(const GL_IRECT &box, bool applyGamma) glViewport(box.left, box.top, box.width, box.height); glActiveTexture(GL_TEXTURE0); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + if (bSuperSampled) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } mPresentShader->Bind(); mPresentShader->InputTexture.Set(0); diff --git a/src/gl/system/gl_swframebuffer.cpp b/src/gl/system/gl_swframebuffer.cpp index c426e01e42..6a9a92172c 100644 --- a/src/gl/system/gl_swframebuffer.cpp +++ b/src/gl/system/gl_swframebuffer.cpp @@ -94,6 +94,8 @@ EXTERN_CVAR(Float, transsouls) EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Bool, gl_legacy_mode) +extern bool bSuperSampled; + #ifdef WIN32 extern cycle_t BlitCycles; #endif @@ -751,6 +753,16 @@ void OpenGLSWFrameBuffer::Present() glBindFramebuffer(GL_FRAMEBUFFER, OutputFB->Framebuffer); glViewport(0, 0, Width, Height); + if (bSuperSampled) + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + } + else + { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + } } //========================================================================== diff --git a/src/menu/videomenu.cpp b/src/menu/videomenu.cpp index cc2f72fa6e..4c77f83fd1 100644 --- a/src/menu/videomenu.cpp +++ b/src/menu/videomenu.cpp @@ -79,6 +79,7 @@ int testingmode; // Holds time to revert to old mode int OldWidth, OldHeight, OldBits; static FIntCVar DummyDepthCvar (NULL, 0, 0); static uint8_t BitTranslate[32]; +bool bSuperSampled = false; // is this mode supersampled? CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE) { @@ -125,10 +126,14 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) { - if (self < 0 || self > 3) + if (self < 0 || self > 4) { self = 0; } + if (self == 4) // [SP] hack, for now, but we might add custom modes later and special handling will be needed for that... + bSuperSampled = true; + else + bSuperSampled = false; } int ViewportScaledWidth(int width) @@ -140,6 +145,7 @@ int ViewportScaledWidth(int width) case 1: return 320; case 2: return 640; case 3: return (int)roundf(width * 0.5f); + case 4: return (int)(width * 2.0f); } } @@ -152,6 +158,7 @@ int ViewportScaledHeight(int height) case 1: return 200; case 2: return 400; case 3: return (int)roundf(height * 0.5f); + case 4: return (int)(height * 2.0f); } }