Make OpenGL debug contexts a flag --debug-gpu instead of a compile time

option.

This makes sense, since contexts get created at runtime, there is little
reason to require recompilation for this.

Only works on linux currently, will be doing more OSs later
This commit is contained in:
2015-07-02 19:30:08 +02:00
parent a5b2841aa0
commit 00808eb39a
13 changed files with 38 additions and 57 deletions

View File

@@ -153,8 +153,6 @@ const char* gpuErrorString(GLenum err)
}
#ifdef WITH_GPU_DEBUG
/* Debug callbacks need the same calling convention as OpenGL functions.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
@@ -191,10 +189,10 @@ void gpu_debug_init(void)
#if !defined(WITH_GLEW_ES) && !defined(GLEW_ES_ONLY)
if (GLEW_VERSION_4_3) {
//glEnable(GL_DEBUG_OUTPUT);
glEnable(GL_DEBUG_OUTPUT);
glDebugMessageCallback(gpu_debug_proc, mxGetCurrentContext());
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
GPU_STRING_MARKER(sizeof(success), success);
GPU_string_marker(sizeof(success), success);
return;
}
#endif
@@ -203,7 +201,7 @@ void gpu_debug_init(void)
#ifndef GLEW_ES_ONLY
glDebugMessageCallback(gpu_debug_proc, mxGetCurrentContext());
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
GPU_STRING_MARKER(sizeof(success), success);
GPU_string_marker(sizeof(success), success);
#endif
return;
}
@@ -212,7 +210,7 @@ void gpu_debug_init(void)
if (GLEW_ARB_debug_output) {
glDebugMessageCallbackARB(gpu_debug_proc, mxGetCurrentContext());
glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
GPU_STRING_MARKER(sizeof(success), success);
GPU_string_marker(sizeof(success), success);
return;
}
@@ -220,7 +218,7 @@ void gpu_debug_init(void)
if (GLEW_AMD_debug_output) {
glDebugMessageCallbackAMD(gpu_debug_proc_amd, mxGetCurrentContext());
glDebugMessageEnableAMD(GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
GPU_STRING_MARKER(sizeof(success), success);
GPU_string_marker(sizeof(success), success);
return;
}
@@ -268,7 +266,7 @@ void gpu_debug_exit(void)
return;
}
void gpu_string_marker(size_t length, const char *buf)
void GPU_string_marker(size_t length, const char *buf)
{
#ifndef WITH_GLEW_ES
#ifndef GLEW_ES_ONLY
@@ -310,8 +308,6 @@ void gpu_string_marker(size_t length, const char *buf)
return;
}
#endif /* WITH_GPU_DEBUG */
void GPU_print_error_debug(const char *str)
{
if (G.debug & G_DEBUG)
@@ -319,7 +315,7 @@ void GPU_print_error_debug(const char *str)
}
void gpu_assert_no_gl_errors(const char* file, int line, const char* str)
void GPU_assert_no_gl_errors(const char* file, int line, const char* str)
{
if (G.debug) {
GLboolean gl_ok = gpu_report_gl_errors(file, line, str);