Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

blade: quad render fast path (#8110)

Dzmitry Malyshau9fcda5a5ac8e
diff --git a/crates/gpui/src/platform/blade/shaders.wgsl b/crates/gpui/src/platform/blade/shaders.wgsl
index f342dfc92c3..84130316552 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<f32> {
}
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;