Skip to content

Commit 7d41f29

Browse files
feat(const_eval): impl. max
1 parent a6fd518 commit 7d41f29

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ Bottom level categories:
8080
- `inverseSqrt`
8181
- `log`
8282
- `log2`
83+
- `max`
8384
- `radians`
8485
- `reverseBits`
8586
- `sign`

naga/src/proc/constant_evaluator.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,11 @@ impl<'a> ConstantEvaluator<'a> {
956956
crate::MathFunction::Log2 => {
957957
component_wise_float!(self, span, [arg], |e| { Ok([e.log2()]) })
958958
}
959+
crate::MathFunction::Max => {
960+
component_wise_scalar!(self, span, [arg, arg1.unwrap()], |e1, e2| {
961+
Ok([e1.max(e2)])
962+
})
963+
}
959964
crate::MathFunction::Radians => {
960965
component_wise_float!(self, span, [arg], |e1| { Ok([e1.to_radians()]) })
961966
}

0 commit comments

Comments
 (0)