From 435ed16f7d1de9c11c0f0374c179d8345fc1947e 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 b12ff1317f2..77625f6cf32 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" ))),