[228/906] output shaders info log only if GST_GL_SHADER_DEBUG env variable is set. Should fix TODO task 18

This commit is contained in:
Filippo Argiolas 2008-09-20 14:12:49 +02:00 committed by Matthew Waters
parent 43e92c4a3f
commit 30b33ab63f

View file

@ -51,6 +51,11 @@ struct _GstGLShaderPrivate
G_DEFINE_TYPE (GstGLShader, gst_gl_shader, G_TYPE_OBJECT);
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "GstGLShader"
gboolean _gst_gl_shader_debug = FALSE;
static void
gst_gl_shader_finalize (GObject * object)
{
@ -126,6 +131,15 @@ gst_gl_shader_get_property (GObject * object,
}
static void
gst_gl_shader_log_handler (const gchar *domain, GLogLevelFlags flags,
const gchar *message, gpointer user_data)
{
if (_gst_gl_shader_debug) {
g_log_default_handler (domain, flags, message, user_data);
}
}
static void
gst_gl_shader_class_init (GstGLShaderClass * klass)
{
@ -230,6 +244,12 @@ gst_gl_shader_init (GstGLShader * self)
priv->compiled = FALSE;
priv->active = FALSE; // unused at the moment
if (g_getenv ("GST_GL_SHADER_DEBUG"))
_gst_gl_shader_debug = TRUE;
g_log_set_handler ("GstGLShader", G_LOG_LEVEL_DEBUG,
gst_gl_shader_log_handler, NULL);
}
GstGLShader *