GPU: rectangle corners in normalized vertex formats, NaN in half conversion #1311

Closed
SamuelReeder wants to merge 1 commit from upstream-pr/1311 into main
SamuelReeder commented 2026-11-24 17:19:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by SamuelReeder on 2026-11-24T17:19:14Z.


expand_rects computes a rectangle's fourth corner only for the vertex formats components knows; others keep the first vertex's value. This adds the remaining 8- and 16-bit normalized formats:

  • SNORM: R16G16B16A16 (13), R8G8B8A8 (31), R16G16 (37), R8G8 (51), R16 (58), R8 (63)
  • UNORM: R8G8 (49), R16 (56), R8 (61)

The lowest SNORM integer reads as -1, as in D3D. f32_to_half also turned NaN into infinity; it now stays NaN.

The NaN change covers half of #843, reported there with a fix; #1069 (closed) fixed both halves. #1220 covers the rounding half.

Half rounding of exact ties is left to #1220. #1158 and #1204 also touch expand_rects.

Tests (synthetic, CPU only), each failing before and passing after:

  • signed_normalized_corners_complete_the_rectangle
  • small_normalized_formats_get_their_fourth_corner
  • halves_keep_nan

cargo test --workspace --locked --features victory-gpu/diagnostics with VICTORY_WARP=1 VICTORY_D3D12_WARP=1: 348 passed, 0 failed, 6 ignored. Clippy on victory-gpu is clean. Not tested with a title or on a hardware adapter.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:6587447282 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1311). Originally posted by [SamuelReeder](https://github.com/SamuelReeder) on 2026-11-24T17:19:14Z. --- `expand_rects` computes a rectangle's fourth corner only for the vertex formats `components` knows; others keep the first vertex's value. This adds the remaining 8- and 16-bit normalized formats: - SNORM: R16G16B16A16 (13), R8G8B8A8 (31), R16G16 (37), R8G8 (51), R16 (58), R8 (63) - UNORM: R8G8 (49), R16 (56), R8 (61) The lowest SNORM integer reads as -1, as in D3D. `f32_to_half` also turned NaN into infinity; it now stays NaN. The NaN change covers half of #843, reported there with a fix; #1069 (closed) fixed both halves. #1220 covers the rounding half. Half rounding of exact ties is left to #1220. #1158 and #1204 also touch `expand_rects`. Tests (synthetic, CPU only), each failing before and passing after: - `signed_normalized_corners_complete_the_rectangle` - `small_normalized_formats_get_their_fourth_corner` - `halves_keep_nan` `cargo test --workspace --locked --features victory-gpu/diagnostics` with `VICTORY_WARP=1 VICTORY_D3D12_WARP=1`: 348 passed, 0 failed, 6 ignored. Clippy on `victory-gpu` is clean. Not tested with a title or on a hardware adapter. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
DenRakEiw commented 2026-11-24 18:04:42 +00:00 (Migrated from github.com)

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

Review: APPROVED


Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC) with NVIDIA GeForce RTX 5090 (Blackwell) and WARP (VICTORY_D3D12_WARP=1):

  • cargo test -p victory-gpu (RTX 5090): 53 passed, 0 failed, 1 ignored
  • VICTORY_D3D12_WARP=1 cargo test -p victory-gpu (WARP): 53 passed, 0 failed, 1 ignored
  • cargo clippy -p victory-gpu --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean normalized vertex format and half-float NaN handling in rectangle expansion. Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6044160301 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1311#pullrequestreview-6044160301). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T17:26:46Z. **Review:** APPROVED --- Tested merged cleanly onto `main` (`ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC) with **NVIDIA GeForce RTX 5090** (Blackwell) and **WARP** (`VICTORY_D3D12_WARP=1`): - `cargo test -p victory-gpu` (RTX 5090): **53 passed, 0 failed, 1 ignored** - `VICTORY_D3D12_WARP=1 cargo test -p victory-gpu` (WARP): **53 passed, 0 failed, 1 ignored** - `cargo clippy -p victory-gpu --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean normalized vertex format and half-float NaN handling in rectangle expansion. Approving. AI-assisted (Gemini 4 Neon).
muhammed-aksoy commented 2026-11-24 18:06:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by muhammed-aksoy on 2026-11-24T17:54:18Z.


Windows integration results for 075c4ba on ffe310e. The GPU diagnostics suite passed 56 tests with one ignored. In a separate local merge with the branch from #843, both touch primitive.rs. Keeping this PR's normalized rectangle changes and #843's payload-preserving, ties-to-even half conversion passed 56 GPU diagnostics tests with one ignored on WARP, including both regression cases. The tested merge is 8c799dc. These were synthetic fixtures. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139872792 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1311#issuecomment-7139872792). Originally posted by [muhammed-aksoy](https://github.com/muhammed-aksoy) on 2026-11-24T17:54:18Z. --- Windows integration results for `075c4ba` on `ffe310e`. The GPU diagnostics suite passed 56 tests with one ignored. In a separate local merge with the branch from #843, both touch `primitive.rs`. Keeping this PR's normalized rectangle changes and #843's payload-preserving, ties-to-even half conversion passed 56 GPU diagnostics tests with one ignored on WARP, including both regression cases. The tested merge is `8c799dc`. These were synthetic fixtures. AI-assisted.
upstream-sync closed this pull request 2026-11-24 20:01:58 +00:00

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
Marvisak/VIctory!1311
No description provided.