OGL: use GLEW_ARB_debug_output in debug builds

should also be used in normal build, but as our ubo "workaround" throws too much errors, it's disabled atm
This commit is contained in:
degasus 2013-04-04 17:37:16 +02:00
parent a7c05dc922
commit e11f5630b1

View File

@ -222,6 +222,40 @@ void ApplySSAASettings() {
}
}
void ErrorCallback( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const char* message, void* userParam)
{
const char *s_source;
const char *s_type;
switch(source)
{
case GL_DEBUG_SOURCE_API_ARB: s_source = "API"; break;
case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: s_source = "Window System"; break;
case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: s_source = "Shader Compiler"; break;
case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: s_source = "Third Party"; break;
case GL_DEBUG_SOURCE_APPLICATION_ARB: s_source = "Application"; break;
case GL_DEBUG_SOURCE_OTHER_ARB: s_source = "Other"; break;
default: s_source = "Unknown"; break;
}
switch(type)
{
case GL_DEBUG_TYPE_ERROR_ARB: s_type = "Error"; break;
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: s_type = "Deprecated"; break;
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: s_type = "Undefined"; break;
case GL_DEBUG_TYPE_PORTABILITY_ARB: s_type = "Portability"; break;
case GL_DEBUG_TYPE_PERFORMANCE_ARB: s_type = "Performance"; break;
case GL_DEBUG_TYPE_OTHER_ARB: s_type = "Other"; break;
default: s_type = "Unknown"; break;
}
switch(severity)
{
case GL_DEBUG_SEVERITY_HIGH_ARB: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
case GL_DEBUG_SEVERITY_MEDIUM_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
case GL_DEBUG_SEVERITY_LOW_ARB: WARN_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
default: ERROR_LOG(VIDEO, "id: %x, source: %s, type: %s - %s", id, s_source, s_type, message); break;
}
}
// Init functions
Renderer::Renderer()
{
@ -253,6 +287,15 @@ Renderer::Renderer()
ERROR_LOG(VIDEO, "glewInit() failed! Does your video card support OpenGL 2.x?");
return; // TODO: fail
}
#if defined(_DEBUG) || defined(DEBUGFAST)
if (GLEW_ARB_debug_output)
{
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, true);
glDebugMessageCallbackARB( ErrorCallback, NULL );
glEnable( GL_DEBUG_OUTPUT );
}
#endif
if (!GLEW_EXT_secondary_color)
{