From 9fcda5a5ac8ecc1aa03b37ac309b374318b1ae47 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Wed, 21 Feb 2024 10:04:24 -0800 Subject: [PATCH] blade: quad render fast path (#8110) Ported from #7231 Release Notes: - N/A --- crates/gpui/src/platform/blade/shaders.wgsl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/gpui/src/platform/blade/shaders.wgsl b/crates/gpui/src/platform/blade/shaders.wgsl index f342dfc92c..8413031655 100644 --- a/crates/gpui/src/platform/blade/shaders.wgsl +++ b/crates/gpui/src/platform/blade/shaders.wgsl @@ -215,6 +215,15 @@ fn fs_quad(input: QuadVarying) -> @location(0) vec4 { } let quad = b_quads[input.quad_id]; + // Fast path when the quad is not rounded and doesn't have any border. + if (quad.corner_radii.top_left == 0.0 && quad.corner_radii.bottom_left == 0.0 && + quad.corner_radii.top_right == 0.0 && + quad.corner_radii.bottom_right == 0.0 && quad.border_widths.top == 0.0 && + quad.border_widths.left == 0.0 && quad.border_widths.right == 0.0 && + quad.border_widths.bottom == 0.0) { + return input.background_color; + } + let half_size = quad.bounds.size / 2.0; let center = quad.bounds.origin + half_size; let center_to_point = input.position.xy - center;