Shaders: preserve signaling NaNs in typed buffer loads #1641

Open
zhaibingye wants to merge 1 commit from upstream-pr/1642 into main
zhaibingye commented 2026-11-24 20:18:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zhaibingye on 2026-11-24T20:18:39Z.


Addresses the signaling-NaN case in #1242 (VIC-BT-019). Loading half 0x7c01 on main returned 0x7fc02000 on llvmpipe, while RDNA2 returns 0x7f802000. This change preserves the signaling bit and payload when widening typed buffer loads.

Exhaustive tests covered 68,608 channel encodings per backend. llvmpipe mismatches fell from 1,068 to 0; SwiftShader matched on both revisions. Portable shader tests: 96 passed, 1 ignored. Native D3D12 and game rendering were not tested locally.

AI assistance: OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6590607176 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1642). Originally posted by [zhaibingye](https://github.com/zhaibingye) on 2026-11-24T20:18:39Z. --- Addresses the signaling-NaN case in #1242 (VIC-BT-019). Loading half 0x7c01 on main returned 0x7fc02000 on llvmpipe, while RDNA2 returns 0x7f802000. This change preserves the signaling bit and payload when widening typed buffer loads. Exhaustive tests covered 68,608 channel encodings per backend. llvmpipe mismatches fell from 1,068 to 0; SwiftShader matched on both revisions. Portable shader tests: 96 passed, 1 ignored. Native D3D12 and game rendering were not tested locally. AI assistance: OpenAI Codex.
DenRakEiw commented 2026-11-24 21:02:57 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T20:26:17Z.

Review: APPROVED


Verified locally merged onto origin/main (Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-shader --lib typed_float_loads_preserve_nan_bits — passed on RTX 5090 hardware and under VICTORY_D3D12_WARP=1
  • cargo clippy -p victory-shader --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean fix preserving signaling NaN bit patterns in typed buffer loads, verified end-to-end on hardware and WARP. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6046816537 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1642#pullrequestreview-6046816537). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T20:26:17Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC): - `cargo test -p victory-shader --lib typed_float_loads_preserve_nan_bits` — passed on RTX 5090 hardware and under `VICTORY_D3D12_WARP=1` - `cargo clippy -p victory-shader --all-targets` — 0 warnings - `cargo xtask policy` — ok Clean fix preserving signaling NaN bit patterns in typed buffer loads, verified end-to-end on hardware and WARP. Looks good. AI-assisted (Gemini 4 Neon).
geiyiliyabumo commented 2026-11-24 21:03:40 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by geiyiliyabumo on 2026-11-24T20:46:49Z.


Verified head f876a82 merged cleanly onto main (ffe310e) on Windows 11 / AMD Radeon RX 9060 XT (RDNA4, gfx1200) + WARP / Rust 1.98.1 MSVC:

  • cargo test -p victory-shader --lib: 121 passed, 0 failed, 1 ignored (typed_float_loads_preserve_nan_bits passes on both RDNA4 hardware and WARP).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: clean.

AI-assisted; synthetic tests only, no game files.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7144045227 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1642#issuecomment-7144045227). Originally posted by [geiyiliyabumo](https://github.com/geiyiliyabumo) on 2026-11-24T20:46:49Z. --- Verified head `f876a82` merged cleanly onto `main` (`ffe310e`) on **Windows 11 / AMD Radeon RX 9060 XT (RDNA4, `gfx1200`) + WARP / Rust 1.98.1 MSVC**: - `cargo test -p victory-shader --lib`: **121 passed, 0 failed, 1 ignored** (typed_float_loads_preserve_nan_bits passes on both RDNA4 hardware and WARP). - `cargo clippy -p victory-shader --all-targets -- -D warnings`: clean. *AI-assisted; synthetic tests only, no game files.*
catminou4 commented 2026-11-24 22:01:43 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T21:42:48Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows.

Signaling NaNs preserved in typed buffer loads: typed_float_loads_preserve_nan_bits checks NaN bit patterns survive the load path.

<!-- greyfinch-sync:Marvisak/VIctory:review:6047881904 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1642#pullrequestreview-6047881904). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T21:42:48Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Hardware/valu/waterfall execution tests are #[cfg(all(test, windows))] and run only on Windows. Signaling NaNs preserved in typed buffer loads: typed_float_loads_preserve_nan_bits checks NaN bit patterns survive the load path.
Marvisak commented 2026-11-25 02:06:10 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:33:00Z.


Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-shader/src/emit/valu_tests.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149674791 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1642#issuecomment-7149674791). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:33:00Z. --- <!-- victory-triage v1 head=f876a822b059108c145f87c847e39bc810729a02 verdict=needs-rebase at=2026-11-25T01:33:00Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-shader/src/emit/valu_tests.rs`). It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
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/1642:upstream-pr/1642'
git switch 'upstream-pr/1642'

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/1642'
git switch 'upstream-pr/1642'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1642'
git switch 'upstream-pr/1642'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1642'
git switch 'main'
git merge --squash 'upstream-pr/1642'
git switch 'main'
git merge --ff-only 'upstream-pr/1642'
git switch 'main'
git merge 'upstream-pr/1642'
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
Marvisak/VIctory!1641
No description provided.