--gl_debug flag.

This commit is contained in:
Ben Vanik 2015-06-26 17:20:45 -07:00
parent 1844bcf094
commit 4ffaac6d6f
3 changed files with 9 additions and 7 deletions

View File

@ -17,6 +17,7 @@
DECLARE_bool(thread_safe_gl); DECLARE_bool(thread_safe_gl);
DECLARE_bool(disable_gl_context_reset); DECLARE_bool(disable_gl_context_reset);
DECLARE_bool(gl_debug);
DECLARE_bool(gl_debug_output); DECLARE_bool(gl_debug_output);
DECLARE_bool(gl_debug_output_synchronous); DECLARE_bool(gl_debug_output_synchronous);

View File

@ -19,6 +19,7 @@ DEFINE_bool(disable_gl_context_reset, false,
"Do not aggressively reset the GL context (helps with capture " "Do not aggressively reset the GL context (helps with capture "
"programs such as OBS or FRAPS)."); "programs such as OBS or FRAPS).");
DEFINE_bool(gl_debug, false, "Enable OpenGL debug validation layer.");
DEFINE_bool(gl_debug_output, false, "Dump ARB_debug_output to stderr."); DEFINE_bool(gl_debug_output, false, "Dump ARB_debug_output to stderr.");
DEFINE_bool(gl_debug_output_synchronous, true, DEFINE_bool(gl_debug_output_synchronous, true,
"ARB_debug_output will synchronize to be thread safe."); "ARB_debug_output will synchronize to be thread safe.");

View File

@ -94,9 +94,9 @@ bool GLContext::Initialize(HWND hwnd) {
} }
int context_flags = 0; int context_flags = 0;
#if DEBUG if (FLAGS_gl_debug) {
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB; context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
#endif // DEBUG }
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, // WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
@ -150,9 +150,9 @@ std::unique_ptr<GLContext> GLContext::CreateShared() {
int context_flags = 0; int context_flags = 0;
// int profile = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB; // int profile = WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB;
int profile = WGL_CONTEXT_CORE_PROFILE_BIT_ARB; int profile = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
#if DEBUG if (FLAGS_gl_debug) {
context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB; context_flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
#endif // DEBUG }
int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, // int attrib_list[] = {WGL_CONTEXT_MAJOR_VERSION_ARB, 4, //
WGL_CONTEXT_MINOR_VERSION_ARB, 5, // WGL_CONTEXT_MINOR_VERSION_ARB, 5, //
@ -290,7 +290,7 @@ GLContext::DebugMessageThunk(GLenum source, GLenum type, GLuint id,
} }
void GLContext::SetupDebugging() { void GLContext::SetupDebugging() {
if (!FLAGS_gl_debug_output) { if (!FLAGS_gl_debug || !FLAGS_gl_debug_output) {
return; return;
} }