summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippo Argiolas <filippo.argiolas@gmail.com>2010-04-23 17:30:45 +0200
committerFilippo Argiolas <filippo.argiolas@gmail.com>2010-04-24 20:13:10 +0200
commitcb57e4c1664089f327ce011cc3f3c29ed8f9617e (patch)
tree7ea507f9a78613c4bcdc335c486497d742e58459
parentffe9a14b5ffb0fd354320f27643c22f5bd0f8220 (diff)
blur: use common shader sources
Port blur filter to use the common convolution shaders in gstgleffectssources.c. This reduces code duplication and, incidentally, the shaders in the common file were already updated to not use array constructor and to not depend on #version 120. First step towards bug #615696 fixing.
-rw-r--r--gst/gl/gstglfilterblur.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/gst/gl/gstglfilterblur.c b/gst/gl/gstglfilterblur.c
index 51cd288..8853a5c 100644
--- a/gst/gl/gstglfilterblur.c
+++ b/gst/gl/gstglfilterblur.c
@@ -37,42 +37,7 @@
#endif
#include "gstglfilterblur.h"
-
-/* horizontal convolution */
-static const gchar *hconv9_fragment_source =
- "#extension GL_ARB_texture_rectangle : enable\n"
- "uniform sampler2DRect tex;"
- "uniform float norm_const;"
- "uniform float norm_offset;"
- "uniform float kernel[9];"
- "void main () {"
- " float offset[9] = float[9] (-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0);"
- " vec2 texturecoord = gl_TexCoord[0].st;"
- " int i;"
- " vec4 sum = vec4 (0.0);"
- " for (i = 0; i < 9; i++) { "
- " if (kernel[i] != 0.0) {"
- " vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s+offset[i], texturecoord.t)); "
- " sum += neighbor * kernel[i]/norm_const; "
- " }" " }" " gl_FragColor = sum + norm_offset;" "}";
-
-/* vertical convolution */
-static const gchar *vconv9_fragment_source =
- "#extension GL_ARB_texture_rectangle : enable\n"
- "uniform sampler2DRect tex;"
- "uniform float norm_const;"
- "uniform float norm_offset;"
- "uniform float kernel[9];"
- "void main () {"
- " float offset[9] = float[9] (-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0, 4.0);"
- " vec2 texturecoord = gl_TexCoord[0].st;"
- " int i;"
- " vec4 sum = vec4 (0.0);"
- " for (i = 0; i < 9; i++) { "
- " if (kernel[i] != 0.0) {"
- " vec4 neighbor = texture2DRect(tex, vec2(texturecoord.s, texturecoord.t+offset[i])); "
- " sum += neighbor * kernel[i]/norm_const; "
- " }" " }" " gl_FragColor = sum + norm_offset;" "}";
+#include <gstgleffectssources.h>
#define GST_CAT_DEFAULT gst_gl_filterblur_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);