[][src]Struct nannou::wgpu::TextureCapturer

pub struct TextureCapturer { /* fields omitted */ }

A type dedicated to capturing a texture as a non-linear sRGBA image that can be read on the CPU.

Calling capture will return a Snapshot that may be read after the given command encoder has been submitted. Snapshots can be read on the current thread via read or on a thread pool via read_threaded.

If the Capturer is dropped while threaded callbacks are still being processed, the drop implementation will block the current thread.

Implementations

impl Capturer[src]

pub const DST_FORMAT: TextureFormat[src]

The format to which textures will be converted before being mapped back to the CPU.

pub fn new(workers: Option<u32>, timeout: Option<Duration>) -> Self[src]

Create a new TextureCapturer.

Note that a TextureCapturer must only be used with a single texture. If you require capturing multiple textures, you may create multiple TextureCapturers.

workers refers to the number of worker threads used to await GPU buffers to be mapped for reading and for running user callbacks. If None is specified, a threadpool will be spawned with a number of threads equal to the number of CPUs available on the system.

timeout specifies how long to block and wait for an available worker in the case that all workers are busy at the time a Snapshot::read occurs. If None is specified, calls to Snapshot::read will never time out (the default behaviour).

Note that the specified parameters are only relevant to calls to Snapshot::read. In the case that the user uses Snapshot::read_async, it is the responsibility of the user to execute the future.

pub fn active_snapshots(&self) -> u32[src]

The number of futures currently running on the inner ThreadPool.

Note that futures are only run on the threadpool when the Snapshot::read method is used. In the case that Snapshot::read_async is used it is up to the user to track their futures.

If the inner thread pool mutex has been poisoned, or if the thread pool has not been created due to no calls to read, this will return 0.

pub fn workers(&self) -> u32[src]

The number of worker threads used to await GPU buffers to be mapped for reading and for running user callbacks.

pub fn capture(
    &self,
    device: &Device,
    encoder: &mut CommandEncoder,
    src_texture: &Texture
) -> Snapshot
[src]

Capture the given texture at the state of the given command encoder.

pub fn await_active_snapshots(
    &self,
    device: &Device
) -> Result<(), AwaitWorkerTimeout<()>>
[src]

Await for the completion of all Snapshot::read active futures, polling the device as necessary until all futures have reached completion or until a timeout is reached.

Trait Implementations

impl Debug for Capturer[src]

impl Default for Capturer[src]

Auto Trait Implementations

Blanket Implementations

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> ConvertInto<U> for T where
    U: ConvertFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,