Skip to main content

GpuImage

Struct GpuImage 

Source
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

Source

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.

Source

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.

Source

pub const fn width(&self) -> u32

Returns image width in pixels.

Source

pub const fn height(&self) -> u32

Returns image height in pixels.

Source

pub const fn channels(&self) -> u32

Returns the logical component count.

Source

pub const fn metadata(&self) -> ImageMetadata

Returns retained semantic metadata.

Source

pub const fn receipt(&self) -> &GpuImageReceipt

Returns cumulative transfer and device-stage accounting.

Source

pub fn recycle(self, runtime: &WgpuRuntime)

Drops texture storage after verifying the runtime ownership contract.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,