Struct nannou_wgpu::TextureCapturer[][src]

pub struct TextureCapturer { /* fields omitted */ }
Expand description

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

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

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.

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.

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

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

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

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.