r36004 - in /desktop/experimental/clutter-gst-2.0/debian: changelog patches/ patches/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch patches/series

sjoerd at users.alioth.debian.org sjoerd at users.alioth.debian.org
Sat Oct 20 15:53:45 UTC 2012


Author: sjoerd
Date: Sat Oct 20 15:53:45 2012
New Revision: 36004

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=36004
Log:
* d/p/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch:
  + Added, fix AYUV shader when cogl is compiled with both GL and GLES2
    support. (bgo: 682502)

Added:
    desktop/experimental/clutter-gst-2.0/debian/patches/
    desktop/experimental/clutter-gst-2.0/debian/patches/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch
    desktop/experimental/clutter-gst-2.0/debian/patches/series
Modified:
    desktop/experimental/clutter-gst-2.0/debian/changelog

Modified: desktop/experimental/clutter-gst-2.0/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/clutter-gst-2.0/debian/changelog?rev=36004&op=diff
==============================================================================
--- desktop/experimental/clutter-gst-2.0/debian/changelog [utf-8] (original)
+++ desktop/experimental/clutter-gst-2.0/debian/changelog [utf-8] Sat Oct 20 15:53:45 2012
@@ -1,3 +1,11 @@
+clutter-gst-2.0 (1.9.92-2) experimental; urgency=low
+
+  * d/p/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch:
+    + Added, fix AYUV shader when cogl is compiled with both GL and GLES2
+      support. (bgo: 682502)
+
+ -- Sjoerd Simons <sjoerd at debian.org>  Sat, 20 Oct 2012 17:53:28 +0200
+
 clutter-gst-2.0 (1.9.92-1) experimental; urgency=low
 
   [ Iain Lane ]

Added: desktop/experimental/clutter-gst-2.0/debian/patches/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/clutter-gst-2.0/debian/patches/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch?rev=36004&op=file
==============================================================================
--- desktop/experimental/clutter-gst-2.0/debian/patches/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch (added)
+++ desktop/experimental/clutter-gst-2.0/debian/patches/0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch [utf-8] Sat Oct 20 15:53:45 2012
@@ -1,0 +1,236 @@
+From e3411f4c057fe497cdfe206d0b064606e387e391 Mon Sep 17 00:00:00 2001
+From: "Andre Moreira Magalhaes (andrunko)" <andre.magalhaes at collabora.co.uk>
+Date: Tue, 16 Oct 2012 21:09:10 -0300
+Subject: [PATCH] cluttersink: Use specific shaders based on the current
+ renderer driver.
+
+---
+ clutter-gst/clutter-gst-shaders.h    |   46 ++++++++----------
+ clutter-gst/clutter-gst-video-sink.c |   85 +++++++++++++++++++++++++++++-----
+ 2 files changed, 92 insertions(+), 39 deletions(-)
+
+diff --git a/clutter-gst/clutter-gst-shaders.h b/clutter-gst/clutter-gst-shaders.h
+index d1afdb1..bef45c5 100644
+--- a/clutter-gst/clutter-gst-shaders.h
++++ b/clutter-gst/clutter-gst-shaders.h
+@@ -6,36 +6,28 @@
+ 
+ /* Copied from test-shaders */
+ 
+-/* These variables are used instead of the standard GLSL variables on
+-   GLES 2 */
+-#ifdef COGL_HAS_GLES
+-
+-#define GLES2_VARS              \
+-  "precision mediump float;\n"
+-#define TEX_COORD "cogl_tex_coord_in[0]"
+-#define COLOR_VAR "cogl_color_in"
+-
+-#else /* COGL_HAS_GLES */
+-
+-#define GLES2_VARS ""
+-#define TEX_COORD "gl_TexCoord[0]"
+-#define COLOR_VAR "gl_Color"
+-
+-#endif /* COGL_HAS_GLES */
+-
+-/* a couple of boilerplate defines that are common amongst all the
+- * sample shaders
+- */
+-
+-#define FRAGMENT_SHADER_VARS      \
+-  GLES2_VARS
+-
+-/* FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly
++/* *_FRAGMENT_SHADER_END: apply the changed color to the output buffer correctly
+  * blended with the gl specified color (makes the opacity of actors work
+  * correctly).
+  */
+-#define FRAGMENT_SHADER_END                             \
+-     "  gl_FragColor = gl_FragColor * " COLOR_VAR ";"
++
++/* These variables are used instead of the standard GLSL variables on
++   GLES 2 */
++#define GLES2_VARS      "precision mediump float;\n"
++#define GLES2_TEX_COORD "cogl_tex_coord_in[0]"
++#define GLES2_COLOR_VAR "cogl_color_in"
++#define GLES2_FRAGMENT_SHADER_START \
++     GLES2_VARS
++#define GLES2_FRAGMENT_SHADER_END   \
++     "  gl_FragColor = gl_FragColor * " GLES2_COLOR_VAR ";"
++
++#define GL_VARS       ""
++#define GL_TEX_COORD "gl_TexCoord[0]"
++#define GL_COLOR_VAR "gl_Color"
++
++#define GL_FRAGMENT_SHADER_START ""
++#define GL_FRAGMENT_SHADER_END   \
++     "  gl_FragColor = gl_FragColor * " GL_COLOR_VAR ";"
+ 
+ #endif
+ 
+diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
+index 6550eab..1493adb 100644
+--- a/clutter-gst/clutter-gst-video-sink.c
++++ b/clutter-gst/clutter-gst-video-sink.c
+@@ -77,11 +77,11 @@
+ #define CLUTTER_GST_TEXTURE_FLAGS  COGL_TEXTURE_NO_SLICING
+ #endif
+ 
+-static gchar *ayuv_to_rgba_shader =
+-    FRAGMENT_SHADER_VARS
++static gchar *ayuv_to_rgba_shader = \
++    GL_FRAGMENT_SHADER_START
+     "uniform sampler2D tex;"
+     "void main () {"
+-    "  vec4 color = texture2D (tex, vec2(" TEX_COORD "));"
++    "  vec4 color = texture2D (tex, vec2(" GL_TEX_COORD "));"
+     "  float y = 1.1640625 * (color.g - 0.0625);"
+     "  float u = color.b - 0.5;"
+     "  float v = color.a - 0.5;"
+@@ -89,15 +89,17 @@ static gchar *ayuv_to_rgba_shader =
+     "  color.r = y + 1.59765625 * v;"
+     "  color.g = y - 0.390625 * u - 0.8125 * v;"
+     "  color.b = y + 2.015625 * u;"
+-    "  gl_FragColor = color;" FRAGMENT_SHADER_END "}";
++    "  gl_FragColor = color;"
++    GL_FRAGMENT_SHADER_END
++    "}";
+ 
+-static gchar *yv12_to_rgba_shader =
+-    FRAGMENT_SHADER_VARS
++static gchar *yv12_to_rgba_shader = \
++    GL_FRAGMENT_SHADER_START
+     "uniform sampler2D ytex;"
+     "uniform sampler2D utex;"
+     "uniform sampler2D vtex;"
+     "void main () {"
+-    "  vec2 coord = vec2(" TEX_COORD ");"
++    "  vec2 coord = vec2(" GL_TEX_COORD ");"
+     "  float y = 1.1640625 * (texture2D (ytex, coord).g - 0.0625);"
+     "  float u = texture2D (utex, coord).g - 0.5;"
+     "  float v = texture2D (vtex, coord).g - 0.5;"
+@@ -105,7 +107,45 @@ static gchar *yv12_to_rgba_shader =
+     "  color.r = y + 1.59765625 * v;"
+     "  color.g = y - 0.390625 * u - 0.8125 * v;"
+     "  color.b = y + 2.015625 * u;"
+-    "  color.a = 1.0;" "  gl_FragColor = color;" FRAGMENT_SHADER_END "}";
++    "  color.a = 1.0;"
++    "  gl_FragColor = color;"
++    GL_FRAGMENT_SHADER_END
++    "}";
++
++static gchar *ayuv_to_rgba_shader_gles2 = \
++    GLES2_FRAGMENT_SHADER_START
++    "uniform sampler2D tex;"
++    "void main () {"
++    "  vec4 color = texture2D (tex, vec2(" GLES2_TEX_COORD "));"
++    "  float y = 1.1640625 * (color.g - 0.0625);"
++    "  float u = color.b - 0.5;"
++    "  float v = color.a - 0.5;"
++    "  color.a = color.r;"
++    "  color.r = y + 1.59765625 * v;"
++    "  color.g = y - 0.390625 * u - 0.8125 * v;"
++    "  color.b = y + 2.015625 * u;"
++    "  gl_FragColor = color;"
++    GLES2_FRAGMENT_SHADER_END
++    "}";
++
++static gchar *yv12_to_rgba_shader_gles2 = \
++    GLES2_FRAGMENT_SHADER_START
++    "uniform sampler2D ytex;"
++    "uniform sampler2D utex;"
++    "uniform sampler2D vtex;"
++    "void main () {"
++    "  vec2 coord = vec2(" GLES2_TEX_COORD ");"
++    "  float y = 1.1640625 * (texture2D (ytex, coord).g - 0.0625);"
++    "  float u = texture2D (utex, coord).g - 0.5;"
++    "  float v = texture2D (vtex, coord).g - 0.5;"
++    "  vec4 color;"
++    "  color.r = y + 1.59765625 * v;"
++    "  color.g = y - 0.390625 * u - 0.8125 * v;"
++    "  color.b = y + 2.015625 * u;"
++    "  color.a = 1.0;"
++    "  gl_FragColor = color;"
++    GLES2_FRAGMENT_SHADER_END
++    "}";
+ 
+ #define BASE_SINK_CAPS "{ AYUV," \
+                        "YV12," \
+@@ -214,9 +254,10 @@ struct _ClutterGstVideoSinkPrivate
+   ClutterGstSource *source;
+   int priority;
+ 
++  CoglDriver renderer_driver;
+   GSList *renderers;
+-  GstCaps *caps;
+   ClutterGstRenderer *renderer;
++  GstCaps *caps;
+ 
+   GArray *signal_handler_ids;
+ 
+@@ -911,7 +952,10 @@ no_map:
+ static void
+ clutter_gst_yv12_glsl_init (ClutterGstVideoSink * sink)
+ {
+-  _create_template_material (sink, yv12_to_rgba_shader, TRUE, 3);
++  if (sink->priv->renderer_driver == COGL_DRIVER_GLES2)
++    _create_template_material (sink, yv12_to_rgba_shader_gles2, TRUE, 3);
++  else
++    _create_template_material (sink, yv12_to_rgba_shader, TRUE, 3);
+ }
+ 
+ 
+@@ -964,7 +1008,10 @@ static ClutterGstRenderer yv12_fp_renderer = {
+ static void
+ clutter_gst_i420_glsl_init (ClutterGstVideoSink * sink)
+ {
+-  _create_template_material (sink, yv12_to_rgba_shader, TRUE, 3);
++  if (sink->priv->renderer_driver == COGL_DRIVER_GLES2)
++    _create_template_material (sink, yv12_to_rgba_shader_gles2, TRUE, 3);
++  else
++    _create_template_material (sink, yv12_to_rgba_shader, TRUE, 3);
+ }
+ 
+ static ClutterGstRenderer i420_glsl_renderer = {
+@@ -1018,7 +1065,10 @@ static ClutterGstRenderer i420_fp_renderer = {
+ static void
+ clutter_gst_ayuv_glsl_init (ClutterGstVideoSink * sink)
+ {
+-  _create_template_material (sink, ayuv_to_rgba_shader, TRUE, 1);
++  if (sink->priv->renderer_driver == COGL_DRIVER_GLES2)
++    _create_template_material (sink, ayuv_to_rgba_shader_gles2, TRUE, 1);
++  else
++    _create_template_material (sink, ayuv_to_rgba_shader, TRUE, 1);
+ }
+ 
+ static gboolean
+@@ -1276,6 +1326,10 @@ static void
+ clutter_gst_video_sink_init (ClutterGstVideoSink * sink)
+ {
+   ClutterGstVideoSinkPrivate *priv;
++  ClutterBackend *backend;
++  CoglContext *context;
++  CoglDisplay *display;
++  CoglRenderer *renderer;
+ 
+   sink->priv = priv =
+       G_TYPE_INSTANCE_GET_PRIVATE (sink, CLUTTER_GST_TYPE_VIDEO_SINK,
+@@ -1285,7 +1339,14 @@ clutter_gst_video_sink_init (ClutterGstVideoSink * sink)
+    * the clutter thread)  */
+   priv->clutter_main_context = g_main_context_default ();
+ 
++  backend = clutter_get_default_backend ();
++  context = clutter_backend_get_cogl_context (backend);
++  display = cogl_context_get_display (context);
++  renderer = cogl_display_get_renderer (display);
++  priv->renderer_driver = cogl_renderer_get_driver (renderer);
++
+   priv->renderers = clutter_gst_build_renderers_list ();
++
+   priv->caps = clutter_gst_build_caps (priv->renderers);
+ 
+   priv->signal_handler_ids = g_array_new (FALSE, TRUE, sizeof (gulong));
+-- 
+1.7.10.4
+

Added: desktop/experimental/clutter-gst-2.0/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/experimental/clutter-gst-2.0/debian/patches/series?rev=36004&op=file
==============================================================================
--- desktop/experimental/clutter-gst-2.0/debian/patches/series (added)
+++ desktop/experimental/clutter-gst-2.0/debian/patches/series [utf-8] Sat Oct 20 15:53:45 2012
@@ -1,0 +1,1 @@
+0001-cluttersink-Use-specific-shaders-based-on-the-curren.patch




More information about the pkg-gnome-commits mailing list