- Added 0.75x scale mode

This commit is contained in:
Magnus Norddahl 2017-07-24 08:35:27 +02:00
parent 1ce3b4c79c
commit e06f87cf10
4 changed files with 27 additions and 22 deletions

View File

@ -153,7 +153,7 @@ EXTERN_CVAR(Float, vid_contrast)
EXTERN_CVAR(Float, vid_saturation) EXTERN_CVAR(Float, vid_saturation)
EXTERN_CVAR(Int, gl_satformula) EXTERN_CVAR(Int, gl_satformula)
extern bool bSuperSampled; bool ViewportLinearScale();
void FGLRenderer::RenderScreenQuad() void FGLRenderer::RenderScreenQuad()
{ {
@ -856,7 +856,7 @@ void FGLRenderer::DrawPresentTexture(const GL_IRECT &box, bool applyGamma)
glViewport(box.left, box.top, box.width, box.height); glViewport(box.left, box.top, box.width, box.height);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
if (bSuperSampled) if (ViewportLinearScale())
{ {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

View File

@ -95,7 +95,7 @@ EXTERN_CVAR(Int, vid_refreshrate)
EXTERN_CVAR(Bool, gl_legacy_mode) EXTERN_CVAR(Bool, gl_legacy_mode)
EXTERN_CVAR(Int, vid_scalemode) EXTERN_CVAR(Int, vid_scalemode)
extern bool bSuperSampled; bool ViewportLinearScale();
#ifdef WIN32 #ifdef WIN32
extern cycle_t BlitCycles; extern cycle_t BlitCycles;
@ -751,6 +751,18 @@ void OpenGLSWFrameBuffer::Present()
FBVERTEX verts[4]; FBVERTEX verts[4];
CalcFullscreenCoords(verts, false, 0, 0xFFFFFFFF); CalcFullscreenCoords(verts, false, 0, 0xFFFFFFFF);
SetTexture(0, OutputFB->Texture.get()); SetTexture(0, OutputFB->Texture.get());
if (ViewportLinearScale())
{
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);
}
SetPixelShader(Shaders[SHADER_GammaCorrection].get()); SetPixelShader(Shaders[SHADER_GammaCorrection].get());
SetAlphaBlend(0); SetAlphaBlend(0);
EnableAlphaTest(false); EnableAlphaTest(false);
@ -765,16 +777,6 @@ void OpenGLSWFrameBuffer::Present()
glBindFramebuffer(GL_FRAMEBUFFER, OutputFB->Framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, OutputFB->Framebuffer);
glViewport(0, 0, Width, Height); 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);
}
} }
//========================================================================== //==========================================================================

View File

@ -79,7 +79,6 @@ int testingmode; // Holds time to revert to old mode
int OldWidth, OldHeight, OldBits; int OldWidth, OldHeight, OldBits;
static FIntCVar DummyDepthCvar (NULL, 0, 0); static FIntCVar DummyDepthCvar (NULL, 0, 0);
static uint8_t BitTranslate[32]; static uint8_t BitTranslate[32];
bool bSuperSampled = false; // is this mode supersampled?
CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE) CUSTOM_CVAR (Int, menu_screenratios, -1, CVAR_ARCHIVE)
{ {
@ -126,14 +125,15 @@ CUSTOM_CVAR (Bool, vid_tft, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG) CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{ {
if (self < 0 || self > 4) if (self < 0 || self > 5)
{ {
self = 0; 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 bool ViewportLinearScale()
bSuperSampled = false; {
return vid_scalemode == 4 || vid_scalemode == 5;
} }
int ViewportScaledWidth(int width) int ViewportScaledWidth(int width)
@ -145,7 +145,8 @@ int ViewportScaledWidth(int width)
case 1: return 320; case 1: return 320;
case 2: return 640; case 2: return 640;
case 3: return (int)roundf(width * 0.5f); case 3: return (int)roundf(width * 0.5f);
case 4: return width * 2; case 4: return (int)roundf(width * 0.75f);
case 5: return width * 2;
} }
} }
@ -158,7 +159,8 @@ int ViewportScaledHeight(int height)
case 1: return 200; case 1: return 200;
case 2: return 400; case 2: return 400;
case 3: return (int)roundf(height * 0.5f); case 3: return (int)roundf(height * 0.5f);
case 4: return height * 2; case 4: return (int)roundf(height * 0.75f);
case 5: return height * 2;
} }
} }

View File

@ -1855,7 +1855,8 @@ OptionValue ScaleModes
1, "320x200" 1, "320x200"
2, "640x400" 2, "640x400"
3, "0.5x" 3, "0.5x"
4, "2x SSAA" 4, "0.75x"
5, "2x SSAA"
} }
OptionMenu VideoModeMenu protected OptionMenu VideoModeMenu protected