[429/906] 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.
This commit is contained in:
Filippo Argiolas 2010-04-25 10:55:43 +02:00 committed by Matthew Waters
parent 2c905bda24
commit e7d083fcc0

View file

@ -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);