Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAntony Riakiotakis <kalast@gmail.com>2015-07-02 20:30:08 +0300
committerAntony Riakiotakis <kalast@gmail.com>2015-07-02 20:30:17 +0300
commit00808eb39ac04c484fcabac6b18666cb2a0191e7 (patch)
tree68319846e12dee6ababd82db4a4d28c1dcfe1c71 /source
parenta5b2841aa0c4b1b90d29077ba174ed31ae8ee4d9 (diff)
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
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_global.h1
-rw-r--r--source/blender/gpu/GPU_debug.h12
-rw-r--r--source/blender/gpu/intern/gpu_debug.c18
-rw-r--r--source/blender/gpu/intern/gpu_init_exit.c9
-rw-r--r--source/blender/gpu/intern/gpu_private.h13
-rw-r--r--source/blender/windowmanager/intern/wm_window.c4
-rw-r--r--source/creator/creator.c1
7 files changed, 23 insertions, 35 deletions
diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h
index 7585dc23342..8a3ffc66e35 100644
--- a/source/blender/blenkernel/BKE_global.h
+++ b/source/blender/blenkernel/BKE_global.h
@@ -128,6 +128,7 @@ enum {
G_DEBUG_SIMDATA = (1 << 9), /* sim debug data display */
G_DEBUG_GPU_MEM = (1 << 10), /* gpu memory in status bar */
G_DEBUG_DEPSGRAPH_NO_THREADS = (1 << 11), /* sinle threaded depsgraph */
+ G_DEBUG_GPU = (1 << 12), /* gpu debug */
};
#define G_DEBUG_ALL (G_DEBUG | G_DEBUG_FFMPEG | G_DEBUG_PYTHON | G_DEBUG_EVENTS | G_DEBUG_WM | G_DEBUG_JOBS | \
diff --git a/source/blender/gpu/GPU_debug.h b/source/blender/gpu/GPU_debug.h
index f89df2b54aa..2c1728bfff1 100644
--- a/source/blender/gpu/GPU_debug.h
+++ b/source/blender/gpu/GPU_debug.h
@@ -49,9 +49,9 @@ const char *gpuErrorString(GLenum err);
/* prints current OpenGL state */
void GPU_state_print(void);
-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);
-# define GPU_ASSERT_NO_GL_ERRORS(str) gpu_assert_no_gl_errors(__FILE__, __LINE__, (str))
+# define GPU_ASSERT_NO_GL_ERRORS(str) GPU_assert_no_gl_errors(__FILE__, __LINE__, (str))
# define GPU_CHECK_ERRORS_AROUND(glProcCall) \
( \
@@ -61,14 +61,8 @@ void gpu_assert_no_gl_errors(const char *file, int line, const char *str);
)
-#ifdef WITH_GPU_DEBUG
/* inserts a debug marker message for the debug context messaging system */
-void gpu_string_marker(size_t size, const char *str);
-
-# define GPU_STRING_MARKER(size, str) gpu_string_marker((size), (str))
-#else /* WITH_GPU_DEBUG */
-# define GPU_STRING_MARKER(len, str) ((void)(size),(void)(str))
-#endif /* WITH_GPU_DEBUG */
+void GPU_string_marker(size_t size, const char *str);
#ifdef __cplusplus
}
diff --git a/source/blender/gpu/intern/gpu_debug.c b/source/blender/gpu/intern/gpu_debug.c
index d06c154be5b..3066467517a 100644
--- a/source/blender/gpu/intern/gpu_debug.c
+++ b/source/blender/gpu/intern/gpu_debug.c
@@ -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);
diff --git a/source/blender/gpu/intern/gpu_init_exit.c b/source/blender/gpu/intern/gpu_init_exit.c
index a93c1a21130..aefddc774be 100644
--- a/source/blender/gpu/intern/gpu_init_exit.c
+++ b/source/blender/gpu/intern/gpu_init_exit.c
@@ -32,6 +32,8 @@
#include "BLI_sys_types.h"
#include "GPU_init_exit.h" /* interface */
+#include "BKE_global.h"
+
#include "intern/gpu_codegen.h"
#include "intern/gpu_private.h"
@@ -54,14 +56,17 @@ void GPU_init(void)
gpu_codegen_init();
- GPU_DEBUG_INIT();
+ if (G.debug & G_DEBUG_GPU)
+ gpu_debug_init();
+
}
void GPU_exit(void)
{
- GPU_DEBUG_EXIT();
+ if (G.debug & G_DEBUG_GPU)
+ gpu_debug_exit();
gpu_codegen_exit();
gpu_extensions_exit(); /* must come last */
diff --git a/source/blender/gpu/intern/gpu_private.h b/source/blender/gpu/intern/gpu_private.h
index 188a2d16abc..72627e3563e 100644
--- a/source/blender/gpu/intern/gpu_private.h
+++ b/source/blender/gpu/intern/gpu_private.h
@@ -29,21 +29,8 @@
void gpu_extensions_init(void);
void gpu_extensions_exit(void);
-
/* gpu_debug.c */
-#ifdef WITH_GPU_DEBUG
-
void gpu_debug_init(void);
void gpu_debug_exit(void);
-# define GPU_DEBUG_INIT() gpu_debug_init()
-# define GPU_DEBUG_EXIT() gpu_debug_exit()
-
-#else
-
-# define GPU_DEBUG_INIT() ((void)0)
-# define GPU_DEBUG_EXIT() ((void)0)
-
-#endif
-
#endif /* __GPU_PRIVATE_H__ */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index d11d88db147..5f4869d3386 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -400,6 +400,10 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wm
if (win->stereo3d_format->display_mode == S3D_DISPLAY_PAGEFLIP)
glSettings.flags |= GHOST_glStereoVisual;
+ if (G.debug & G_DEBUG_GPU) {
+ glSettings.flags |= GHOST_glDebugContext;
+ }
+
if (!(U.uiflag2 & USER_OPENGL_NO_WARN_SUPPORT))
glSettings.flags |= GHOST_glWarnSupport;
diff --git a/source/creator/creator.c b/source/creator/creator.c
index b78914aa989..33a62c8ce6f 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1549,6 +1549,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 1, NULL, "--debug-value", "<value>\n\tSet debug value of <value> on startup\n", set_debug_value, NULL);
BLI_argsAdd(ba, 1, NULL, "--debug-jobs", "\n\tEnable time profiling for background jobs.", debug_mode_generic, (void *)G_DEBUG_JOBS);
+ BLI_argsAdd(ba, 1, NULL, "--debug-gpu", "\n\tEnable gpu debug context and information for OpenGL 4.3+.", debug_mode_generic, (void *)G_DEBUG_GPU);
BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph", "\n\tEnable debug messages from dependency graph", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH);
BLI_argsAdd(ba, 1, NULL, "--debug-depsgraph-no-threads", "\n\tSwitch dependency graph to a single threaded evlauation", debug_mode_generic, (void *)G_DEBUG_DEPSGRAPH_NO_THREADS);
BLI_argsAdd(ba, 1, NULL, "--debug-gpumem", "\n\tEnable GPU memory stats in status bar", debug_mode_generic, (void *)G_DEBUG_GPU_MEM);