gsdx-ogl: protect the trace with if statement

And mark the function as optional
This commit is contained in:
Gregory Hainaut 2015-05-30 09:54:20 +02:00
parent a639634769
commit 009dd103ae
2 changed files with 11 additions and 13 deletions

View File

@ -107,14 +107,9 @@ void GSWndGL::PopulateGlFunction()
// GL4.3
*(void**)&(gl_CopyImageSubData) = GetProcAddress("glCopyImageSubData", true);
*(void**)&(gl_InvalidateTexImage) = GetProcAddress("glInvalidateTexImage", true);
#if defined(__linux__) && defined(ENABLE_OGL_DEBUG)
bool debug_optional = false;
#else
bool debug_optional = true;
#endif
*(void**)&(gl_PushDebugGroup) = GetProcAddress("glPushDebugGroup", debug_optional);
*(void**)&(gl_PopDebugGroup) = GetProcAddress("glPopDebugGroup", debug_optional);
*(void**)&(gl_DebugMessageInsert) = GetProcAddress("glDebugMessageInsert", debug_optional);
*(void**)&(gl_PushDebugGroup) = GetProcAddress("glPushDebugGroup", true);
*(void**)&(gl_PopDebugGroup) = GetProcAddress("glPopDebugGroup", true);
*(void**)&(gl_DebugMessageInsert) = GetProcAddress("glDebugMessageInsert", true);
// GL4.4
*(void**)&(gl_ClearTexImage) = GetProcAddress("glClearTexImage", true);
*(void**)&(gl_BufferStorage) = GetProcAddress("glBufferStorage", true);

View File

@ -493,18 +493,21 @@ extern void vmfree(void* ptr, size_t size);
#endif
#define GL_INSERT(type, code, sev, ...) \
do if (gl_DebugMessageInsert) gl_DebugMessageInsert(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(__linux__) && defined(_DEBUG)
#define GL_CACHE(...) gl_DebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_OTHER, 0xFEAD, GL_DEBUG_SEVERITY_NOTIFICATION, -1, format(__VA_ARGS__).c_str());
#define GL_CACHE(...) GL_INSERT(GL_DEBUG_TYPE_OTHER, 0xFEAD, GL_DEBUG_SEVERITY_NOTIFICATION, __VA_ARGS__)
#else
#define GL_CACHE(...) (0);
#endif
#if defined(__linux__) && defined(ENABLE_OGL_DEBUG)
#define GL_PUSH(...) gl_PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str());
#define GL_POP() gl_PopDebugGroup();
#define GL_INS(...) gl_DebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0xDEAD, GL_DEBUG_SEVERITY_MEDIUM, -1, format(__VA_ARGS__).c_str());
#define GL_PERF(...) gl_DebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PERFORMANCE, 0xFEE1, GL_DEBUG_SEVERITY_MEDIUM, -1, format(__VA_ARGS__).c_str());
#define GL_PUSH(...) do if (gl_PushDebugGroup) gl_PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0xBAD, -1, format(__VA_ARGS__).c_str()); while(0);
#define GL_POP() do if (gl_PopDebugGroup) gl_PopDebugGroup(); 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_MEDIUM, __VA_ARGS__)
#else
#define GL_PUSH(...) (0);
#define GL_POP() (0);