Don't do anything in SwapBuffers if no GL context is active

This commit is contained in:
baldurk
2015-08-05 18:52:17 +02:00
parent da87eaf55a
commit f67681c4c4
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -38,6 +38,8 @@
struct GLWindowingData
{
GLWindowingData() { DC = NULL; ctx = NULL; wnd = NULL; }
void SetCtx(void *c) { ctx = (HGLRC)c; }
HDC DC;
HGLRC ctx;
@@ -54,6 +56,8 @@ struct GLWindowingData
struct GLWindowingData
{
GLWindowingData() { dpy = NULL; ctx = NULL; wnd = NULL; }
void SetCtx(void *c) { ctx = (GLXContext)c; }
Display *dpy;
GLXContext ctx;
+4
View File
@@ -1967,6 +1967,10 @@ void WrappedOpenGL::SwapBuffers(void *windowHandle)
{
if(m_State == WRITING_IDLE)
RenderDoc::Inst().Tick();
// don't do anything if no context is active.
if(GetCtx() == NULL)
return;
m_FrameCounter++; // first present becomes frame #1, this function is at the end of the frame