pub struct TileBuf { /* private fields */ }Expand description
An owned, densely packed buffer of pixels for one region.
This is what the M1 evaluator materializes per node. It is deliberately
simple: M2 replaces most uses with scheduler-owned tile memory, but the
buffer’s view API (TileBuf::as_tile, TileBuf::as_tile_mut) is the
same one kernels already program against, so kernels do not change.
Implementations§
Source§impl TileBuf
impl TileBuf
Sourcepub fn zeroed(region: Region, pixel: PixelFormat) -> Result<Self>
pub fn zeroed(region: Region, pixel: PixelFormat) -> Result<Self>
Allocate a zeroed, densely packed buffer covering region.
§Errors
Returns PixelsError::InvalidArgument if the region’s byte length
overflows usize on this platform.
Sourcepub fn for_image(desc: &ImageDescriptor) -> Result<Self>
pub fn for_image(desc: &ImageDescriptor) -> Result<Self>
Sourcepub fn from_vec(
region: Region,
pixel: PixelFormat,
data: Vec<u8>,
) -> Result<Self>
pub fn from_vec( region: Region, pixel: PixelFormat, data: Vec<u8>, ) -> Result<Self>
Take ownership of data as the pixels of region, densely packed.
§Errors
Returns PixelsError::InvalidArgument if data is not exactly the
packed byte length of region.
Sourcepub const fn pixel(&self) -> PixelFormat
pub const fn pixel(&self) -> PixelFormat
The pixel format of the samples in this buffer.
Sourcepub fn into_bytes(self) -> Vec<u8> ⓘ
pub fn into_bytes(self) -> Vec<u8> ⓘ
Consume the buffer, returning its packed bytes.
Sourcepub fn as_tile(&self) -> Result<Tile<'_>>
pub fn as_tile(&self) -> Result<Tile<'_>>
Borrow the buffer as an immutable tile.
§Errors
Only if the buffer’s own invariants were violated, which construction prevents.