Skip to content

Commit 224585e

Browse files
feat(const_eval): impl. max
1 parent dd381f0 commit 224585e

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
@@ -952,6 +952,11 @@ impl<'a> ConstantEvaluator<'a> {
952952
crate::MathFunction::Log2 => {
953953
component_wise_float!(self, span, [arg], |e| { Ok([e.log2()]) })
954954
}
955+
crate::MathFunction::Max => {
956+
component_wise_scalar!(self, span, [arg, arg1.unwrap()], |e1, e2| {
957+
Ok([e1.max(e2)])
958+
})
959+
}
955960
crate::MathFunction::Radians => {
956961
component_wise_float!(self, span, [arg], |e1| { Ok([e1.to_radians()]) })
957962
}

0 commit comments

Comments
 (0)