Skip to content

Commit ec252d8

Browse files
feat(const_eval): impl. max
1 parent f1d7cc6 commit ec252d8

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
@@ -74,6 +74,7 @@ Bottom level categories:
7474
- `inverseSqrt`
7575
- `log`
7676
- `log2`
77+
- `max`
7778
- `radians`
7879
- `reverseBits`
7980
- `sign`

naga/src/proc/constant_evaluator.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,11 @@ impl<'a> ConstantEvaluator<'a> {
947947
crate::MathFunction::Log2 => {
948948
component_wise_float!(self, span, [arg], |e| { Ok([e.log2()]) })
949949
}
950+
crate::MathFunction::Max => {
951+
component_wise_scalar!(self, span, [arg, arg1.unwrap()], |e1, e2| {
952+
Ok([e1.max(e2)])
953+
})
954+
}
950955
crate::MathFunction::Pow => {
951956
component_wise_float!(self, span, [arg, arg1.unwrap()], |e1, e2| {
952957
Ok([e1.powf(e2)])

0 commit comments

Comments
 (0)