mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
[420/906] 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.
This commit is contained in:
parent
fe42e22e84
commit
f979b52e5c
1 changed files with 1 additions and 36 deletions
|
@ -37,42 +37,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gstglfilterblur.h"
|
#include "gstglfilterblur.h"
|
||||||
|
#include <gstgleffectssources.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;" "}";
|
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_gl_filterblur_debug
|
#define GST_CAT_DEFAULT gst_gl_filterblur_debug
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
Loading…
Reference in a new issue