From 6654c6895033bede0f75bd09bfa2dbe1e6ca483a Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 22 Dec 2023 08:01:52 -0500 Subject: [PATCH] feat(const_eval): impl. `acos` --- CHANGELOG.md | 1 + naga/src/proc/constant_evaluator.rs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 80704dc27..ff937bbdd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,7 @@ Bottom level categories: - Many numeric built-ins have had a constant evaluation implementation added for them, which allows them to be used in a `const` context: - [#4879](https://github.com/gfx-rs/wgpu/pull/4879) by @ErichDonGubler: - `abs` + - `acos` - `cos` - `cosh` - `round` diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index 4692355a5..b56d4c699 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -819,6 +819,9 @@ impl<'a> ConstantEvaluator<'a> { Scalar::U32([e]) => Ok(Scalar::U32([e])), // TODO: just re-use the expression, ezpz }) } + crate::MathFunction::Acos => { + component_wise_float!(self, span, [arg], |e| { Ok([e.acos()]) }) + } crate::MathFunction::Pow => self.math_pow(arg, arg1.unwrap(), span), crate::MathFunction::Clamp => { component_wise_scalar!(