From 2a40512b740b8a176a0cda16a3e33260d873aa4f Mon Sep 17 00:00:00 2001 From: gibbed Date: Tue, 2 Jun 2015 09:08:56 -0500 Subject: [PATCH] Made a proper command-line flag out of disabling GL context resetting. --disable_gl_context_reset --- src/xenia/gpu/gl4/gl4_gpu-private.h | 1 + src/xenia/gpu/gl4/gl4_gpu.cc | 4 ++++ src/xenia/gpu/gl4/gl_context.cc | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/xenia/gpu/gl4/gl4_gpu-private.h b/src/xenia/gpu/gl4/gl4_gpu-private.h index 19269aefc..3e365622c 100644 --- a/src/xenia/gpu/gl4/gl4_gpu-private.h +++ b/src/xenia/gpu/gl4/gl4_gpu-private.h @@ -15,6 +15,7 @@ #include "xenia/gpu/gl4/gl4_gpu.h" DECLARE_bool(thread_safe_gl); +DECLARE_bool(disable_gl_context_reset); DECLARE_bool(gl_debug_output); DECLARE_bool(gl_debug_output_synchronous); diff --git a/src/xenia/gpu/gl4/gl4_gpu.cc b/src/xenia/gpu/gl4/gl4_gpu.cc index 955a9e17d..164fedaa1 100644 --- a/src/xenia/gpu/gl4/gl4_gpu.cc +++ b/src/xenia/gpu/gl4/gl4_gpu.cc @@ -15,6 +15,10 @@ DEFINE_bool(thread_safe_gl, false, "Only allow one GL context to be active at a time."); +DEFINE_bool(disable_gl_context_reset, false, + "Do not aggressively reset the GL context (helps with capture " + "programs such as OBS or FRAPS)."); + DEFINE_bool(gl_debug_output, false, "Dump ARB_debug_output to stderr."); DEFINE_bool(gl_debug_output_synchronous, true, "ARB_debug_output will synchronize to be thread safe."); diff --git a/src/xenia/gpu/gl4/gl_context.cc b/src/xenia/gpu/gl4/gl_context.cc index 8ed626134..2f4b7c705 100644 --- a/src/xenia/gpu/gl4/gl_context.cc +++ b/src/xenia/gpu/gl4/gl_context.cc @@ -332,7 +332,9 @@ bool GLContext::MakeCurrent() { } void GLContext::ClearCurrent() { - wglMakeCurrent(nullptr, nullptr); + if (!FLAGS_disable_gl_context_reset) { + wglMakeCurrent(nullptr, nullptr); + } tls_glew_context_ = nullptr; tls_wglew_context_ = nullptr;