Shaders: fix workspace clippy lints in wave64_after_loop and valu_tests #1440

Open
n-romanovich wants to merge 1 commit from upstream-pr/1440 into main
n-romanovich commented 2026-11-27 06:41:30 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by n-romanovich on 2026-11-27T06:41:30Z.


Fixes #1439.

Changes

  • crates/victory-shader/src/emit/wave64_after_loop.rs:533
    • Parenthesize ((i / 16) ^ 1) * 16 to resolve clippy::precedence with identical runtime behavior (/ already has higher precedence than ^).
  • crates/victory-shader/src/emit/valu_tests.rs:600
    • Add #[allow(clippy::double_comparisons, clippy::neg_cmp_op_on_partial_ord)] to the ieee reference closure in every_f32_comparison_answers_nans_as_ieee.
    • Why allow instead of rewriting: a and b are f32 values tested with NaN inputs. Rewriting a < b || a > b to a != b or !(a >= b) to a < b would break IEEE-754 unordered/ordered NaN comparison semantics (v_cmp_<op>_f32 opcodes 0x5, 0x9–0xE).

Verification

  • cargo clippy --workspace --all-targets --locked -- -D warnings — passed (0 warnings, 0 errors)
  • cargo test --locked -p victory-shader --lib valu_tests — 26 passed, 0 failed, 1 ignored (every_f32_comparison_answers_nans_as_ieee passed)
<!-- greyfinch-sync:fxceless/victory-fork:issue:5522422490 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1440). Originally posted by [n-romanovich](https://github.com/n-romanovich) on 2026-11-27T06:41:30Z. --- Fixes #1439. ### Changes - **`crates/victory-shader/src/emit/wave64_after_loop.rs:533`** - Parenthesize `((i / 16) ^ 1) * 16` to resolve `clippy::precedence` with identical runtime behavior (`/` already has higher precedence than `^`). - **`crates/victory-shader/src/emit/valu_tests.rs:600`** - Add `#[allow(clippy::double_comparisons, clippy::neg_cmp_op_on_partial_ord)]` to the `ieee` reference closure in `every_f32_comparison_answers_nans_as_ieee`. - Why allow instead of rewriting: `a` and `b` are `f32` values tested with `NaN` inputs. Rewriting `a < b || a > b` to `a != b` or `!(a >= b)` to `a < b` would break IEEE-754 unordered/ordered `NaN` comparison semantics (`v_cmp_<op>_f32` opcodes `0x5`, `0x9`–`0xE`). ### Verification - `cargo clippy --workspace --all-targets --locked -- -D warnings` — passed (0 warnings, 0 errors) - `cargo test --locked -p victory-shader --lib valu_tests` — 26 passed, 0 failed, 1 ignored (`every_f32_comparison_answers_nans_as_ieee` passed)
Headache3318 commented 2026-11-27 07:28:10 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Headache3318 on 2026-11-27T07:28:10Z.


Verified: this head clears the CI gate — reproduced the failure on main and the clean run on 7238c559, side by side.

  • Repro at 9a9091d: cargo xwin clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc reports exactly 7 warnings in victory-shader (lib test) — the same seven the issue lists (emit/wave64_after_loop.rs:533 precedence, and the six IEEE comparisons in the valu_tests ieee closure at 608–617). Under -D warnings that is the #1439 failure.
  • At this head 7238c559: -p victory-shader --all-targets --locked -- -D warnings exits 0, and the full shape of the CI command — --workspace --all-targets --locked -- -D warnings — also exits 0 across every crate and target.
  • The fix is the right shape: the comparison predicates are untouched (clippy's suggested rewrites really are NaN-divergent, exactly as the issue warns), and the allow is scoped to the ieee closure.

Environment: Arch Linux x86-64 host, pinned rustc/clippy 1.98.1, cross-checked with cargo-xwin 0.24.2 at x86_64-pc-windows-msvc. Clippy does not link, so the lint set here matches what CI sees natively; I cannot run Windows-native CI itself from this box. Bonus data for #483's cross-build question: the whole workspace type-checks for x86_64-pc-windows-msvc on Linux this way.

AI-assisted (Hermes Agent).

<!-- greyfinch-sync:fxceless/victory-fork:comment:7212500949 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1440#issuecomment-7212500949). Originally posted by [Headache3318](https://github.com/Headache3318) on 2026-11-27T07:28:10Z. --- **Verified: this head clears the CI gate — reproduced the failure on `main` and the clean run on `7238c559`, side by side.** - Repro at `9a9091d`: `cargo xwin clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc` reports exactly **7 warnings in `victory-shader` (lib test)** — the same seven the issue lists (`emit/wave64_after_loop.rs:533` precedence, and the six IEEE comparisons in the `valu_tests` `ieee` closure at 608–617). Under `-D warnings` that is the #1439 failure. - At this head `7238c559`: `-p victory-shader --all-targets --locked -- -D warnings` exits **0**, and the full shape of the CI command — `--workspace --all-targets --locked -- -D warnings` — also exits **0** across every crate and target. - The fix is the right shape: the comparison predicates are untouched (clippy's suggested rewrites really are NaN-divergent, exactly as the issue warns), and the allow is scoped to the `ieee` closure. Environment: Arch Linux x86-64 host, pinned rustc/clippy 1.98.1, cross-checked with `cargo-xwin 0.24.2` at `x86_64-pc-windows-msvc`. Clippy does not link, so the lint set here matches what CI sees natively; I cannot run Windows-native CI itself from this box. Bonus data for #483's cross-build question: the whole workspace type-checks for `x86_64-pc-windows-msvc` on Linux this way. AI-assisted (Hermes Agent).
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1440:upstream-pr/1440'
git switch 'upstream-pr/1440'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1440'
git switch 'upstream-pr/1440'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1440'
git switch 'upstream-pr/1440'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1440'
git switch 'main'
git merge --squash 'upstream-pr/1440'
git switch 'main'
git merge --ff-only 'upstream-pr/1440'
git switch 'main'
git merge 'upstream-pr/1440'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!1440
No description provided.