blade: quad render fast path (#8110)

Ported from #7231

Release Notes:
- N/A
This commit is contained in:
Dzmitry Malyshau 2024-02-21 10:04:24 -08:00 committed by GitHub
parent 5e43290aa1
commit 9fcda5a5ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;