Checkpoint
This commit is contained in:
parent
dc40ac854a
commit
bfa211fb02
8 changed files with 13 additions and 58 deletions
15
Cargo.lock
generated
15
Cargo.lock
generated
|
@ -1050,20 +1050,6 @@ name = "bytemuck"
|
|||
version = "1.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
|
||||
dependencies = [
|
||||
"bytemuck_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bytemuck_derive"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "byteorder"
|
||||
|
@ -3256,7 +3242,6 @@ dependencies = [
|
|||
"bindgen 0.65.1",
|
||||
"bitflags 2.4.0",
|
||||
"block",
|
||||
"bytemuck",
|
||||
"cbindgen",
|
||||
"cocoa",
|
||||
"collections",
|
||||
|
|
|
@ -55,7 +55,6 @@ usvg = { version = "0.14", features = [] }
|
|||
uuid = { version = "1.1.2", features = ["v4"] }
|
||||
waker-fn = "1.1.0"
|
||||
slotmap = "1.0.6"
|
||||
bytemuck = { version = "1.14.0", features = ["derive"] }
|
||||
schemars.workspace = true
|
||||
plane-split = "0.18.0"
|
||||
bitflags = "2.4.0"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use serde::de::{self, Deserialize, Deserializer, Visitor};
|
||||
use std::fmt;
|
||||
use std::num::ParseIntError;
|
||||
|
@ -118,7 +117,7 @@ impl TryFrom<&'_ str> for Rgba {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Copy, Clone, Debug, PartialEq, Zeroable, Pod)]
|
||||
#[derive(Default, Copy, Clone, Debug, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct Hsla {
|
||||
pub h: f32,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
use bytemuck::{Pod, Zeroable};
|
||||
use core::fmt::Debug;
|
||||
use derive_more::{Add, AddAssign, Div, Mul, Sub, SubAssign};
|
||||
use refineable::Refineable;
|
||||
|
@ -102,9 +101,6 @@ impl<T: Clone + Debug> Clone for Point<T> {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Zeroable for Point<T> {}
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Pod for Point<T> {}
|
||||
|
||||
#[derive(Refineable, Default, Clone, Copy, Debug, PartialEq, Div, Hash)]
|
||||
#[refineable(debug)]
|
||||
#[repr(C)]
|
||||
|
@ -113,9 +109,6 @@ pub struct Size<T: Clone + Debug> {
|
|||
pub height: T,
|
||||
}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Zeroable for Size<T> {}
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Pod for Size<T> {}
|
||||
|
||||
pub fn size<T: Clone + Debug>(width: T, height: T) -> Size<T> {
|
||||
Size { width, height }
|
||||
}
|
||||
|
@ -214,9 +207,6 @@ pub struct Bounds<T: Clone + Debug> {
|
|||
pub size: Size<T>,
|
||||
}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Zeroable for Bounds<T> {}
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Pod for Bounds<T> {}
|
||||
|
||||
// Bounds<f32> * Pixels = Bounds<Pixels>
|
||||
impl<T, Rhs> Mul<Rhs> for Bounds<T>
|
||||
where
|
||||
|
@ -323,10 +313,6 @@ impl<T: Clone + Debug + Mul<S, Output = T>, S: Clone> MulAssign<S> for Edges<T>
|
|||
|
||||
impl<T: Clone + Debug + Copy> Copy for Edges<T> {}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Zeroable for Edges<T> {}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Pod for Edges<T> {}
|
||||
|
||||
impl<T: Clone + Debug> Edges<T> {
|
||||
pub fn map<U: Clone + Debug, F: Fn(&T) -> U>(&self, f: F) -> Edges<U> {
|
||||
Edges {
|
||||
|
@ -441,13 +427,7 @@ impl<T: Clone + Debug + Mul<S, Output = T>, S: Clone> MulAssign<S> for Corners<T
|
|||
|
||||
impl<T: Clone + Debug + Copy> Copy for Corners<T> {}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Zeroable for Corners<T> {}
|
||||
|
||||
unsafe impl<T: Clone + Debug + Zeroable + Pod> Pod for Corners<T> {}
|
||||
|
||||
#[derive(
|
||||
Clone, Copy, Default, Add, AddAssign, Sub, SubAssign, Div, PartialEq, PartialOrd, Zeroable, Pod,
|
||||
)]
|
||||
#[derive(Clone, Copy, Default, Add, AddAssign, Sub, SubAssign, Div, PartialEq, PartialOrd)]
|
||||
#[repr(transparent)]
|
||||
pub struct Pixels(pub(crate) f32);
|
||||
|
||||
|
@ -570,9 +550,6 @@ impl DevicePixels {
|
|||
}
|
||||
}
|
||||
|
||||
unsafe impl bytemuck::Pod for DevicePixels {}
|
||||
unsafe impl bytemuck::Zeroable for DevicePixels {}
|
||||
|
||||
impl From<DevicePixels> for u32 {
|
||||
fn from(device_pixels: DevicePixels) -> Self {
|
||||
device_pixels.0
|
||||
|
|
|
@ -14,7 +14,6 @@ use async_task::Runnable;
|
|||
use futures::channel::oneshot;
|
||||
use seahash::SeaHasher;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::cmp::Ordering;
|
||||
use std::ffi::c_void;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::{
|
||||
|
@ -196,11 +195,11 @@ pub struct AtlasTile {
|
|||
pub(crate) bounds_in_atlas: Bounds<DevicePixels>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Zeroable, Pod)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct AtlasTextureId(pub(crate) usize);
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Zeroable, Pod)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct TileId(pub(crate) u32);
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ use crate::{
|
|||
point, size, AtlasTextureId, DevicePixels, MetalAtlas, MonochromeSprite, Quad,
|
||||
RasterizedGlyphId, Scene, Size,
|
||||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use cocoa::{
|
||||
base::{NO, YES},
|
||||
foundation::NSUInteger,
|
||||
|
@ -245,20 +244,19 @@ impl MetalRenderer {
|
|||
);
|
||||
let quad_uniforms = QuadUniforms { viewport_size };
|
||||
|
||||
let quad_uniform_bytes = bytemuck::bytes_of(&quad_uniforms);
|
||||
command_encoder.set_vertex_bytes(
|
||||
QuadInputIndex::Uniforms as u64,
|
||||
quad_uniform_bytes.len() as u64,
|
||||
quad_uniform_bytes.as_ptr() as *const c_void,
|
||||
mem::size_of_val(&quad_uniforms) as u64,
|
||||
&quad_uniforms as *const QuadUniforms as *const _,
|
||||
);
|
||||
|
||||
let quad_bytes = bytemuck::cast_slice(quads);
|
||||
let quad_bytes_len = mem::size_of::<Quad>() * quads.len();
|
||||
let buffer_contents = unsafe { (self.instances.contents() as *mut u8).add(*offset) };
|
||||
unsafe {
|
||||
ptr::copy_nonoverlapping(quad_bytes.as_ptr(), buffer_contents, quad_bytes.len());
|
||||
ptr::copy_nonoverlapping(quads.as_ptr() as *const u8, buffer_contents, quad_bytes_len);
|
||||
}
|
||||
|
||||
let next_offset = *offset + quad_bytes.len();
|
||||
let next_offset = *offset + quad_bytes_len;
|
||||
assert!(
|
||||
next_offset <= INSTANCE_BUFFER_SIZE,
|
||||
"instance buffer exhausted"
|
||||
|
@ -332,7 +330,7 @@ enum QuadInputIndex {
|
|||
Uniforms = 2,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, Zeroable, Pod)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub(crate) struct QuadUniforms {
|
||||
viewport_size: Size<DevicePixels>,
|
||||
|
|
|
@ -2,7 +2,6 @@ use std::{iter::Peekable, mem};
|
|||
|
||||
use super::{Bounds, Hsla, Pixels, Point};
|
||||
use crate::{AtlasTextureId, AtlasTile, Corners, Edges};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use collections::BTreeMap;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
|
@ -184,7 +183,7 @@ pub(crate) enum PrimitiveBatch<'a> {
|
|||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, Zeroable, Pod, Eq, PartialEq)]
|
||||
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub struct Quad {
|
||||
pub order: u32,
|
||||
|
|
|
@ -4,7 +4,6 @@ mod line_wrapper;
|
|||
mod text_layout_cache;
|
||||
|
||||
use anyhow::anyhow;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
pub use font_features::*;
|
||||
pub use line::*;
|
||||
use line_wrapper::*;
|
||||
|
@ -24,7 +23,7 @@ use std::{
|
|||
sync::Arc,
|
||||
};
|
||||
|
||||
#[derive(Hash, PartialEq, Eq, Clone, Copy, Debug, Zeroable, Pod)]
|
||||
#[derive(Hash, PartialEq, Eq, Clone, Copy, Debug)]
|
||||
#[repr(C)]
|
||||
pub struct FontId(pub usize);
|
||||
|
||||
|
@ -334,7 +333,7 @@ pub struct RunStyle {
|
|||
pub underline: Option<UnderlineStyle>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Zeroable, Pod)]
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
|
||||
#[repr(C)]
|
||||
pub struct GlyphId(u32);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue