pub struct RuntimeParameters { /* private fields */ }
Expand description
Runtime reflection of shader parameters for filter chains.
All operations on runtime parameters are atomic and can be done on any thread.
Implementations§
Source§impl RuntimeParameters
impl RuntimeParameters
Sourcepub fn new(passes_enabled: usize, parameters: Vec<ParameterMeta>) -> Self
pub fn new(passes_enabled: usize, parameters: Vec<ParameterMeta>) -> Self
Create a new instance of runtime parameters from a Vec
of
shader parameters from a ShaderPreset
.
Sourcepub fn parameter_value(&self, name: &str) -> Option<f32>
pub fn parameter_value(&self, name: &str) -> Option<f32>
Get the value of a runtime parameter
Sourcepub fn set_parameter_value(&self, name: &str, new_value: f32) -> Option<f32>
pub fn set_parameter_value(&self, name: &str, new_value: f32) -> Option<f32>
Set a runtime parameter.
This is a relatively slow operation as it will be synchronized across threads.
If updating multiple parameters, see RuntimeParameters::update_parameters
.
Sourcepub fn update_parameters(
&self,
updater: impl FnOnce(&mut FastHashMap<ShortString, f32>),
)
pub fn update_parameters( &self, updater: impl FnOnce(&mut FastHashMap<ShortString, f32>), )
Update multiple runtime parameters atomically through a function.
Sourcepub fn parameters(&self) -> Arc<FastHashMap<ShortString, f32>>
pub fn parameters(&self) -> Arc<FastHashMap<ShortString, f32>>
Get a reference to the runtime parameters.
Sourcepub fn passes_enabled(&self) -> usize
pub fn passes_enabled(&self) -> usize
Get the number of passes enabled.
If set from RuntimeParameters::set_passes_enabled
from a different thread,
it is not guaranteed to be immediately visible.
Sourcepub fn set_passes_enabled(&self, count: usize)
pub fn set_passes_enabled(&self, count: usize)
Set the number of passes enabled.
This is an atomic operation and is thread-safe.
Auto Trait Implementations§
impl !Freeze for RuntimeParameters
impl RefUnwindSafe for RuntimeParameters
impl Send for RuntimeParameters
impl Sync for RuntimeParameters
impl Unpin for RuntimeParameters
impl UnwindSafe for RuntimeParameters
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more