Fix signed zero precedence in shader division fixup #353

Closed
nawnie wants to merge 1 commit from upstream-pr/353 into main
nawnie commented 2026-11-27 21:18:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by nawnie on 2026-11-27T21:18:43Z.


For v_div_fixup_f32, a NaN intermediate quotient can currently override the signed zero required when the numerator is zero or the denominator is infinite. Resolve those operand cases before handling a NaN quotient, while retaining the existing invalid-operation and input-NaN precedence.

This ports the selection-order correction also present in Marvisak/VIctory#200, credited to Nikita Romanovich. The separate exponent-difference underflow rule in that proposal is outside this change; this does not claim complete division emulation.

Validation:

  • cargo test --locked --offline -p victory-shader --lib emit::tests::div_fixup_corner_program_lowers_without_gpu -- --exact --nocapture passed.
  • The ignored div_fixup_corner_program_executes_on_gpu test passed all 12 synthetic cases on a GeForce RTX 4070 Ti SUPER using D3D12. This does not independently validate behavior against RDNA2 hardware.
  • git diff --check passed. Crate-wide cargo fmt -p victory-shader -- --check reports pre-existing formatting differences outside this change.

No gameplay or frame-rate improvement is claimed; this is a targeted shader-correctness fix.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5533220726 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/353). Originally posted by [nawnie](https://github.com/nawnie) on 2026-11-27T21:18:43Z. --- For `v_div_fixup_f32`, a NaN intermediate quotient can currently override the signed zero required when the numerator is zero or the denominator is infinite. Resolve those operand cases before handling a NaN quotient, while retaining the existing invalid-operation and input-NaN precedence. This ports the selection-order correction also present in [Marvisak/VIctory#200](https://github.com/Marvisak/VIctory/pull/200), credited to Nikita Romanovich. The separate exponent-difference underflow rule in that proposal is outside this change; this does not claim complete division emulation. Validation: - `cargo test --locked --offline -p victory-shader --lib emit::tests::div_fixup_corner_program_lowers_without_gpu -- --exact --nocapture` passed. - The ignored `div_fixup_corner_program_executes_on_gpu` test passed all 12 synthetic cases on a GeForce RTX 4070 Ti SUPER using D3D12. This does not independently validate behavior against RDNA2 hardware. - `git diff --check` passed. Crate-wide `cargo fmt -p victory-shader -- --check` reports pre-existing formatting differences outside this change. No gameplay or frame-rate improvement is claimed; this is a targeted shader-correctness fix.
1tsethan commented 2026-11-27 23:01:01 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 1tsethan on 2026-11-27T23:01:01Z.


Independent Windows validation of PR #353.

Tested commit: 6e6f87993f661dd592e21bbbde5e6e4589a2af17.

cargo test --locked -p victory-shader div_fixup_corner_program_lowers -- --nocapture --test-threads=1

Exit: 0.

  • test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 293 filtered out; finished in 0.00s

Tested commit: 6e6f87993f661dd592e21bbbde5e6e4589a2af17.

cargo test --locked -p victory-shader div_fixup_corner_program_executes_on_gpu -- --ignored --nocapture

Exit: 0.

  • test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 293 filtered out; finished in 2.11s

Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7229803189 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/353#issuecomment-7229803189). Originally posted by [1tsethan](https://github.com/1tsethan) on 2026-11-27T23:01:01Z. --- Independent Windows validation of PR #353. Tested commit: `6e6f87993f661dd592e21bbbde5e6e4589a2af17`. `cargo test --locked -p victory-shader div_fixup_corner_program_lowers -- --nocapture --test-threads=1` Exit: **0**. - test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 293 filtered out; finished in 0.00s Tested commit: `6e6f87993f661dd592e21bbbde5e6e4589a2af17`. `cargo test --locked -p victory-shader div_fixup_corner_program_executes_on_gpu -- --ignored --nocapture` Exit: **0**. - test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 293 filtered out; finished in 2.11s Independent verification with OpenAI Codex assistance. Windows 11 Pro build 26200; Rust 1.98.1 MSVC; Windows SDK libraries from Microsoft.Windows.SDK.CPP.x64 10.0.28000.2957. Test harness used an RTX 3070 Ti / AMD integrated-GPU host; adapter identity was not captured for every test. These are focused checks on the stated PR commit, not gameplay, FPS, or a merged-main integration result. <!-- victory-native-validation-20261128 -->
cloph-dsp commented 2026-11-28 00:57:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-11-28T00:57:47Z.


Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):

  • PR #353 at head 6e6f87993f661dd592e21bbbde5e6e4589a2af17, merge base 0f0ada19095979e2192d1b5a98bb5297cf4d53ea.
  • cargo test --locked -p victory-shader --lib emit::tests::div_fixup_corner_program_lowers_without_gpu -- --exact --test-threads=1 --quiet → 1 passed, 0 failed, 293 filtered, exit 0.
  • git grep -F for the test name on the merge base returned no hits (test is new on this PR); git diff --check 0f0ada19 HEAD clean (2 files, +140/-5).
  • Used a per-worktree CARGO_TARGET_DIR with CARGO_BUILD_JOBS=2. An initial link failure (LNK1318, PDB FILE_SYSTEM) was a local disk-full condition, not a PR defect; after reclaiming build artifacts it linked and passed.
  • Only the named synthetic CPU test was replayed; full workspace suite and clippy were not run locally (no clippy component on this toolchain).
  • GPU/driver: N/A (CPU-only shader-lowering test). No game data, assets, extracted shaders, DRM or decrypt involved.

AI-assisted (Hy4 flash).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7231318623 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/353#issuecomment-7231318623). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-28T00:57:47Z. --- Independent local verification (Windows, Rust 1.100.0/MSVC, no game data): - PR #353 at head `6e6f87993f661dd592e21bbbde5e6e4589a2af17`, merge base `0f0ada19095979e2192d1b5a98bb5297cf4d53ea`. - `cargo test --locked -p victory-shader --lib emit::tests::div_fixup_corner_program_lowers_without_gpu -- --exact --test-threads=1 --quiet` → 1 passed, 0 failed, 293 filtered, exit 0. - `git grep -F` for the test name on the merge base returned no hits (test is new on this PR); `git diff --check 0f0ada19 HEAD` clean (2 files, +140/-5). - Used a per-worktree `CARGO_TARGET_DIR` with `CARGO_BUILD_JOBS=2`. An initial link failure (LNK1318, PDB FILE_SYSTEM) was a local disk-full condition, not a PR defect; after reclaiming build artifacts it linked and passed. - Only the named synthetic CPU test was replayed; full workspace suite and clippy were not run locally (no clippy component on this toolchain). - GPU/driver: N/A (CPU-only shader-lowering test). No game data, assets, extracted shaders, DRM or decrypt involved. AI-assisted (Hy4 flash).
trustno1-coder commented 2026-11-28 02:49:43 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by trustno1-coder on 2026-11-28T02:49:43Z.


Merged into main (8fc2254) and shipped in v2026.11.27.10. The commit keeps you as its author, so it counts toward the contributors list. GitHub shows this as closed rather than merged only because the commits were applied on top of the newest main (new commit IDs). Thank you!

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7232619545 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/353#issuecomment-7232619545). Originally posted by [trustno1-coder](https://github.com/trustno1-coder) on 2026-11-28T02:49:43Z. --- Merged into main (8fc2254) and shipped in [v2026.11.27.10](https://github.com/trustno1-coder/VIctory-NVIDIA/releases/tag/v2026.11.27.10). The commit keeps you as its author, so it counts toward the contributors list. GitHub shows this as closed rather than merged only because the commits were applied on top of the newest main (new commit IDs). Thank you!

Pull request closed

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
trustno1-coder/VIctory-NVIDIA!353
No description provided.