GPU: decode packed 16-bit UNORM diagnostic targets #2636

Open
github-bot wants to merge 2 commits from github-bot/gh-2636 into main AGit
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:20 UTC · original
andrewpozdnakov7-jpg:codex2/capture-packed-unorm → main · +30 −0 · 1 files · 2 commits · open

Problem

Diagnostic capture skips native B5G6R5_UNORM, B5G5R5A1_UNORM, and B4G4R4A4_UNORM readbacks because the PNG converter has no case for their format IDs.

Change

Decode and normalize each RGB channel by its own bit width before the existing diagnostic scaling. Alpha stays outside RGB scaling, including alpha-only pixels. The bit layouts match Microsoft's DirectXTex loader.

Verification

  • The same two pitched rows per format return [None, None, None] on main 13f91ca. With this change, all three return the expected opaque RGBA bytes. Full white catches the different green width in B5G6R5, and the fixtures cover channel order, half green, nonzero row padding, and alpha-only pixels.
  • All three focused diagnostic capture tests, strict victory-gpu Clippy, and the staged policy passed on Windows.

Coordination claim

AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding this change into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg [email protected].

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 17:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2636) `andrewpozdnakov7-jpg:codex2/capture-packed-unorm` → `main` · +30 −0 · 1 files · 2 commits · open ## Problem Diagnostic capture skips native B5G6R5_UNORM, B5G5R5A1_UNORM, and B4G4R4A4_UNORM readbacks because the PNG converter has no case for their format IDs. ## Change Decode and normalize each RGB channel by its own bit width before the existing diagnostic scaling. Alpha stays outside RGB scaling, including alpha-only pixels. The bit layouts match [Microsoft's DirectXTex loader](https://github.com/microsoft/DirectXTex/blob/main/DDSTextureLoader/DDSTextureLoader12.cpp#L713-L728). ## Verification - The same two pitched rows per format return [None, None, None] on main 13f91ca. With this change, all three return the expected opaque RGBA bytes. Full white catches the different green width in B5G6R5, and the fixtures cover channel order, half green, nonzero row padding, and alpha-only pixels. - All three focused diagnostic capture tests, strict victory-gpu Clippy, and the staged policy passed on Windows. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding this change into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.
Decode each packed color channel at its own width for B5G6R5, B5G5R5A1, and B4G4R4A4 readbacks. The same synthetic rows return no pixels on main and the expected RGBA bytes after this change.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:55 +00:00
Author
Owner

@⁠Bj0rnis on GitHub · 2026-11-25 17:33 UTC · original

Independent Windows 11 hardware + WARP verification of #2636 at 1ef6c9b1 (clean git merge-tree with origin/main 13f91cae, Rust 1.98.1 MSVC):

  • NVIDIA GeForce RTX 5070 Ti (real hardware): cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1 -> 197 passed, 2 failed, 1 ignored (2.86s; includes the new test, only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present on main 13f91cae).
  • WARP (VICTORY_D3D12_WARP=1): 199 passed, 0 failed, 1 ignored (1.73s).
  • Clippy: cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings -> 0 warnings.
  • Asset policy: cargo xtask policy -> 184 files ok.

Not tested: live game capture/target dump.

AI-assisted test run and summary.

**@⁠Bj0rnis** on GitHub · 2026-11-25 17:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/2636#issuecomment-7169681774) Independent Windows 11 hardware + WARP verification of #2636 at `1ef6c9b1` (clean `git merge-tree` with `origin/main` `13f91cae`, Rust 1.98.1 MSVC): - **NVIDIA GeForce RTX 5070 Ti (real hardware):** `cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1` -> **197 passed, 2 failed, 1 ignored** (2.86s; includes the new test, only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present on `main` `13f91cae`). - **WARP (`VICTORY_D3D12_WARP=1`):** **199 passed, 0 failed, 1 ignored** (1.73s). - **Clippy:** `cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings` -> **0 warnings**. - **Asset policy:** `cargo xtask policy` -> **184 files ok**. Not tested: live game capture/target dump. AI-assisted test run and summary.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 17:47 UTC · original

Reviewed: ids and bit layouts check out — 85 B5G6R5 (R 11:5, G 5:6, B 0:5), 86 B5G5R5A1 (5 bits each from bit 10, alpha dropped per the comment), 115 B4G4R4A4 (4 bits each). Test covers all three plus row padding. CI green.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2636#issuecomment-7170014507) Reviewed: ids and bit layouts check out — 85 B5G6R5 (R 11:5, G 5:6, B 0:5), 86 B5G5R5A1 (5 bits each from bit 10, alpha dropped per the comment), 115 B4G4R4A4 (4 bits each). Test covers all three plus row padding. CI green.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 22:22 UTC · original

Automated triage for the maintainers.

Recommended for a maintainer's look. Diagnostic captures (to_rgba in crates/victory-gpu/src/capture.rs) returned nothing for the packed 16-bit formats 85 (B5G6R5), 86 (B5G5R5A1) and 115 (B4G4R4A4); they now decode each channel by its own width. I checked the shifts against the DXGI bit layouts (R at 11/10/8, G at 5/5/4, B at 0), and the green width of B5G6R5 is handled separately. Diagnostics-only, 12 lines plus a test that covers row padding. Merges cleanly into current main, CI check passing on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2636#issuecomment-7176280728) <!-- victory-triage v1 head=e91de8a62b2ff4623dbadfdd532e59b18e4dde1d verdict=merge-candidate at=2026-11-25T22:22:45Z --> Automated triage for the maintainers. Recommended for a maintainer's look. Diagnostic captures (`to_rgba` in `crates/victory-gpu/src/capture.rs`) returned nothing for the packed 16-bit formats 85 (B5G6R5), 86 (B5G5R5A1) and 115 (B4G4R4A4); they now decode each channel by its own width. I checked the shifts against the DXGI bit layouts (R at 11/10/8, G at 5/5/4, B at 0), and the green width of B5G6R5 is handled separately. Diagnostics-only, 12 lines plus a test that covers row padding. Merges cleanly into current `main`, CI `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 05:08 UTC · original · approved these changes

Tested merged onto origin/main (63bcca4) on Windows 11 x64:

  • cargo test -p victory-gpu --features diagnostics --lib capture::: 12 passed, 0 failed (including new packed_unorm_captures_decode_each_rgb_width).
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 05:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/2636#pullrequestreview-6068839407) · **approved these changes** Tested merged onto `origin/main` (`63bcca4`) on Windows 11 x64: - `cargo test -p victory-gpu --features diagnostics --lib capture::`: **12 passed, 0 failed** (including new `packed_unorm_captures_decode_each_rgb_width`). - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 16:52 UTC · original · approved these changes

Verified e91de8a62b2ff4623dbadfdd532e59b18e4dde1d merged cleanly onto 63bcca43 on Windows 11 with both an RTX 5090 and WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1).

Code review

  • The DXGI LSB-first bit masks and shifts in to_rgba (crates/victory-gpu/src/capture.rs:659-670) match all three 16-bit packed UNORM layouts:
    • 85 (DXGI_FORMAT_B5G6R5_UNORM): R bits 11..15 (/ 31), G bits 5..10 (/ 63), B bits 0..4 (/ 31).
    • 86 (DXGI_FORMAT_B5G5R5A1_UNORM): R bits 10..14, G bits 5..9, B bits 0..4 (/ 31), alpha bit 15 ignored.
    • 115 (DXGI_FORMAT_B4G4R4A4_UNORM): R bits 8..11, G bits 4..7, B bits 0..3 (/ 15), alpha bits 12..15 ignored.
  • Normalizing each channel by its own mask keeps white/grey balanced across B5G6R5's wider green channel before the existing p99 scaling path, and also merges cleanly alongside #2607 with no textual conflict in capture.rs.

Verification

  • cargo xtask policy: 191 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): clean.
  • RTX 5090 & WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1): capture:: 12 passed, 0 failed on both adapters (including packed_unorm_captures_decode_each_rgb_width at capture.rs:965).
  • Co-merged with #2607 plus an extra pixel probe covering pure R/G/B primaries and all-alpha-only images (0x8000 for 86, 0xF000 for 115, verifying opaque black output with no scaling distortion or division by zero): 14 passed, 0 failed on both RTX 5090 and WARP.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 16:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2636#pullrequestreview-6077867896) · **approved these changes** Verified `e91de8a62b2ff4623dbadfdd532e59b18e4dde1d` merged cleanly onto `63bcca43` on Windows 11 with both an RTX 5090 and WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`). ### Code review - The DXGI LSB-first bit masks and shifts in `to_rgba` (`crates/victory-gpu/src/capture.rs:659-670`) match all three 16-bit packed UNORM layouts: - `85` (`DXGI_FORMAT_B5G6R5_UNORM`): `R` bits `11..15` (`/ 31`), `G` bits `5..10` (`/ 63`), `B` bits `0..4` (`/ 31`). - `86` (`DXGI_FORMAT_B5G5R5A1_UNORM`): `R` bits `10..14`, `G` bits `5..9`, `B` bits `0..4` (`/ 31`), alpha bit `15` ignored. - `115` (`DXGI_FORMAT_B4G4R4A4_UNORM`): `R` bits `8..11`, `G` bits `4..7`, `B` bits `0..3` (`/ 15`), alpha bits `12..15` ignored. - Normalizing each channel by its own mask keeps white/grey balanced across `B5G6R5`'s wider green channel before the existing p99 scaling path, and also merges cleanly alongside `#2607` with no textual conflict in `capture.rs`. ### Verification - `cargo xtask policy`: `191 files ok`. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): clean. - RTX 5090 & WARP (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`): `capture::` **12 passed, 0 failed** on both adapters (including `packed_unorm_captures_decode_each_rgb_width` at `capture.rs:965`). - Co-merged with `#2607` plus an extra pixel probe covering pure R/G/B primaries and all-alpha-only images (`0x8000` for `86`, `0xF000` for `115`, verifying opaque black output with no scaling distortion or division by zero): **14 passed, 0 failed** on both RTX 5090 and WARP.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2636/head:github-bot/gh-2636'
git switch 'github-bot/gh-2636'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2636'
git switch 'github-bot/gh-2636'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2636'
git switch 'github-bot/gh-2636'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2636'
git switch 'main'
git merge --squash 'github-bot/gh-2636'
git switch 'main'
git merge --ff-only 'github-bot/gh-2636'
git switch 'main'
git merge 'github-bot/gh-2636'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2636
No description provided.