GPU: preserve integer contrast in R32 captures #1895

Manually merged
github merged 1 commit from gh-pr/1895/head into gh-pr/1895/base 2026-11-26 04:47:56 +00:00
Owner

@⁠DoubleD17 on GitHub · 2026-11-25 00:17 UTC · original
DoubleD17:port/fxceless-347 → main · +99 −3 · 1 files · 1 commits · merged 2026-11-25 21:52 UTC

The diagnostic capture path decodes R32_UINT and R32_SINT words as floating-point bit patterns, which can turn distinct integer texels into an all-black preview. Decode the words as integers and scale the exact range to RGBA8. Keep the capture statistics and leave other formats on the existing conversion path.

On Windows x64 with Rust 1.98.1 and MSVC, three new synthetic cases failed on e82a6ad. All five capture tests passed on ba1a666 with cargo test --offline --locked --jobs 2 -p victory-gpu --features diagnostics --lib capture::tests::. The cases cover signed and unsigned scaling, large adjacent values, and a padded row with signed extrema. Validation was limited to the CPU capture conversion.

Adapted from fxceless/victory-fork #347.

AI-assisted.

**@⁠DoubleD17** on GitHub · 2026-11-25 00:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1895) `DoubleD17:port/fxceless-347` → `main` · +99 −3 · 1 files · 1 commits · merged 2026-11-25 21:52 UTC The diagnostic capture path decodes R32_UINT and R32_SINT words as floating-point bit patterns, which can turn distinct integer texels into an all-black preview. Decode the words as integers and scale the exact range to RGBA8. Keep the capture statistics and leave other formats on the existing conversion path. On Windows x64 with Rust 1.98.1 and MSVC, three new synthetic cases failed on e82a6ad. All five capture tests passed on ba1a666 with `cargo test --offline --locked --jobs 2 -p victory-gpu --features diagnostics --lib capture::tests::`. The cases cover signed and unsigned scaling, large adjacent values, and a padded row with signed extrema. Validation was limited to the CPU capture conversion. Adapted from [fxceless/victory-fork #347](https://github.com/fxceless/victory-fork/pull/347). AI-assisted.
Decode R32_UINT and R32_SINT numerically and scale their full integer span. Render constant nonzero targets white so they remain distinguishable from all-zero targets.

Co-authored-by: andrewpozdnakov7-jpg <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:47:54 +00:00
github manually merged commit 9ce9d6fbea into gh-pr/1895/base 2026-11-26 04:47:56 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 02:17 UTC · original · edited 2026-11-25 20:20 UTC

Automated triage for the maintainers.

Merge candidate (unchanged). The new head keeps the earlier fix: to_rgba in crates/victory-gpu/src/capture.rs sends formats 42/43 (R32_UINT/R32_SINT) to r32_integer_to_rgba, which reads the words as integers and scales the exact low..high span in i64 instead of decoding them as f32 bits. That decoding turned small integers into denormals and gave an all-black capture. R32 float, depth and typeless formats stay on the old path, and the "target values" log line is kept.

What changed since the last verdict: the head now includes the follow-up proposed in the comments, with co-author credit. A constant nonzero integer target is drawn white, and an all-zero target stays black, so a filled target no longer looks empty. Three new tests cover constant +7 unsigned, constant -7 signed and constant zero. I checked the expected bytes of all six tests against the arithmetic, including the 2x2 padded-pitch case. This is the same rule #2486 (still open) proposes for the float single-channel paths. It is a diagnostics-only change with no dependency changes.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 02:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1895#issuecomment-7150544093) · edited 2026-11-25 20:20 UTC <!-- victory-triage v1 head=9ce9d6fbea8e36979f6e92d47991a42599461fc4 verdict=merge-candidate at=2026-11-25T20:18:54Z --> Automated triage for the maintainers. **Merge candidate (unchanged).** The new head keeps the earlier fix: `to_rgba` in `crates/victory-gpu/src/capture.rs` sends formats 42/43 (R32_UINT/R32_SINT) to `r32_integer_to_rgba`, which reads the words as integers and scales the exact low..high span in `i64` instead of decoding them as `f32` bits. That decoding turned small integers into denormals and gave an all-black capture. R32 float, depth and typeless formats stay on the old path, and the "target values" log line is kept. **What changed since the last verdict:** the head now includes the follow-up proposed in the comments, with co-author credit. A constant nonzero integer target is drawn white, and an all-zero target stays black, so a filled target no longer looks empty. Three new tests cover constant +7 unsigned, constant -7 signed and constant zero. I checked the expected bytes of all six tests against the arithmetic, including the 2x2 padded-pitch case. This is the same rule #2486 (still open) proposes for the float single-channel paths. It is a diagnostics-only change with no dependency changes. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 15:23 UTC · original

I checked the exact head 7f69c0f with constant R32_UINT and R32_SINT readbacks. Both produced black pixels for a nonzero constant. That makes a filled target look empty in the capture, which is the same grayscale case addressed for the other single-channel paths in #2486.

The tested follow-up applies the same rule to this PR's integer converter. The same synthetic inputs (+7 unsigned, -7 signed) now produce white, and zero produces black. Six capture tests passed on Windows, including the existing adjacent-integer and full-range/pitch tests. Strict GPU Clippy with diagnostics and staged asset policy passed.

If you use the follow-up, please retain its Git author when cherry-picking or rebasing. If you fold it into another commit, please add Co-authored-by: andrewpozdnakov7-jpg <[email protected]>.

AI-assisted with Codex. Synthetic readback data.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 15:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1895#issuecomment-7166765341) I checked the exact head `7f69c0f` with constant `R32_UINT` and `R32_SINT` readbacks. Both produced black pixels for a nonzero constant. That makes a filled target look empty in the capture, which is the same grayscale case addressed for the other single-channel paths in #2486. [The tested follow-up](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/4eefc9172bbb91186ff16fb2e89e82f030802d77) applies the same rule to this PR's integer converter. The same synthetic inputs (`+7` unsigned, `-7` signed) now produce white, and zero produces black. Six capture tests passed on Windows, including the existing adjacent-integer and full-range/pitch tests. Strict GPU Clippy with diagnostics and staged asset policy passed. If you use the follow-up, please retain its Git author when cherry-picking or rebasing. If you fold it into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex. Synthetic readback data.
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!1895
No description provided.