diff --git a/renderdoc/driver/gl/gl_common.h b/renderdoc/driver/gl/gl_common.h index bd66acb77..81c028216 100644 --- a/renderdoc/driver/gl/gl_common.h +++ b/renderdoc/driver/gl/gl_common.h @@ -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; diff --git a/renderdoc/driver/gl/gl_driver.cpp b/renderdoc/driver/gl/gl_driver.cpp index e081aaa83..44a675dd0 100644 --- a/renderdoc/driver/gl/gl_driver.cpp +++ b/renderdoc/driver/gl/gl_driver.cpp @@ -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