#include "eagl/gstglcontext_eagl.h"
#endif
-extern void GSTGLAPI _gst_gl_debug_callback (GLenum source, GLenum type,
- GLuint id, GLenum severity, GLsizei length, const gchar * message,
- gpointer user_data);
+extern void _gst_gl_debug_enable (GstGLContext * context);
static GPrivate current_context_key;
#define GST_CAT_DEFAULT gst_gl_context_debug
GST_DEBUG_CATEGORY (GST_CAT_DEFAULT);
+GST_DEBUG_CATEGORY_STATIC (gst_gl_debug);
#define gst_gl_context_parent_class parent_class
G_DEFINE_ABSTRACT_TYPE (GstGLContext, gst_gl_context, GST_TYPE_OBJECT);
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_INIT (gst_gl_context_debug, "glcontext", 0,
"glcontext element");
+ GST_DEBUG_CATEGORY_INIT (gst_gl_debug, "gldebug", 0, "OpenGL Debugging");
g_once_init_leave (&_init, 1);
}
}
{
GstGLContextClass *context_class;
GstGLWindowClass *window_class;
- GstGLFuncs *gl;
GstGLAPI compiled_api, user_api, gl_api, display_api;
gchar *api_string;
gchar *compiled_api_s;
}
}
- gl = context->gl_vtable;
compiled_api = _compiled_api ();
compiled_api_s = gst_gl_api_to_string (compiled_api);
context->priv->alive = TRUE;
- if (gl->DebugMessageCallback) {
#if !defined(GST_DISABLE_GST_DEBUG)
- GST_INFO_OBJECT (context, "Enabling GL context debugging");
- /* enable them all */
- gl->DebugMessageControl (GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0,
- GL_TRUE);
- gl->DebugMessageCallback (_gst_gl_debug_callback, context);
+ _gst_gl_debug_enable (context);
#endif
- }
if (other_context) {
GST_DEBUG_OBJECT (context, "Unreffing other_context %" GST_PTR_FORMAT,
#define GST_CAT_DEFAULT gst_gl_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
GST_DEBUG_CATEGORY_STATIC (default_debug);
+GST_DEBUG_CATEGORY_STATIC (gst_gl_marker_debug);
static void
_init_debug (void)
if (g_once_init_enter (&_init)) {
GST_DEBUG_CATEGORY_GET (gst_performance, "GST_PERFORMANCE");
- GST_DEBUG_CATEGORY_INIT (gst_gl_debug, "gldebug", 0, "OpenGL Debugging");
+ GST_DEBUG_CATEGORY_GET (gst_gl_debug, "gldebug");
GST_DEBUG_CATEGORY_GET (default_debug, "default");
+ GST_DEBUG_CATEGORY_INIT (gst_gl_marker_debug, "gldebugmarker", 0,
+ "OpenGL Markers");
g_once_init_leave (&_init, 1);
}
}
}
}
-/* silence the compiler... */
-G_GNUC_INTERNAL void GSTGLAPI _gst_gl_debug_callback (GLenum source,
- GLenum type, GLuint id, GLenum severity, GLsizei length,
- const gchar * message, gpointer user_data);
-
-void GSTGLAPI
+static void GSTGLAPI
_gst_gl_debug_callback (GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const gchar * message, gpointer user_data)
{
}
}
+G_GNUC_INTERNAL void _gst_gl_debug_enable (GstGLContext * context);
+
+G_GNUC_INTERNAL void
+_gst_gl_debug_enable (GstGLContext * context)
+{
+ const GstGLFuncs *gl = context->gl_vtable;
+ GstDebugLevel level;
+ GLenum debug_types[8];
+ guint i, n = 0;
+
+ _init_debug ();
+
+ if (!gl->DebugMessageCallback) {
+ GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
+ "No debugging support available");
+ return;
+ }
+
+ level = gst_debug_category_get_threshold (gst_gl_debug);
+ g_print ("level: %u\n", level);
+
+ if (level < GST_LEVEL_ERROR) {
+ GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
+ "Disabling GL context debugging (gldebug category debug level < error)");
+ return;
+ }
+
+ GST_CAT_INFO_OBJECT (gst_gl_context_debug, context,
+ "Enabling GL context debugging");
+
+ gl->DebugMessageCallback (_gst_gl_debug_callback, context);
+ if (level >= GST_LEVEL_DEBUG) {
+ /* enable them all */
+ gl->DebugMessageControl (GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, 0,
+ GL_TRUE);
+ } else {
+ if (level >= GST_LEVEL_FIXME) {
+ debug_types[n++] = GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR;
+ debug_types[n++] = GL_DEBUG_TYPE_PORTABILITY;
+ }
+ if (level >= GST_LEVEL_ERROR) {
+ debug_types[n++] = GL_DEBUG_TYPE_ERROR;
+ debug_types[n++] = GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR;
+ }
+ g_assert (n < G_N_ELEMENTS (debug_types));
+ for (i = 0; i < n; i++) {
+ gl->DebugMessageControl (GL_DONT_CARE, debug_types[i], GL_DONT_CARE,
+ 0, 0, GL_TRUE);
+ }
+ }
+}
+
void
gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...)
{
gint len;
va_list args;
+ /* are we enabled */
+ if (gst_debug_category_get_threshold (gst_gl_marker_debug) < GST_LEVEL_FIXME)
+ return;
+
va_start (args, format);
len = gst_info_vasprintf (&string, format, args);
va_end (args);
va_end (varargs);
}
}
+#else
+G_GNUC_INTERNAL void _gst_gl_debug_enable (GstGLContext * context);
#endif