feat(const_eval): impl. saturate

This commit is contained in:
Erich Gubler 2023-12-14 10:41:29 -05:00
parent 87dafb645a
commit 5dc1038124
2 changed files with 4 additions and 0 deletions

View File

@ -45,6 +45,7 @@ Bottom level categories:
- [#4879](https://github.com/gfx-rs/wgpu/pull/4879) by @ErichDonGubler:
- `abs`
- `round`
- `saturate`
## v0.19.0 (2024-01-17)

View File

@ -847,6 +847,9 @@ impl<'a> ConstantEvaluator<'a> {
Float::F32([e]) => Ok(Float::F32([(round_ties_even(e as f64) as f32)])),
})
}
crate::MathFunction::Saturate => {
component_wise_float!(self, span, [arg], |e| { Ok([e.clamp(0., 1.)]) })
}
fun => Err(ConstantEvaluatorError::NotImplemented(format!(
"{fun:?} built-in function"
))),