1
0
Fork 0

clutter/blur: Select a better n_steps

The n_steps variable corresponds to the number of *pairs* of
texture lookups that the blur shader does. For example, when
n_steps = 1, the for-loop reads 1 pixel before and 1 pixel
after the current one.

Our blur shader is heavily inspired in WebRender's blur shader,
the biggest difference being that we calculate the gaussian
samples in the fragment shader itself, and not in the vertex
shader. (This could be an improvement in performance for the
future though!)

WebRender's blur shader calculates n_steps differently than what
we currently do, though. It calculates n_step in such a way that
at least 2 steps are performed for evey non-zero sigma value.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1646>
This commit is contained in:
Georges Basile Stavracas Neto 2020-12-17 01:43:26 -03:00 committed by Marge Bot
parent 5fca8f231a
commit 49653b0b0a

View file

@ -84,7 +84,7 @@ static const char *gaussian_blur_glsl =
" vec4 ret = texture2D (cogl_sampler, uv) * gauss_coefficient.x; \n"
" gauss_coefficient.xy *= gauss_coefficient.yz; \n"
" \n"
" int n_steps = int (ceil (3 * sigma)); \n"
" int n_steps = int (ceil (1.5 * sigma)) * 2; \n"
" \n"
" for (int i = 1; i <= n_steps; i += 2) { \n"
" float coefficient_subtotal = gauss_coefficient.x; \n"