From 99c54f4731522cbbcbf0f485f1c6336da1f406a5 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Fri, 22 Dec 2023 08:05:15 -0500 Subject: [PATCH] refactor(const_eval): inline `math_pow` --- naga/src/proc/constant_evaluator.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index 6b41b851be2..9cc2dd66b4c 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -808,7 +808,11 @@ impl<'a> ConstantEvaluator<'a> { crate::MathFunction::Atanh => { component_wise_float!(self, span, [arg], |e| { Ok(e.atanh().into()) }) } - crate::MathFunction::Pow => self.math_pow(arg, arg1.unwrap(), span), + crate::MathFunction::Pow => { + component_wise_float!(self, span, [arg, arg1.unwrap()], |e1, e2| { + Ok(e1.powf(e2).into()) + }) + } crate::MathFunction::Clamp => { component_wise_scalar!( self, @@ -884,15 +888,6 @@ impl<'a> ConstantEvaluator<'a> { } } - fn math_pow( - &mut self, - e1: Handle, - e2: Handle, - span: Span, - ) -> Result, ConstantEvaluatorError> { - component_wise_float!(self, span, [e1, e2], |e1, e2| { e1.powf(e2).into() }) - } - fn array_length( &mut self, array: Handle,