[mutter] clutter/blur: Select a better n_steps



commit 49653b0b0ab4ca1c09cd240769716d03a4601a8e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Thu Dec 17 01:43:26 2020 -0300

    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>

 clutter/clutter/clutter-blur.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/clutter/clutter/clutter-blur.c b/clutter/clutter/clutter-blur.c
index abc8d3c147..1f0d394ddf 100644
--- a/clutter/clutter/clutter-blur.c
+++ b/clutter/clutter/clutter-blur.c
@@ -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"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]