From 596bef9d9c70ccb1da0c7e005f6ed6f22c337e75 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 14 Dec 2023 10:41:51 -0500 Subject: [PATCH] feat(const_eval): impl. `step` --- naga/src/proc/constant_evaluator.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/naga/src/proc/constant_evaluator.rs b/naga/src/proc/constant_evaluator.rs index bc2adde5a73..ab75c5bf281 100644 --- a/naga/src/proc/constant_evaluator.rs +++ b/naga/src/proc/constant_evaluator.rs @@ -750,6 +750,11 @@ impl<'a> ConstantEvaluator<'a> { crate::MathFunction::Sqrt => { component_wise_float!(self, span, [arg], |e| { e.sqrt().into() }) } + crate::MathFunction::Step => { + component_wise_float!(self, span, [arg, arg1.unwrap()], |edge, x| { + if edge <= x { 1.0 } else { 0.0 }.into() + }) + } fun => Err(ConstantEvaluatorError::NotImplemented(format!( "{fun:?} built-in function" ))),