mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
- Replace vid_max_width and vid_max_height with vid_scalemode for the GL software framebuffer backend
- Fix a crash if the window was resized before creating a game - Fix main menu scaling being wrong if the video mode didn't match the unscaled screen size
This commit is contained in:
parent
c3702ae9e7
commit
370e53befe
2 changed files with 19 additions and 14 deletions
|
@ -94,15 +94,6 @@ EXTERN_CVAR(Float, transsouls)
|
|||
EXTERN_CVAR(Int, vid_refreshrate)
|
||||
EXTERN_CVAR(Bool, gl_legacy_mode)
|
||||
|
||||
CVAR(Int, vid_max_width, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
CVAR(Int, vid_max_height, 0, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
||||
|
||||
namespace
|
||||
{
|
||||
int ClampWidth(int width) { return (vid_max_width == 0 || width < vid_max_width) ? width : vid_max_width; }
|
||||
int ClampHeight(int height) { return (vid_max_height == 0 || height < vid_max_height) ? height : vid_max_height; }
|
||||
}
|
||||
|
||||
#ifdef WIN32
|
||||
extern cycle_t BlitCycles;
|
||||
#endif
|
||||
|
@ -110,6 +101,9 @@ extern cycle_t BlitCycles;
|
|||
void gl_LoadExtensions();
|
||||
void gl_PrintStartupLog();
|
||||
|
||||
int ViewportScaledWidth(int width);
|
||||
int ViewportScaledHeight(int height);
|
||||
|
||||
#ifndef WIN32
|
||||
// This has to be in this file because system headers conflict Doom headers
|
||||
DFrameBuffer *CreateGLSWFrameBuffer(int width, int height, bool bgra, bool fullscreen)
|
||||
|
@ -147,7 +141,7 @@ const char *const OpenGLSWFrameBuffer::ShaderDefines[OpenGLSWFrameBuffer::NUM_SH
|
|||
};
|
||||
|
||||
OpenGLSWFrameBuffer::OpenGLSWFrameBuffer(void *hMonitor, int width, int height, int bits, int refreshHz, bool fullscreen, bool bgra) :
|
||||
Super(hMonitor, ClampWidth(width), ClampHeight(height), bits, refreshHz, fullscreen, bgra)
|
||||
Super(hMonitor, width, height, bits, refreshHz, fullscreen, bgra)
|
||||
{
|
||||
VertexBuffer = nullptr;
|
||||
IndexBuffer = nullptr;
|
||||
|
@ -1174,6 +1168,14 @@ void OpenGLSWFrameBuffer::Unlock()
|
|||
else if (--m_Lock == 0)
|
||||
{
|
||||
Buffer = nullptr;
|
||||
|
||||
if (MappedMemBuffer)
|
||||
{
|
||||
BindFBBuffer();
|
||||
glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER);
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
MappedMemBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1283,8 +1285,8 @@ void OpenGLSWFrameBuffer::Flip()
|
|||
|
||||
if (!IsFullscreen())
|
||||
{
|
||||
int clientWidth = ClampWidth(GetClientWidth());
|
||||
int clientHeight = ClampHeight(GetClientHeight());
|
||||
int clientWidth = ViewportScaledWidth(GetClientWidth());
|
||||
int clientHeight = ViewportScaledHeight(GetClientHeight());
|
||||
if (clientWidth > 0 && clientHeight > 0 && (Width != clientWidth || Height != clientHeight))
|
||||
{
|
||||
Resize(clientWidth, clientHeight);
|
||||
|
|
|
@ -88,6 +88,9 @@ EXTERN_CVAR(Bool, r_blendmethod)
|
|||
|
||||
int active_con_scale();
|
||||
|
||||
int ViewportScaledWidth(int width);
|
||||
int ViewportScaledHeight(int height);
|
||||
|
||||
FRenderer *Renderer;
|
||||
|
||||
EXTERN_CVAR (Bool, swtruecolor)
|
||||
|
@ -782,7 +785,7 @@ void DSimpleCanvas::Unlock ()
|
|||
//==========================================================================
|
||||
|
||||
DFrameBuffer::DFrameBuffer (int width, int height, bool bgra)
|
||||
: DSimpleCanvas (width, height, bgra)
|
||||
: DSimpleCanvas (ViewportScaledWidth(width), ViewportScaledHeight(height), bgra)
|
||||
{
|
||||
LastMS = LastSec = FrameCount = LastCount = LastTic = 0;
|
||||
Accel2D = false;
|
||||
|
@ -1289,7 +1292,7 @@ bool V_DoModeSetup (int width, int height, int bits)
|
|||
FFont::StaticPreloadFonts();
|
||||
|
||||
DisplayBits = bits;
|
||||
V_UpdateModeSize(width, height);
|
||||
V_UpdateModeSize(screen->GetWidth(), screen->GetHeight());
|
||||
|
||||
M_RefreshModesList ();
|
||||
|
||||
|
|
Loading…
Reference in a new issue