rt(params): rename get_parameter -> parameter_value
This commit is contained in:
parent
f83fd1e98f
commit
ec3add1616
|
@ -267,7 +267,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
if chain.parameters().set_parameter(name, value).is_none() {
|
if chain.parameters().set_parameter_value(name, value).is_none() {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -292,7 +292,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
let Some(value) = chain.parameters().get_parameter(name) else {
|
let Some(value) = chain.parameters().parameter_value(name) else {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
if chain.parameters().set_parameter(name, value).is_none() {
|
if chain.parameters().set_parameter_value(name, value).is_none() {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
let Some(value) = chain.parameters().get_parameter(name) else {
|
let Some(value) = chain.parameters().parameter_value(name) else {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
if chain.parameters().set_parameter(name, value).is_none() {
|
if chain.parameters().set_parameter_value(name, value).is_none() {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
let Some(value) = chain.parameters().get_parameter(name) else {
|
let Some(value) = chain.parameters().parameter_value(name) else {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
if chain.parameters().set_parameter(name, value).is_none() {
|
if chain.parameters().set_parameter_value(name, value).is_none() {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -259,7 +259,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
let Some(value) = chain.parameters().get_parameter(name) else {
|
let Some(value) = chain.parameters().parameter_value(name) else {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
if chain.parameters().set_parameter(name, value).is_none() {
|
if chain.parameters().set_parameter_value(name, value).is_none() {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
let Some(value) = chain.parameters().get_parameter(name) else {
|
let Some(value) = chain.parameters().parameter_value(name) else {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
if chain.parameters().set_parameter(name, value).is_none() {
|
if chain.parameters().set_parameter_value(name, value).is_none() {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ extern_fn! {
|
||||||
let name = CStr::from_ptr(param_name);
|
let name = CStr::from_ptr(param_name);
|
||||||
let name = name.to_str()?;
|
let name = name.to_str()?;
|
||||||
|
|
||||||
let Some(value) = chain.parameters().get_parameter(name) else {
|
let Some(value) = chain.parameters().parameter_value(name) else {
|
||||||
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
return LibrashaderError::UnknownShaderParameter(param_name).export()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,14 +35,14 @@ impl RuntimeParameters {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the value of a runtime parameter
|
/// Get the value of a runtime parameter
|
||||||
pub fn get_parameter(&self, name: &str) -> Option<f32> {
|
pub fn parameter_value(&self, name: &str) -> Option<f32> {
|
||||||
self.parameters.load().get::<str>(name.as_ref()).copied()
|
self.parameters.load().get::<str>(name.as_ref()).copied()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set a runtime parameter.
|
/// Set a runtime parameter.
|
||||||
///
|
///
|
||||||
/// This is a relatively slow operation as it will be synchronized across threads.
|
/// This is a relatively slow operation as it will be synchronized across threads.
|
||||||
pub fn set_parameter(&self, name: &str, new_value: f32) -> Option<f32> {
|
pub fn set_parameter_value(&self, name: &str, new_value: f32) -> Option<f32> {
|
||||||
let mut updated_map = FastHashMap::clone(&self.parameters.load());
|
let mut updated_map = FastHashMap::clone(&self.parameters.load());
|
||||||
|
|
||||||
if let Some(value) = updated_map.get_mut::<str>(name.as_ref()) {
|
if let Some(value) = updated_map.get_mut::<str>(name.as_ref()) {
|
||||||
|
|
Loading…
Reference in a new issue