WIP

Antonio Scandurra created

Change summary

crates/gpui3/build.rs        |  3 +++
crates/gpui3/src/platform.rs | 20 +++++++-------------
2 files changed, 10 insertions(+), 13 deletions(-)

Detailed changes

crates/gpui3/build.rs 🔗

@@ -48,6 +48,8 @@ fn generate_shader_bindings() -> PathBuf {
         "Quad".into(),
         "QuadInputIndex".into(),
         "QuadUniforms".into(),
+        "AtlasTile".into(),
+        "MonochromeSprite".into(),
     ]);
     config.no_includes = true;
     config.enumeration.prefix_with_name = true;
@@ -55,6 +57,7 @@ fn generate_shader_bindings() -> PathBuf {
         .with_src(crate_dir.join("src/scene.rs"))
         .with_src(crate_dir.join("src/geometry.rs"))
         .with_src(crate_dir.join("src/color.rs"))
+        .with_src(crate_dir.join("src/platform.rs"))
         .with_src(crate_dir.join("src/platform/mac/metal_renderer.rs"))
         .with_config(config)
         .generate()

crates/gpui3/src/platform.rs 🔗

@@ -196,29 +196,23 @@ pub struct AtlasTile {
     pub(crate) bounds_in_atlas: Bounds<DevicePixels>,
 }
 
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, Zeroable, Pod)]
 #[repr(C)]
 pub(crate) struct AtlasTextureId(pub(crate) usize);
 
-#[derive(Clone, Copy, Debug, PartialEq, Eq)]
+#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Zeroable, Pod)]
 #[repr(C)]
-pub(crate) struct TileId(pub(crate) etagere::AllocId);
+pub(crate) struct TileId(pub(crate) u32);
 
 impl From<etagere::AllocId> for TileId {
     fn from(id: etagere::AllocId) -> Self {
-        Self(id)
+        Self(id.serialize())
     }
 }
 
-impl Ord for TileId {
-    fn cmp(&self, other: &Self) -> Ordering {
-        self.0.serialize().cmp(&other.0.serialize())
-    }
-}
-
-impl PartialOrd for TileId {
-    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
-        Some(self.cmp(other))
+impl From<TileId> for etagere::AllocId {
+    fn from(id: TileId) -> Self {
+        Self::deserialize(id.0)
     }
 }