From c486b1b3b0bd457b6c22bc2aaba9fde9f8f90c8a Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 31 Aug 2015 19:18:23 +1000 Subject: [PATCH] gl/utils: add a function to insert a debug marker These markers are visible in tools that record the GL function calls such as apitrace, et al. Makes it easier to match up GL draw commands with specific elements. --- gst-libs/gst/gl/gstglutils.c | 27 +++++++++++++++++++++++++++ gst-libs/gst/gl/gstglutils.h | 18 ++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/gst-libs/gst/gl/gstglutils.c b/gst-libs/gst/gl/gstglutils.c index 0c0642a..2091f4d 100644 --- a/gst-libs/gst/gl/gstglutils.c +++ b/gst-libs/gst/gl/gstglutils.c @@ -24,6 +24,7 @@ #include #include +#include #include "gl.h" #include "gstglutils.h" @@ -932,3 +933,29 @@ gst_gl_caps_replace_all_caps_features (const GstCaps * caps, return tmp; } + +#ifndef GST_DISABLE_GST_DEBUG +void +gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...) +{ + const GstGLFuncs *gl = context->gl_vtable; + gchar *string; + gint len; + va_list args; + + va_start (args, format); + len = g_vasprintf (&string, format, args); + va_end (args); + +#if defined (GL_DEBUG_TYPE_MARKER) + if (gl->DebugMessageInsert) { + gl->DebugMessageInsert (GL_DEBUG_SOURCE_THIRD_PARTY, GL_DEBUG_TYPE_MARKER, + 0, GL_DEBUG_SEVERITY_LOW, (gsize) len, string); + } else +#endif + if (gl->InsertEventMarker) + gl->InsertEventMarker (len, string); + else if (gl->StringMarker) + gl->StringMarker (len, string); +} +#endif diff --git a/gst-libs/gst/gl/gstglutils.h b/gst-libs/gst/gl/gstglutils.h index ee606e0..90ddd8e 100644 --- a/gst-libs/gst/gl/gstglutils.h +++ b/gst-libs/gst/gl/gstglutils.h @@ -109,6 +109,24 @@ gsize gst_gl_get_plane_data_size (GstVideoInfo * info, GstVideoAlignment * align GstCaps * gst_gl_caps_replace_all_caps_features (const GstCaps * caps, const gchar * feature_name); +#ifndef GST_DISABLE_GST_DEBUG +void gst_gl_insert_debug_marker (GstGLContext * context, + const gchar * format, ...) G_GNUC_PRINTF (2, 3); +#else /* GST_DISABLE_GST_DEBUG */ +#if G_HAVE_ISO_VARARGS +#define gst_gl_insert_debug_marker(...) G_STMT_START{ }G_STMT_END +#else /* G_HAVE_ISO_VARARGS */ +#if G_HAVE_GNUC_VARARGS +#define gst_gl_insert_debug_marker(args...) G_STMT_START{ }G_STMT_END +#else /* G_HAVE_GNUC_VARARGS */ +static inline void +gst_gl_insert_debug_marker (GstGLContext * context, const gchar * format, ...) +{ +} +#endif /* G_HAVE_GNUC_VARARGS */ +#endif /* G_HAVE_ISO_VARARGS */ +#endif /* GST_DISABLE_GST_DEBUG */ + G_END_DECLS #endif /* __GST_GL_UTILS_H__ */ -- 2.7.4