rt(params): rename get_parameter -> parameter_value

This commit is contained in:
chyyran 2024-09-06 22:18:33 -04:00 committed by Ronny Chan
parent f83fd1e98f
commit ec3add1616
7 changed files with 14 additions and 14 deletions

View file

@ -267,7 +267,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
}
}
@ -292,7 +292,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
};

View file

@ -287,7 +287,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
}
}
@ -312,7 +312,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
};

View file

@ -177,7 +177,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
}
}
@ -202,7 +202,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
};

View file

@ -234,7 +234,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
}
}
@ -259,7 +259,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
};

View file

@ -235,7 +235,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
}
}
@ -260,7 +260,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
};

View file

@ -313,7 +313,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
}
}
@ -338,7 +338,7 @@ extern_fn! {
let name = CStr::from_ptr(param_name);
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()
};

View file

@ -35,14 +35,14 @@ impl RuntimeParameters {
}
/// 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()
}
/// Set a runtime parameter.
///
/// 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());
if let Some(value) = updated_map.get_mut::<str>(name.as_ref()) {