This commit is contained in:
Antonio Scandurra 2023-10-03 17:53:08 +02:00
parent 2b6d041cb6
commit dc40ac854a
2 changed files with 10 additions and 13 deletions

View file

@ -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()

View file

@ -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)
}
}