From 7ffe6fa93eceddd0ca3848e25d2e467375f904fd Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Wed, 12 Nov 2014 23:47:13 +1100 Subject: [PATCH] glcolorscale: support gl3 --- ext/gl/gstglcolorscale.c | 22 ++++------------------ ext/gl/gstglcolorscale.h | 2 -- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/ext/gl/gstglcolorscale.c b/ext/gl/gstglcolorscale.c index 4ec29b5ab9..11e155ddd1 100644 --- a/ext/gl/gstglcolorscale.c +++ b/ext/gl/gstglcolorscale.c @@ -70,17 +70,13 @@ static void gst_gl_colorscale_set_property (GObject * object, guint prop_id, static void gst_gl_colorscale_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); -#if GST_GL_HAVE_GLES2 static gboolean gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter); static void gst_gl_colorscale_del_gl_resources (GstGLFilter * filter); -#endif static gboolean gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex, guint out_tex); -#if GST_GL_HAVE_OPENGL static void gst_gl_colorscale_callback (gint width, gint height, guint texture, gpointer stuff); -#endif static void gst_gl_colorscale_class_init (GstGLColorscaleClass * klass) @@ -101,11 +97,9 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass) "Filter/Effect/Video", "Colorspace converter and video scaler", "Julien Isorce "); -#if GST_GL_HAVE_GLES2 filter_class->onInitFBO = GST_DEBUG_FUNCPTR (gst_gl_colorscale_gen_gl_resources); filter_class->onStop = GST_DEBUG_FUNCPTR (gst_gl_colorscale_del_gl_resources); -#endif filter_class->filter_texture = gst_gl_colorscale_filter_texture; @@ -115,9 +109,7 @@ gst_gl_colorscale_class_init (GstGLColorscaleClass * klass) static void gst_gl_colorscale_init (GstGLColorscale * colorscale) { -#if GST_GL_HAVE_GLES2 colorscale->shader = NULL; -#endif } static void @@ -142,7 +134,6 @@ gst_gl_colorscale_get_property (GObject * object, guint prop_id, } } -#if GST_GL_HAVE_GLES2 static void _compile_identity_shader (GstGLContext * context, GstGLColorscale * colorscale) { @@ -163,7 +154,8 @@ gst_gl_colorscale_gen_gl_resources (GstGLFilter * filter) { GstGLColorscale *colorscale = GST_GL_COLORSCALE (filter); - if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2) { + if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 | + GST_GL_API_OPENGL3)) { gst_gl_context_thread_add (filter->context, (GstGLContextThreadFunc) _compile_identity_shader, colorscale); @@ -189,7 +181,6 @@ gst_gl_colorscale_del_gl_resources (GstGLFilter * filter) colorscale->shader = NULL; } } -#endif static gboolean gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex, @@ -199,22 +190,18 @@ gst_gl_colorscale_filter_texture (GstGLFilter * filter, guint in_tex, colorscale = GST_GL_COLORSCALE (filter); -#if GST_GL_HAVE_GLES2 - if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_GLES2) + if (gst_gl_context_get_gl_api (filter->context) & (GST_GL_API_GLES2 | + GST_GL_API_OPENGL3)) gst_gl_filter_render_to_target_with_shader (filter, TRUE, in_tex, out_tex, colorscale->shader); -#endif -#if GST_GL_HAVE_OPENGL if (gst_gl_context_get_gl_api (filter->context) & GST_GL_API_OPENGL) gst_gl_filter_render_to_target (filter, TRUE, in_tex, out_tex, gst_gl_colorscale_callback, colorscale); -#endif return TRUE; } -#if GST_GL_HAVE_OPENGL static void gst_gl_colorscale_callback (gint width, gint height, guint texture, gpointer stuff) @@ -230,4 +217,3 @@ gst_gl_colorscale_callback (gint width, gint height, guint texture, gst_gl_filter_draw_texture (filter, texture, width, height); } -#endif diff --git a/ext/gl/gstglcolorscale.h b/ext/gl/gstglcolorscale.h index 101b905a82..933599651a 100644 --- a/ext/gl/gstglcolorscale.h +++ b/ext/gl/gstglcolorscale.h @@ -43,9 +43,7 @@ struct _GstGLColorscale { GstGLFilter filter; -#if GST_GL_HAVE_GLES2 GstGLShader *shader; -#endif }; struct _GstGLColorscaleClass