summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippo Argiolas <filippo.argiolas@gmail.com>2010-04-25 10:55:43 +0200
committerFilippo Argiolas <filippo.argiolas@gmail.com>2010-04-25 11:08:47 +0200
commitaece68ad18b33384d04007fb0a8773d9d9721f0d (patch)
treeeef867e504763bd1718d05a528cabb630213fd44
parent8edd1eb289a57957ecccd1e1d946589d4c196ca6 (diff)
laplacian: remove unused norm_const and norm_offset uniforms
Remove unused uniforms from the laplacian filter. Also remove if kernel[i] != 0 checks so that it compiles where IF is not available. Again, big thanks to Eric Anholt for the hints.
-rw-r--r--gst/gl/gstglfilterlaplacian.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/gst/gl/gstglfilterlaplacian.c b/gst/gl/gstglfilterlaplacian.c
index 87728f1..c6ebe0f 100644
--- a/gst/gl/gstglfilterlaplacian.c
+++ b/gst/gl/gstglfilterlaplacian.c
@@ -64,11 +64,10 @@ static gboolean gst_gl_filter_laplacian_filter (GstGLFilter * filter,
static void gst_gl_filter_laplacian_callback (gint width, gint height,
guint texture, gpointer stuff);
+/* *INDENT-OFF* */
static const gchar *convolution_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 () {"
" vec2 offset[9];"
@@ -85,10 +84,12 @@ static const gchar *convolution_fragment_source =
" int i;"
" vec4 sum = vec4 (0.0);"
" for (i = 0; i < 9; i++) { "
- " if (kernel[i] != 0.0) {"
- " vec4 neighbor = texture2DRect(tex, texturecoord + vec2(offset[i])); "
- " sum += neighbor * kernel[i]/norm_const; "
- " }" " }" " gl_FragColor = sum + norm_offset;" "}";
+ " vec4 neighbor = texture2DRect(tex, texturecoord + vec2(offset[i]));"
+ " sum += neighbor * kernel[i];"
+ " }"
+ " gl_FragColor = sum;"
+ "}";
+/* *INDENT-ON* */
static void
gst_gl_filter_laplacian_base_init (gpointer klass)
@@ -206,9 +207,6 @@ gst_gl_filter_laplacian_callback (gint width, gint height, guint texture,
gst_gl_shader_set_uniform_1i (laplacian_filter->shader, "tex", 0);
gst_gl_shader_set_uniform_1fv (laplacian_filter->shader, "kernel", 9, kernel);
- gst_gl_shader_set_uniform_1f (laplacian_filter->shader, "norm_const", 1.0);
- gst_gl_shader_set_uniform_1f (laplacian_filter->shader, "norm_offset", 0.0); //set to 0.5 to preserve overall greylevel
-
glBegin (GL_QUADS);
glTexCoord2i (0, 0);