From 43360ccc90784749d453b8f567a46db0b477c057 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 94396e68b6c..39962759529 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -797,7 +797,11 @@ impl<'a> ConstantEvaluator<'a> { crate::MathFunction::Atanh => { component_wise_float!(self, span, [arg], |e| { 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| { + e1.powf(e2).into() + }) + } crate::MathFunction::Clamp => { component_wise_scalar!( self, @@ -844,15 +848,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,