diff --git a/src/render_helpers/shaders/rounding_alpha.frag b/src/render_helpers/shaders/rounding_alpha.frag index abc90091..e1c9527e 100644 --- a/src/render_helpers/shaders/rounding_alpha.frag +++ b/src/render_helpers/shaders/rounding_alpha.frag @@ -19,6 +19,9 @@ float niri_rounding_alpha(vec2 coords, vec2 size, vec4 corner_radius) { } float dist = distance(coords, center); - float half_px = 0.5 / niri_scale; - return 1.0 - smoothstep(radius - half_px, radius + half_px, dist); + + // Manual smoothstep() between radius - half_px and radius + half_px + // to avoid a division in clamp(). + float t = clamp((dist - radius) * niri_scale + 0.5, 0.0, 1.0); + return 1.0 - t * t * (3.0 - 2.0 * t); }