diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 39820231a..167054199 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -178,6 +178,7 @@ namespace GLLoader { bool found_GL_ARB_shading_language_420pack = false; bool found_GL_ARB_texture_barrier = false; bool found_GL_ARB_texture_storage = false; + bool found_GL_KHR_debug = false; static bool status_and_override(bool& found, const std::string& name, bool mandatory = false) { @@ -268,6 +269,7 @@ namespace GLLoader { if (ext.compare("GL_ARB_shader_image_load_store") == 0) found_GL_ARB_shader_image_load_store = true; // GL4.3 if (ext.compare("GL_ARB_copy_image") == 0) found_GL_ARB_copy_image = true; + if (ext.compare("GL_KHR_debug") == 0) found_GL_KHR_debug = true; // GL4.4 if (ext.compare("GL_ARB_buffer_storage") == 0) found_GL_ARB_buffer_storage = true; if (ext.compare("GL_ARB_clear_texture") == 0) found_GL_ARB_clear_texture = true; @@ -296,6 +298,7 @@ namespace GLLoader { status &= status_and_override(found_GL_ARB_texture_storage, "GL_ARB_texture_storage", true); // GL4.3 status &= status_and_override(found_GL_ARB_copy_image, "GL_ARB_copy_image", true); + status &= status_and_override(found_GL_KHR_debug, "GL_KHR_debug", true); // GL4.4 status &= status_and_override(found_GL_ARB_buffer_storage,"GL_ARB_buffer_storage", true); status &= status_and_override(found_GL_ARB_clear_texture,"GL_ARB_clear_texture"); diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index caf43c071..adabece63 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -182,16 +182,13 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // **************************************************************** #ifdef ENABLE_OGL_DEBUG if (theApp.GetConfig("debug_opengl", 0)) { - if (glDebugMessageCallback) { - glDebugMessageCallback((GLDEBUGPROC)DebugOutputToFile, NULL); - glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); - } - if (glDebugMessageControl) { - glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true); - // Useless info message on Nvidia driver - GLuint ids[] = {0x20004}; - glDebugMessageControl(GL_DEBUG_SOURCE_API_ARB, GL_DEBUG_TYPE_OTHER_ARB, GL_DONT_CARE, countof(ids), ids, false); - } + glDebugMessageCallback((GLDEBUGPROC)DebugOutputToFile, NULL); + glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); + + glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true); + // Useless info message on Nvidia driver + GLuint ids[] = {0x20004}; + glDebugMessageControl(GL_DEBUG_SOURCE_API_ARB, GL_DEBUG_TYPE_OTHER_ARB, GL_DONT_CARE, countof(ids), ids, false); } #endif diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index d20335073..03ce7df52 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -63,7 +63,6 @@ void GSWndGL::PopulateGlFunction() GL_EXT_LOAD(glGenVertexArrays); GL_EXT_LOAD(glGetBufferParameteriv); GL_EXT_LOAD(glGetDebugMessageLogARB); - GL_EXT_LOAD_OPT(glDebugMessageCallback); GL_EXT_LOAD(glGetProgramInfoLog); GL_EXT_LOAD(glGetProgramiv); GL_EXT_LOAD(glGetShaderiv); @@ -118,10 +117,11 @@ void GSWndGL::PopulateGlFunction() // GL4.3 GL_EXT_LOAD(glCopyImageSubData); GL_EXT_LOAD_OPT(glInvalidateTexImage); - GL_EXT_LOAD_OPT(glPushDebugGroup); - GL_EXT_LOAD_OPT(glPopDebugGroup); - GL_EXT_LOAD_OPT(glDebugMessageInsert); - GL_EXT_LOAD_OPT(glDebugMessageControl); + GL_EXT_LOAD(glPushDebugGroup); + GL_EXT_LOAD(glPopDebugGroup); + GL_EXT_LOAD(glDebugMessageInsert); + GL_EXT_LOAD(glDebugMessageControl); + GL_EXT_LOAD(glDebugMessageCallback); // GL4.4 GL_EXT_LOAD_OPT(glClearTexImage); GL_EXT_LOAD(glBufferStorage); diff --git a/plugins/GSdx/stdafx.h b/plugins/GSdx/stdafx.h index e1ffe1ed7..0c2f968c8 100644 --- a/plugins/GSdx/stdafx.h +++ b/plugins/GSdx/stdafx.h @@ -425,7 +425,7 @@ extern void vmfree(void* ptr, size_t size); #endif #define GL_INSERT(type, code, sev, ...) \ - do if (glDebugMessageInsert) glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, type, code, sev, -1, format(__VA_ARGS__).c_str()); while(0); + do glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, type, code, sev, -1, format(__VA_ARGS__).c_str()); while(0); // Except apple any sane driver support this extension #if defined(_DEBUG) @@ -435,8 +435,8 @@ extern void vmfree(void* ptr, size_t size); #endif #if defined(ENABLE_OGL_DEBUG) -#define GL_PUSH(...) do if (glPushDebugGroup) glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0); -#define GL_POP() do if (glPopDebugGroup) glPopDebugGroup(); while(0); +#define GL_PUSH(...) do glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0); +#define GL_POP() do glPopDebugGroup(); while(0); #define GL_INS(...) GL_INSERT(GL_DEBUG_TYPE_ERROR, 0xDEAD, GL_DEBUG_SEVERITY_MEDIUM, __VA_ARGS__) #define GL_PERF(...) GL_INSERT(GL_DEBUG_TYPE_PERFORMANCE, 0xFEE1, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__) #else