use bytemuck::{Pod, Zeroable};
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Pod, Zeroable)]
pub struct CellBg {
pub rgba: [u8; 4],
}
impl CellBg {
pub const TRANSPARENT: Self = Self { rgba: [0, 0, 0, 0] };
}
#[repr(C)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Pod, Zeroable)]
pub struct CellText {
pub glyph_pos: [u32; 2],
pub glyph_size: [u32; 2],
pub bearings: [i16; 2],
pub grid_pos: [u16; 2],
pub color: [u8; 4],
pub atlas: u8,
pub bools: u8,
pub _pad: [u8; 2],
}
impl CellText {
pub const BOOL_NO_MIN_CONTRAST: u8 = 1 << 0;
pub const BOOL_IS_CURSOR_GLYPH: u8 = 1 << 1;
pub const ATLAS_GRAYSCALE: u8 = 0;
pub const ATLAS_COLOR: u8 = 1;
}
const _: () = {
assert!(std::mem::size_of::<CellBg>() == 4);
assert!(std::mem::size_of::<CellText>() == 32);
};
#[repr(C)]
#[derive(Clone, Copy, Debug, Pod, Zeroable)]
pub struct GridUniforms {
pub projection: [f32; 16],
pub grid_padding: [f32; 4],
pub cursor_color: [f32; 4],
pub cursor_bg_color: [f32; 4],
pub cell_size: [f32; 2],
pub grid_size: [u32; 2],
pub cursor_pos: [u32; 2],
pub _pad_cursor: [u32; 2],
pub min_contrast: f32,
pub flags: u32,
pub padding_extend: u32,
pub input_colorspace: u32,
}
impl GridUniforms {
pub const FLAG_DISPLAY_P3: u32 = 1 << 0;
pub const FLAG_LINEAR_BLENDING: u32 = 1 << 1;
pub const PADDING_EXTEND_LEFT: u32 = 1 << 0;
pub const PADDING_EXTEND_RIGHT: u32 = 1 << 1;
pub const PADDING_EXTEND_UP: u32 = 1 << 2;
pub const PADDING_EXTEND_DOWN: u32 = 1 << 3;
}
const _: () = {
assert!(std::mem::size_of::<GridUniforms>().is_multiple_of(16));
};