librashader/librashader-runtime-d3d12/src/parameters.rs
2023-02-06 01:05:19 -05:00

41 lines
1.1 KiB
Rust

use crate::filter_chain::FilterChainD3D12;
use librashader_runtime::parameters::FilterChainParameters;
use std::collections::hash_map::Iter;
impl FilterChainParameters for FilterChainD3D12 {
fn get_enabled_pass_count(&self) -> usize {
self.common.config.passes_enabled
}
fn set_enabled_pass_count(&mut self, count: usize) {
self.common.config.passes_enabled = count
}
fn enumerate_parameters(&self) -> Iter<String, f32> {
self.common.config.parameters.iter()
}
fn get_parameter(&self, parameter: &str) -> Option<f32> {
self.common
.config
.parameters
.get::<str>(parameter.as_ref())
.copied()
}
fn set_parameter(&mut self, parameter: &str, new_value: f32) -> Option<f32> {
if let Some(value) = self
.common
.config
.parameters
.get_mut::<str>(parameter.as_ref())
{
let old = *value;
*value = new_value;
Some(old)
} else {
None
}
}
}