GPU: keep constant nonzero targets visible in captures #2486

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

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 14:42 UTC · original
andrewpozdnakov7-jpg:codex2/capture-uniform-grayscale → main · +26 −1 · 1 files · 2 commits · open

A flat single-channel target has no contrast to stretch. The capture code subtracts its minimum from every pixel, so a depth buffer cleared to a nonzero value appears black and the dump filename receives the -black suffix. This can make a nonzero target look empty during rendering diagnostics.

Show a constant nonzero value as white in the grayscale dump. A zero target stays black and a varying target keeps its existing grayscale range.

The same synthetic readback test produced [0, 0, 0, 255] for the constant D32_FLOAT input 0.25 on 940d32f, then [255, 255, 255, 255] with the fix. The negative R32_FLOAT, zero-depth and varying-depth controls passed. All three capture tests, strict GPU Clippy with diagnostics, and the staged asset policy passed on Windows. This is a CPU-side capture conversion test with synthetic pixels.

Coordination claim

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

AI-assisted with Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 14:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/2486) `andrewpozdnakov7-jpg:codex2/capture-uniform-grayscale` → `main` · +26 −1 · 1 files · 2 commits · open A flat single-channel target has no contrast to stretch. The capture code subtracts its minimum from every pixel, so a depth buffer cleared to a nonzero value appears black and the dump filename receives the `-black` suffix. This can make a nonzero target look empty during rendering diagnostics. Show a constant nonzero value as white in the grayscale dump. A zero target stays black and a varying target keeps its existing grayscale range. The same synthetic readback test produced `[0, 0, 0, 255]` for the constant D32_FLOAT input `0.25` on `940d32f`, then `[255, 255, 255, 255]` with the fix. The negative R32_FLOAT, zero-depth and varying-depth controls passed. All three capture tests, strict GPU Clippy with diagnostics, and the staged asset policy passed on Windows. This is a CPU-side capture conversion test with synthetic pixels. [Coordination claim](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Please retain the Git author when cherry-picking or rebasing. If you fold the change into another commit, please add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. AI-assisted with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:07:14 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 15:45 UTC · original

Independent local validation for PR #2486 (Windows, Rust 1.100.0/MSVC, head 7ab6e53, no game data): cargo test --locked -p victory-gpu --lib -> 143 tests passed, 0 failed, 2 ignored, exit 0. CPU-only regression run; synthetic capture path not replayed. AI-assisted (Hy4 flash). GPU/driver noted only for provenance (RTX 5060 Laptop, driver 621.24).

**@⁠cloph-dsp** on GitHub · 2026-11-25 15:45 UTC · [original](https://github.com/Marvisak/VIctory/pull/2486#issuecomment-7167293903) Independent local validation for PR #2486 (Windows, Rust 1.100.0/MSVC, head 7ab6e53, no game data): `cargo test --locked -p victory-gpu --lib` -> 143 tests passed, 0 failed, 2 ignored, exit 0. CPU-only regression run; synthetic capture path not replayed. AI-assisted (Hy4 flash). GPU/driver noted only for provenance (RTX 5060 Laptop, driver 621.24).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 15:56 UTC · original · edited 2026-11-26 03:25 UTC

Automated triage for the maintainers.

Verdict: merge candidate (unchanged). The new head is a merge of main. The PR diff is the same as before, still only crates/victory-gpu/src/capture.rs. In to_rgba, a grey target whose pixels all hold one finite nonzero value is shown white instead of stretching to black (and getting the -black suffix). Zero targets, varying targets and non-finite pixels are unchanged. The new unit test covers all four cases. It only affects diagnostic dumps.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 15:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2486#issuecomment-7167452703) · edited 2026-11-26 03:25 UTC <!-- victory-triage v1 head=7996a01103b49ae5eb990052f9f663f33f0d74ea verdict=merge-candidate at=2026-11-26T03:25:48Z --> Automated triage for the maintainers. **Verdict: merge candidate (unchanged).** The new head is a merge of `main`. The PR diff is the same as before, still only `crates/victory-gpu/src/capture.rs`. In `to_rgba`, a grey target whose pixels all hold one finite nonzero value is shown white instead of stretching to black (and getting the `-black` suffix). Zero targets, varying targets and non-finite pixels are unchanged. The new unit test covers all four cases. It only affects diagnostic dumps. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠catminou4 on GitHub · 2026-11-25 14:57 UTC · original · reviewed

Keep constant nonzero targets visible in captures. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.

**@⁠catminou4** on GitHub · 2026-11-25 14:57 UTC · [original](https://github.com/Marvisak/VIctory/pull/2486#pullrequestreview-6059998840) · **reviewed** Keep constant nonzero targets visible in captures. Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows-sys); not compiled or tested on this macOS arm64 host. rustc 1.98.1.
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 15:13 UTC · original · reviewed

Windows verification to go with the earlier macOS static review. VICTORY_D3D12_WARP=1 (WARP only, no hardware GPU touched). Tested commit 7ab6e539921f8147f91070dba8f2963edba5dac0 (clean detached checkout).

Note: the capture module is #[cfg(all(windows, feature = "diagnostics"))]. Without the feature, cargo test -p victory-gpu --lib capture compiles and runs 0 tests, so the new test only runs with --features diagnostics.

  • cargo test -p victory-gpu --locked --lib --features diagnostics capture — 3 passed, 0 failed, 0 ignored (includes constant_nonzero_grayscale_targets_do_not_look_black).
  • Mutation check: with flat_nonzero forced to false, the new test fails, so it guards the change.
  • cargo test -p victory-gpu --locked --lib — 143 passed, 0 failed, 2 ignored.
  • cargo test -p victory-gpu --locked --lib --features diagnostics — 147 passed, 0 failed, 2 ignored.

Code read: flat_nonzero = grey && low == high && low != 0.0 applies only to the grey formats (19..=22 | 39..=47 | 53..=65). Non-finite pixels still go through the old path. An all-non-finite target never satisfies low == high, because low stays f32::MAX and high stays f32::MIN. Constant-zero and varying targets are unchanged, and the test asserts both. A negative constant also renders white, which the test covers. One minor point: rustfmt --check reports diffs in capture.rs, but they are in lines this PR does not touch (e.g. listed()), so they are not caused by it. No problems found.

AI-assisted (Claude Code / Claude Sonnet 5.5)

**@⁠oni-swr** on GitHub · 2026-11-25 15:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2486#pullrequestreview-6060258398) · **reviewed** Windows verification to go with the earlier macOS static review. `VICTORY_D3D12_WARP=1` (WARP only, no hardware GPU touched). Tested commit `7ab6e539921f8147f91070dba8f2963edba5dac0` (clean detached checkout). Note: the `capture` module is `#[cfg(all(windows, feature = "diagnostics"))]`. Without the feature, `cargo test -p victory-gpu --lib capture` compiles and runs 0 tests, so the new test only runs with `--features diagnostics`. - `cargo test -p victory-gpu --locked --lib --features diagnostics capture` — 3 passed, 0 failed, 0 ignored (includes `constant_nonzero_grayscale_targets_do_not_look_black`). - Mutation check: with `flat_nonzero` forced to `false`, the new test fails, so it guards the change. - `cargo test -p victory-gpu --locked --lib` — 143 passed, 0 failed, 2 ignored. - `cargo test -p victory-gpu --locked --lib --features diagnostics` — 147 passed, 0 failed, 2 ignored. Code read: `flat_nonzero = grey && low == high && low != 0.0` applies only to the grey formats (`19..=22 | 39..=47 | 53..=65`). Non-finite pixels still go through the old path. An all-non-finite target never satisfies `low == high`, because `low` stays `f32::MAX` and `high` stays `f32::MIN`. Constant-zero and varying targets are unchanged, and the test asserts both. A negative constant also renders white, which the test covers. One minor point: `rustfmt --check` reports diffs in `capture.rs`, but they are in lines this PR does not touch (e.g. `listed()`), so they are not caused by it. No problems found. AI-assisted (Claude Code / Claude Sonnet 5.5)
Author
Owner

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

Verified locally merged onto origin/main (63bcca43) at PR head 7996a011 (Windows 11 x64, NVIDIA RTX 5090 + Microsoft WARP, VICTORY_D3D12_DEBUG=1):

  • crates/victory-gpu/src/capture.rs (to_rgba): adds flat_nonzero = grey && low == high && low != 0.0 and maps finite pixels to 255 instead of collapsing constant nonzero single-channel targets to black (matching the existing r32_integer_to_rgba convention). Keeping c.is_finite() preserves existing non-finite handling when mixed with a constant finite value, and all-non-finite/empty targets stay unaffected (low = f32::MAX, high = f32::MIN).
  • cargo xtask policy: 191 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): 0 warnings.
  • cargo test --locked -p victory-gpu --features diagnostics --lib capture::: 12/12 passed (including constant_nonzero_grayscale_targets_do_not_look_black).
  • Extra synthetic edge probe (not committed): verified [-0.0, -0.0] -> black, all-NaN -> black, all--Inf -> black, all-+Inf -> white, mixed [0.25, NaN, +Inf, -Inf] -> [white, black, white, black], constant subnormal f32::MIN_POSITIVE / 2.0 -> white, and empty 0x0 -> Some([]).
  • Verified clean co-merge with #2518 (both edit capture.rs): clippy (default and --all-features) clean, and all combined capture/GPU tests pass on both RTX 5090 and WARP (including constant negative signed R8 rendering white while zero stays black).

Synthetic tests only; looks ready to merge.

**@⁠fuzeofficlal** on GitHub · 2026-11-26 20:10 UTC · [original](https://github.com/Marvisak/VIctory/pull/2486#pullrequestreview-6079992092) · **approved these changes** Verified locally merged onto `origin/main` (`63bcca43`) at PR head `7996a011` (Windows 11 x64, NVIDIA RTX 5090 + Microsoft WARP, `VICTORY_D3D12_DEBUG=1`): - `crates/victory-gpu/src/capture.rs` (`to_rgba`): adds `flat_nonzero = grey && low == high && low != 0.0` and maps finite pixels to `255` instead of collapsing constant nonzero single-channel targets to black (matching the existing `r32_integer_to_rgba` convention). Keeping `c.is_finite()` preserves existing non-finite handling when mixed with a constant finite value, and all-non-finite/empty targets stay unaffected (`low = f32::MAX`, `high = f32::MIN`). - `cargo xtask policy`: 191 files ok. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): 0 warnings. - `cargo test --locked -p victory-gpu --features diagnostics --lib capture::`: 12/12 passed (including `constant_nonzero_grayscale_targets_do_not_look_black`). - Extra synthetic edge probe (not committed): verified `[-0.0, -0.0]` -> black, all-`NaN` -> black, all-`-Inf` -> black, all-`+Inf` -> white, mixed `[0.25, NaN, +Inf, -Inf]` -> `[white, black, white, black]`, constant subnormal `f32::MIN_POSITIVE / 2.0` -> white, and empty `0x0` -> `Some([])`. - Verified clean co-merge with `#2518` (both edit `capture.rs`): clippy (default and `--all-features`) clean, and all combined capture/GPU tests pass on both RTX 5090 and WARP (including constant negative signed R8 rendering white while zero stays black). Synthetic tests only; looks ready to merge.
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/2486/head:github-bot/gh-2486'
git switch 'github-bot/gh-2486'

Merge

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