Skip to content

Conversation

jimblandy
Copy link
Member

Have constant evaluator use wrapping_abs instead of abs when applying MathFunction::Abs to AbstractInt values. WGSL says that applying abs to the most negative AbstractInt value must return it unchanged, which is what Rust's i64::wrapping_abs does.

Have constant evaluator use `wrapping_abs` instead of `abs` when
applying `MathFunction::Abs` to AbstractInt values. WGSL says that
applying `abs` to the most negative AbstractInt value must return it
unchanged, which is what Rust's `i64::wrapping_abs` does.
@jimblandy jimblandy added naga Shader Translator area: naga processing Passes over IR in the middle labels Apr 10, 2025
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ezpz kthx

@ErichDonGubler ErichDonGubler merged commit 22c4033 into gfx-rs:trunk Apr 11, 2025
37 checks passed
@jimblandy jimblandy deleted the naga-const-eval-abs-most-negative branch April 17, 2025 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: naga processing Passes over IR in the middle naga Shader Translator

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants