Files
zed/crates/gpui_apple
John Tur 8a5cf7e23a gpui: Use Levien's shadow approximation (#66812)
GPUI draws shadows using Evan Wallace's technique: the blur along x is
computed in closed form with the error function, and the blur along y is
integrated numerically with four samples. Each pixel runs that loop,
which evaluates the error function eight times, plus four square roots
and four exponentials.

We replace it with [Raph Levien's closed-form
approximation](https://raphlinus.github.io/graphics/2020/04/21/blurred-rounded-rects.html)
of a blurred rounded rectangle. The blurred shape is approximated as a
superellipse whose radius and exponent are fitted to the blur, so each
pixel needs one distance and two error function evaluations. Everything
that depends only on the shadow is computed once per vertex and passed
to the fragment shader through interpolators.

The content in the `shadow` example differs from `main` by at most 5/255
per channel.

On an Intel HD 4600, GPU time in the `shadow` example is reduced by 30%
(2,008µs → 1,399µs).

Release Notes:
- Reduced GPU usage
- [GPUI] Improved shadow rendering performance
2026-11-12 08:19:32 +00:00
..
…