From 40a52fcc168d4bb35c35e911cbaeb5c6a3360b0d Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Wed, 8 Nov 2023 13:10:47 -0800 Subject: [PATCH] [Impeller] Documented the 2 step in the gaussian blur. (flutter/engine#47822) [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl b/engine/src/flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl index a40797aec1..1144ab085c 100644 --- a/engine/src/flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl +++ b/engine/src/flutter/impeller/entity/shaders/gaussian_blur/gaussian_blur.glsl @@ -48,6 +48,11 @@ void main() { f16vec4 total_color = f16vec4(0.0hf); float16_t gaussian_integral = 0.0hf; + // Step by 2.0 as a performance optimization, relying on bilinear filtering in + // the sampler to blend the texels. Typically the space between pixels is + // calculated so their blended amounts match the gaussian coefficients. This + // just uses 0.5 as an optimization until the gaussian coefficients are + // calculated and passed in from the cpu. for (float16_t i = -blur_info.blur_radius; i <= blur_info.blur_radius; i += 2.0hf) { // Use the 32 bit Gaussian function because the 16 bit variation results in