From d291a81ccddf64b71a9dd27a2413b9dbaba0a2eb Mon Sep 17 00:00:00 2001 From: pogokeen Date: Wed, 10 Oct 2018 14:37:03 +0000 Subject: [PATCH] polymost.cpp: fix lockup bug that would occur with polymost_waitForSubBuffer() when glClientWaitSync consistently returned GL_WAIT_FAILED on certain hardware/drivers. Additionally, fix conditional check for r_persistentStreamBuffer requirements in polymost_glinit(). git-svn-id: https://svn.eduke32.com/eduke32@7048 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/src/polymost.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 84cf6f39b..c0af89ba0 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -835,7 +835,7 @@ void polymost_glinit() glEnable(GL_MULTISAMPLE); } - if (persistentStreamBuffer && ((!glinfo.bufferstorage) || (!glinfo.sync))) + if (r_persistentStreamBuffer && ((!glinfo.bufferstorage) || (!glinfo.sync))) { OSD_Printf("Your OpenGL implementation doesn't support the required extensions for persistent stream buffers. Disabling...\n"); r_persistentStreamBuffer = 0; @@ -2928,12 +2928,24 @@ static void polymost_waitForSubBuffer(uint32_t subBufferIndex) { return; } + if (waitResult == GL_WAIT_FAILED) + { + OSD_Printf("polymost_waitForSubBuffer: Wait failed! Error 0x%X. Disabling r_persistentStreamBuffer.\n", glGetError()); + r_persistentStreamBuffer = 0; + videoResetMode(); + if (videoSetGameMode(fullscreen,xres,yres,bpp,upscalefactor)) + { + OSD_Printf("polymost_waitForSubBuffer: Video reset failed. Please ensure r_persistentStreamBuffer = 0 and try restarting the game.\n"); + Bexit(1); + } + return; + } static char loggedLongWait = false; if (waitResult == GL_TIMEOUT_EXPIRED && !loggedLongWait) { - OSD_Printf("polymost_waitForBuffer(): Had to wait for the drawpoly buffer to become available. For performance, try increasing buffer size with r_drawpolyVertsBufferLength.\n"); + OSD_Printf("polymost_waitForSubBuffer(): Had to wait for the drawpoly buffer to become available. For performance, try increasing buffer size with r_drawpolyVertsBufferLength.\n"); loggedLongWait = true; } }