pub struct WgpuParamsHandle<P: Pod> { /* private fields */ }Expand description
Live handle for updating shader parameters from any thread while the
filter runs inside a pipeline. Created via
crate::wgpu_filter::WgpuFrameFilter::params_handle.
Implementations§
Source§impl<P: Pod> WgpuParamsHandle<P>
impl<P: Pod> WgpuParamsHandle<P>
Sourcepub fn set(&self, value: P)
pub fn set(&self, value: P)
Replaces the parameter value; the new bytes are uploaded before the next frame is rendered.
Sourcepub fn update(&self, f: impl FnOnce(&mut P))
pub fn update(&self, f: impl FnOnce(&mut P))
Reads, modifies and writes back the parameter value as one atomic
step — the lock is held across the closure, so concurrent set /
update calls from other threads serialize instead of losing
writes (update(|p| p.gain += 0.1) never overwrites a value it
did not see). Because the lock is held, calling set/update on
any handle to the same filter from inside the closure deadlocks.
Auto Trait Implementations§
impl<P> Freeze for WgpuParamsHandle<P>
impl<P> RefUnwindSafe for WgpuParamsHandle<P>where
P: RefUnwindSafe,
impl<P> Send for WgpuParamsHandle<P>where
P: Send,
impl<P> Sync for WgpuParamsHandle<P>where
P: Sync,
impl<P> Unpin for WgpuParamsHandle<P>where
P: Unpin,
impl<P> UnsafeUnpin for WgpuParamsHandle<P>
impl<P> UnwindSafe for WgpuParamsHandle<P>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more