Skip to main content

FlashLimiter

Struct FlashLimiter 

Source
pub struct FlashLimiter { /* private fields */ }
Expand description

Limits the per-channel change between the frames it is fed. Owns two FLASH_STATE_FORMAT images of one size (the shown frame and the next); nothing is allocated before FlashLimiter::new.

crate::Renderer::set_flash_limit drives one internally for render_frame. A host that composites frames itself (preset transitions) feeds its final image to FlashLimiter::apply and presents the returned view.

Implementations§

Source§

impl FlashLimiter

Source

pub fn new( device: &Device, width: u32, height: u32, ) -> Result<Self, RenderError>

A limiter for images of width x height; the first frame fades in from black.

Fails with RenderError::Invalid if the size is zero or beyond the device’s texture limit.

Source

pub fn size(&self) -> (u32, u32)

The image size this limiter was made for.

Source

pub fn reset(&mut self)

Forget the shown frame: the next one fades in from black again.

Source

pub fn shown_texture(&self) -> &Texture

The texture of the last limited frame (FLASH_STATE_FORMAT), e.g. for read-back.

Source

pub fn apply( &mut self, encoder: &mut CommandEncoder, src: &TextureView, max_step: f32, ) -> &TextureView

Record the limiting of src (any float-filterable or unfilterable colour image of this limiter’s size) into encoder: each channel of the shown frame moves towards src by at most max_step (in units of the full 0..1 range). max_step is limit * dt; a non-finite or negative value freezes the image. Returns the view of the limited frame, which stays the shown frame for the next call.

Auto Trait Implementations§

§

impl !RefUnwindSafe for FlashLimiter

§

impl !UnwindSafe for FlashLimiter

§

impl Forget for FlashLimiter

§

impl Freeze for FlashLimiter
where *const ArcInner<Device> is !null: Freeze, PhantomData<ArcInner<Device>>: Freeze, *const ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>> is !null: Freeze, PhantomData<ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>>>: Freeze, *const ArcInner<RenderPipeline> is !null: Freeze, PhantomData<ArcInner<RenderPipeline>>: Freeze, *const ArcInner<BindGroupLayout> is !null: Freeze, PhantomData<ArcInner<BindGroupLayout>>: Freeze, *const ArcInner<Texture> is !null: Freeze, PhantomData<ArcInner<Texture>>: Freeze, *const ArcInner<TextureView> is !null: Freeze, PhantomData<ArcInner<TextureView>>: Freeze,

§

impl Move for FlashLimiter

§

impl Send for FlashLimiter
where DispatchDevice: Send, Arc<Mutex<RawMutex, HashSet<WeakMapContext>>>: Send, DispatchRenderPipeline: Send, DispatchBindGroupLayout: Send, DispatchTexture: Send, DispatchTextureView: Send,

§

impl Sync for FlashLimiter
where DispatchDevice: Sync, Arc<Mutex<RawMutex, HashSet<WeakMapContext>>>: Sync, DispatchRenderPipeline: Sync, DispatchBindGroupLayout: Sync, DispatchTexture: Sync, DispatchTextureView: Sync,

§

impl Unpin for FlashLimiter

§

impl UnsafeUnpin for FlashLimiter
where *const ArcInner<Device> is !null: UnsafeUnpin, PhantomData<ArcInner<Device>>: UnsafeUnpin, *const ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>> is !null: UnsafeUnpin, PhantomData<ArcInner<Mutex<RawMutex, HashSet<WeakMapContext>>>>: UnsafeUnpin, *const ArcInner<RenderPipeline> is !null: UnsafeUnpin, PhantomData<ArcInner<RenderPipeline>>: UnsafeUnpin, *const ArcInner<BindGroupLayout> is !null: UnsafeUnpin, PhantomData<ArcInner<BindGroupLayout>>: UnsafeUnpin, *const ArcInner<Texture> is !null: UnsafeUnpin, PhantomData<ArcInner<Texture>>: UnsafeUnpin, *const ArcInner<TextureView> is !null: UnsafeUnpin, PhantomData<ArcInner<TextureView>>: UnsafeUnpin,

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
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

impl<T> WasmNotSendSync for T

Source§

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