From 5e7f227d9244c4c375d3d04585177ee941fa4f40 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Thu, 25 Jul 2024 15:22:24 +0200 Subject: [PATCH] gpu: Don't run long loops in shaders If the border radius is too big, take bigger steps when computing the shadow. I randomly chose 8 because that looked good and was fast enough. --- gsk/gpu/shaders/gskgpuboxshadow.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsk/gpu/shaders/gskgpuboxshadow.glsl b/gsk/gpu/shaders/gskgpuboxshadow.glsl index 8e26e43a35..5294e0b87d 100644 --- a/gsk/gpu/shaders/gskgpuboxshadow.glsl +++ b/gsk/gpu/shaders/gskgpuboxshadow.glsl @@ -112,7 +112,7 @@ blur_corner (vec2 p, return 0.0; float result = 0.0; - float step = 1.0; + float step = max (1.0, r.y / 8.0); for (float y = 0.5 * step; y <= r.y; y += step) { float x = r.x - ellipse_x (r, r.y - y);