From 49653b0b0ab4ca1c09cd240769716d03a4601a8e Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Thu, 17 Dec 2020 01:43:26 -0300 Subject: [PATCH] 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: --- 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 abc8d3c14..1f0d394dd 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"