#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
pub enum TextureFormat {
Rgba8Unorm,
Rgba8Snorm,
Rgba8UnormSrgb,
Bgra8Unorm,
Bgra8UnormSrgb,
Rgba16Float,
Rg16Float,
Rg32Float,
Rgba32Float,
R8Unorm,
R32Uint,
R32Float,
Depth32Float,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, Default)]
pub enum TextureDimension {
#[default]
D2,
D3,
}
impl TextureFormat {
#[must_use]
pub fn is_depth(self) -> bool {
matches!(self, Self::Depth32Float)
}
}
bitflags::bitflags! {
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct TextureUsage: u32 {
const RENDER_ATTACHMENT = 1;
const TEXTURE_BINDING = 1 << 1;
const STORAGE_BINDING = 1 << 2;
const COPY_SRC = 1 << 3;
const COPY_DST = 1 << 4;
}
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct TextureDesc {
pub label: &'static str,
pub width: u32,
pub height: u32,
pub depth: u32,
pub dimension: TextureDimension,
pub format: TextureFormat,
pub usage: TextureUsage,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub struct TextureViewDesc {}
#[derive(Clone, Copy, Debug)]
pub struct TextureWrite<'a> {
pub origin: [u32; 3],
pub size: [u32; 3],
pub bytes_per_row: u32,
pub rows_per_image: u32,
pub data: &'a [u8],
}