pub struct GpuImage { /* private fields */ }Expand description
GPU-resident packed image backed by an rgba8uint 2D texture.
The logical channel count remains 1..=4. Unused texture components are zero, so device storage is a predictable four bytes per pixel on every backend.
Implementations§
Source§impl GpuImage
impl GpuImage
Sourcepub fn upload_u8<const CHANNELS: usize>(
runtime: &WgpuRuntime,
view: ImageView<'_, u8, CHANNELS>,
) -> SpatialResult<Self>
pub fn upload_u8<const CHANNELS: usize>( runtime: &WgpuRuntime, view: ImageView<'_, u8, CHANNELS>, ) -> SpatialResult<Self>
Explicitly uploads a packed or strided u8 image into a texture.
Dimensions, row bytes and host capacity are checked before allocation.
Packed four-channel pixels are borrowed during the queue write; other
layouts use host packing. The backend still performs its own staging.
Sourcepub fn readback_u8<const CHANNELS: usize>(
&mut self,
runtime: &WgpuRuntime,
) -> SpatialResult<Image<u8, CHANNELS>>
pub fn readback_u8<const CHANNELS: usize>( &mut self, runtime: &WgpuRuntime, ) -> SpatialResult<Image<u8, CHANNELS>>
Explicitly reads the texture back into an owned packed host image. Row padding, staging limits and host capacity are checked before work. Pixels are unpacked directly from mapped staging into the owned output; the mapping is released before returning.
Sourcepub const fn metadata(&self) -> ImageMetadata
pub const fn metadata(&self) -> ImageMetadata
Returns retained semantic metadata.
Sourcepub const fn receipt(&self) -> &GpuImageReceipt
pub const fn receipt(&self) -> &GpuImageReceipt
Returns cumulative transfer and device-stage accounting.
Sourcepub fn recycle(self, runtime: &WgpuRuntime)
pub fn recycle(self, runtime: &WgpuRuntime)
Drops texture storage after verifying the runtime ownership contract.