ui_app

source of pkg::alloy::gpu::cpu::resources

1// What the CPU device holds: buffers as bytes, textures as RGBA8 pixels2// (red in the low byte), samplers as their settings. Shaders reach them3// through the bindings a draw or dispatch sets.45import std::vector;67pub type CpuTexture = struct {8    pub width: u32,9    pub height: u32,10    pub pixels: Vector<u32>,11};1213pub type CpuSampler = struct {14    pub linear: bool, // linear filtering, else nearest15    pub repeat: bool, // repeat addressing, else clamp to edge16};1718pub type CpuResources = struct {19    pub buffers: Vector<Vector<u8>>,20    pub textures: Vector<CpuTexture>,21    pub samplers: Vector<CpuSampler>,22};2324pub fn CpuResources::empty() -> CpuResources {25    return CpuResources {26        .buffers = Vector<Vector<u8>>::empty(),27        .textures = Vector<CpuTexture>::empty(),28        .samplers = Vector<CpuSampler>::empty()29    };30}