0
0
Fork 0
mirror of https://github.com/ZDoom/qzdoom.git synced 2025-02-27 14:21:46 +00:00

- added vid_scalemode == 4 to super-sample the screen

This commit is contained in:
Rachael Alexanderson 2017-07-23 11:24:04 -04:00
parent 449c4cb711
commit 2f37c4b272
3 changed files with 32 additions and 3 deletions

View file

@ -153,6 +153,8 @@ 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;
void FGLRenderer::RenderScreenQuad() void FGLRenderer::RenderScreenQuad()
{ {
mVBO->BindVBO(); mVBO->BindVBO();
@ -854,8 +856,16 @@ 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);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); if (bSuperSampled)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); {
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->Bind();
mPresentShader->InputTexture.Set(0); mPresentShader->InputTexture.Set(0);

View file

@ -94,6 +94,8 @@ EXTERN_CVAR(Float, transsouls)
EXTERN_CVAR(Int, vid_refreshrate) EXTERN_CVAR(Int, vid_refreshrate)
EXTERN_CVAR(Bool, gl_legacy_mode) EXTERN_CVAR(Bool, gl_legacy_mode)
extern bool bSuperSampled;
#ifdef WIN32 #ifdef WIN32
extern cycle_t BlitCycles; extern cycle_t BlitCycles;
#endif #endif
@ -751,6 +753,16 @@ 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,6 +79,7 @@ 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)
{ {
@ -125,10 +126,14 @@ 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 > 3) if (self < 0 || self > 4)
{ {
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
bSuperSampled = false;
} }
int ViewportScaledWidth(int width) int ViewportScaledWidth(int width)
@ -140,6 +145,7 @@ 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 (int)(width * 2.0f);
} }
} }
@ -152,6 +158,7 @@ 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 (int)(height * 2.0f);
} }
} }