From 1e86e3cb082976ce45cd9f85a7dde77c454ffbeb Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sat, 27 Sep 2014 18:57:17 +0200 Subject: [PATCH] gsdx-ogl: rework callback debug * use DebugOutputToFile as a callback of gl error. Add a breakpoint to find the culprit GL call * use string instead of char[n] Note: CheckDebugLog is potentially useless now --- plugins/GSdx/GLLoader.cpp | 1 + plugins/GSdx/GLLoader.h | 1 + plugins/GSdx/GSDeviceOGL.cpp | 73 ++++++++++++++++++++---------------- plugins/GSdx/GSDeviceOGL.h | 2 +- plugins/GSdx/GSWnd.cpp | 1 + 5 files changed, 44 insertions(+), 34 deletions(-) diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 12c5e37088..48f6cf2488 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -62,6 +62,7 @@ PFNGLGENSAMPLERSPROC gl_GenSamplers = NU PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays = NULL; PFNGLGETBUFFERPARAMETERIVPROC gl_GetBufferParameteriv = NULL; PFNGLGETDEBUGMESSAGELOGARBPROC gl_GetDebugMessageLogARB = NULL; +PFNGLDEBUGMESSAGECALLBACKPROC gl_DebugMessageCallback = NULL; PFNGLGETPROGRAMINFOLOGPROC gl_GetProgramInfoLog = NULL; PFNGLGETPROGRAMIVPROC gl_GetProgramiv = NULL; PFNGLGETSHADERIVPROC gl_GetShaderiv = NULL; diff --git a/plugins/GSdx/GLLoader.h b/plugins/GSdx/GLLoader.h index fdbc7c3178..da4a7ff46a 100644 --- a/plugins/GSdx/GLLoader.h +++ b/plugins/GSdx/GLLoader.h @@ -246,6 +246,7 @@ extern PFNGLGENSAMPLERSPROC gl_GenSamplers; extern PFNGLGENVERTEXARRAYSPROC gl_GenVertexArrays; extern PFNGLGETBUFFERPARAMETERIVPROC gl_GetBufferParameteriv; extern PFNGLGETDEBUGMESSAGELOGARBPROC gl_GetDebugMessageLogARB; +extern PFNGLDEBUGMESSAGECALLBACKPROC gl_DebugMessageCallback; extern PFNGLGETPROGRAMINFOLOGPROC gl_GetProgramInfoLog; extern PFNGLGETPROGRAMIVPROC gl_GetProgramiv; extern PFNGLGETSHADERIVPROC gl_GetShaderiv; diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index b9eacceeb7..527473252c 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -168,10 +168,18 @@ bool GSDeviceOGL::Create(GSWnd* wnd) m_window = wnd; + // **************************************************************** + // Debug helper + // **************************************************************** +#ifdef ENABLE_OGL_DEBUG + gl_DebugMessageCallback(DebugOutputToFile, NULL); + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); +#endif + // **************************************************************** // Various object // **************************************************************** - m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_ogl_shader", 1)); + m_shader = new GSShaderOGL(!!theApp.GetConfig("debug_glsl_shader", 0)); gl_GenFramebuffers(1, &m_fbo); gl_GenFramebuffers(1, &m_fbo_read); @@ -1218,8 +1226,7 @@ void GSDeviceOGL::CheckDebugLog() unsigned int pos = 0; for(unsigned int i=0; i