From 8f677cc0c6f589ae279d9c8a6c04dcf6e00d51d9 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Wed, 20 Dec 2023 09:43:04 -0800 Subject: [PATCH] Assign draw order to surfaces using plane splitter --- crates/gpui2/src/scene.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/gpui2/src/scene.rs b/crates/gpui2/src/scene.rs index 811b2b6e30..e6b601b62f 100644 --- a/crates/gpui2/src/scene.rs +++ b/crates/gpui2/src/scene.rs @@ -104,6 +104,15 @@ impl SceneBuilder { ); } + for (ix, surface) in self.surfaces.iter().enumerate() { + let z = layer_z_values[surface.order as LayerId as usize]; + self.splitter.add( + surface + .bounds + .to_bsp_polygon(z, (PrimitiveKind::Surface, ix)), + ); + } + // Sort all polygons, then reassign the order field of each primitive to `draw_order` // We need primitives to be repr(C), hence the weird reuse of the order field for two different types. for (draw_order, polygon) in self