Decode signed and integer render targets correctly in diagnostic captures #2701

Open
github-bot wants to merge 4 commits from github-bot/gh-2701 into main AGit
Owner

@⁠VlREX on GitHub · 2026-11-25 18:28 UTC · original
VlREX:fix/format-boundaries → main · +125 −43 · 1 files · 4 commits · open

Fix signed RGBA/RG/R channel decoding, R32_UINT and R32_SINT scalar decoding, and grayscale normalization for tiny or very wide finite float ranges. These affect diagnostic PNGs used to investigate rendering. Three new regression tests failed before the patch and pass afterward in an isolated Windows GNU run of the conversion code, alongside the existing format test. No game data or GPU required.

**@⁠VlREX** on GitHub · 2026-11-25 18:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/2701) `VlREX:fix/format-boundaries` → `main` · +125 −43 · 1 files · 4 commits · open Fix signed RGBA/RG/R channel decoding, R32_UINT and R32_SINT scalar decoding, and grayscale normalization for tiny or very wide finite float ranges. These affect diagnostic PNGs used to investigate rendering. Three new regression tests failed before the patch and pass afterward in an isolated Windows GNU run of the conversion code, alongside the existing format test. No game data or GPU required.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:20 +00:00
Author
Owner

@⁠DrDarkDK on GitHub · 2026-11-25 18:30 UTC · original

R32_UINT values [16_777_216, 16_777_217] produce two black pixels in to_rgba. Both values become 16_777_216 at the as f32 cast, so the later f64 normalization sees a zero-width range. R32_SINT has the same precision loss.

Could we keep the 32-bit integer channels exact through min/max and normalization, for example by decoding them to f64? A two-pixel R32_UINT regression with those adjacent values should produce black then white.

AI-assisted with Codex.

**@⁠DrDarkDK** on GitHub · 2026-11-25 18:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/2701#issuecomment-7171000709) `R32_UINT` values `[16_777_216, 16_777_217]` produce two black pixels in `to_rgba`. Both values become `16_777_216` at the `as f32` cast, so the later `f64` normalization sees a zero-width range. `R32_SINT` has the same precision loss. Could we keep the 32-bit integer channels exact through min/max and normalization, for example by decoding them to `f64`? A two-pixel `R32_UINT` regression with those adjacent values should produce black then white. *AI-assisted with Codex.*
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 18:48 UTC · original

Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of a86d36ef (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings and --features diagnostics: 0 warnings.
  • RTX 5090: cargo test --locked -p victory-gpu --features diagnostics --lib capture: 7 passed, 0 failed (all 5 new tests pass, including adjacent_large_32_bit_integers_keep_distinct_gray_levels).
  • WARP (VICTORY_D3D12_WARP=1): cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1: 203 passed, 0 failed, 1 ignored.
  • Merge compatibility with #2702: clean zero-conflict 3-way git merge-tree with #2702 (b48e6c74); the two PRs touch disjoint regions of capture.rs and complement each other cleanly.

Code Review Notes

  • Signed integer/SNORM decoding (i8/i16/i32), R10G10B10_XR_BIAS_A2_UNORM, f64 range scaling (preserving adjacent 32-bit integer precision without f32 overflow), two-pass streaming without double full-frame buffers, and half/small_float NaN decoding all look solid.
  • Non-blocking future follow-ups: R32G32B32A32_UINT/_SINT (3, 4) and R32G32_UINT/_SINT (17, 18) remain outside to_rgba, and on multi-channel signed formats large negative values still push p99 via value.abs() while negative outputs clamp at low = 0.0 (consistent with existing HDR float behaviour).
**@⁠fuzeofficlal** on GitHub · 2026-11-25 18:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2701#issuecomment-7171425849) Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and code review of `a86d36ef` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` and `--features diagnostics`: **0 warnings**. - **RTX 5090:** `cargo test --locked -p victory-gpu --features diagnostics --lib capture`: **7 passed, 0 failed** (all 5 new tests pass, including `adjacent_large_32_bit_integers_keep_distinct_gray_levels`). - **WARP (`VICTORY_D3D12_WARP=1`):** `cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1`: **203 passed, 0 failed, 1 ignored**. - **Merge compatibility with #2702:** clean zero-conflict 3-way `git merge-tree` with #2702 (`b48e6c74`); the two PRs touch disjoint regions of `capture.rs` and complement each other cleanly. ### Code Review Notes - Signed integer/SNORM decoding (`i8`/`i16`/`i32`), `R10G10B10_XR_BIAS_A2_UNORM`, `f64` range scaling (preserving adjacent 32-bit integer precision without `f32` overflow), two-pass streaming without double full-frame buffers, and `half`/`small_float` NaN decoding all look solid. - Non-blocking future follow-ups: `R32G32B32A32_UINT/_SINT` (`3, 4`) and `R32G32_UINT/_SINT` (`17, 18`) remain outside `to_rgba`, and on multi-channel signed formats large negative values still push `p99` via `value.abs()` while negative outputs clamp at `low = 0.0` (consistent with existing HDR float behaviour).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:54 UTC · original

Correct direction throughout: integer formats now decode as exact f64 integers (u32/s32 values were silently rounded or sign-mangled through the old f32/word paths), signed formats get their sign, and float_at/half_at keep normalized decoding. Single-channel-as-grey stays consistent.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:54 UTC · [original](https://github.com/Marvisak/VIctory/pull/2701#issuecomment-7171555471) Correct direction throughout: integer formats now decode as exact f64 integers (u32/s32 values were silently rounded or sign-mangled through the old f32/word paths), signed formats get their sign, and float_at/half_at keep normalized decoding. Single-channel-as-grey stays consistent.
Author
Owner

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

Automated triage for the maintainers.

Needs rebase. This branch no longer merges cleanly into main: the conflict is in crates/victory-gpu/src/capture.rs. No content review was done yet; it will be reviewed once it is rebased onto current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/2701#issuecomment-7176136307) <!-- victory-triage v1 head=a86d36ef60926911eb601817da80afb15820d8f7 verdict=needs-rebase at=2026-11-25T22:16:00Z --> Automated triage for the maintainers. **Needs rebase.** This branch no longer merges cleanly into `main`: the conflict is in `crates/victory-gpu/src/capture.rs`. No content review was done yet; it will be reviewed once it is rebased onto current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/capture.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2701'
git switch 'github-bot/gh-2701'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2701'
git switch 'github-bot/gh-2701'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2701'
git switch 'main'
git merge --squash 'github-bot/gh-2701'
git switch 'main'
git merge --ff-only 'github-bot/gh-2701'
git switch 'main'
git merge 'github-bot/gh-2701'
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!2701
No description provided.