mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-03 06:20:57 +00:00
gl_vidsdl.c: Minor VID_Toggle() fast path optimization.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1026 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
6603d78e5e
commit
a5e4a93cf0
1 changed files with 12 additions and 7 deletions
|
@ -1406,19 +1406,24 @@ void VID_Init (void)
|
||||||
// new proc by S.A., called by alt-return key binding.
|
// new proc by S.A., called by alt-return key binding.
|
||||||
void VID_Toggle (void)
|
void VID_Toggle (void)
|
||||||
{
|
{
|
||||||
// disabling the fast path because with SDL 1.2 it invalidates VBOs (using them
|
static qboolean vid_toggle_works = true;
|
||||||
// causes a crash, sugesting that the fullscreen toggle created a new GL context,
|
|
||||||
// although texture objects remain valid for some reason).
|
|
||||||
//
|
|
||||||
// SDL2 does promise window resizes / fullscreen changes preserve the GL context,
|
|
||||||
// so we could use the fast path with SDL2. --ericw
|
|
||||||
static qboolean vid_toggle_works = false;
|
|
||||||
qboolean toggleWorked;
|
qboolean toggleWorked;
|
||||||
|
|
||||||
S_ClearBuffer ();
|
S_ClearBuffer ();
|
||||||
|
|
||||||
if (!vid_toggle_works)
|
if (!vid_toggle_works)
|
||||||
goto vrestart;
|
goto vrestart;
|
||||||
|
else if (gl_vbo_able)
|
||||||
|
{
|
||||||
|
// disabling the fast path because with SDL 1.2 it invalidates VBOs (using them
|
||||||
|
// causes a crash, sugesting that the fullscreen toggle created a new GL context,
|
||||||
|
// although texture objects remain valid for some reason).
|
||||||
|
//
|
||||||
|
// SDL2 does promise window resizes / fullscreen changes preserve the GL context,
|
||||||
|
// so we could use the fast path with SDL2. --ericw
|
||||||
|
vid_toggle_works = false;
|
||||||
|
goto vrestart;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(USE_SDL2)
|
#if defined(USE_SDL2)
|
||||||
toggleWorked = SDL_SetWindowFullscreen(draw_context, VID_GetFullscreen() ? 0 : SDL_WINDOW_FULLSCREEN) == 0;
|
toggleWorked = SDL_SetWindowFullscreen(draw_context, VID_GetFullscreen() ? 0 : SDL_WINDOW_FULLSCREEN) == 0;
|
||||||
|
|
Loading…
Reference in a new issue