use super::*;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[repr(C)]
pub struct r8_Srgb {
pub r: u8,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[repr(C)]
pub struct r8_Unorm {
pub r: u8,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[repr(C)]
pub struct r16_Unorm {
pub r: u16,
}
#[derive(Debug, Clone, Copy, Default, PartialEq, PartialOrd)]
#[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]
#[repr(C)]
pub struct r32_Sfloat {
pub r: f32,
}
impl From<r8_Srgb> for r32_Sfloat {
#[inline]
#[must_use]
fn from(r8_Srgb { r }: r8_Srgb) -> Self {
Self { r: srgb_u8_to_linear_f32(r) }
}
}
impl From<r8_Unorm> for r32_Sfloat {
#[inline]
#[must_use]
fn from(r8_Unorm { r }: r8_Unorm) -> Self {
Self { r: (r as f32) / (u8::MAX as f32) }
}
}