GPU: sample packed 10-bit frames for black-frame diagnostics #2960

Open
andrewpozdnakov7-jpg wants to merge 1 commit from upstream-pr/2962 into main
andrewpozdnakov7-jpg commented 2026-11-26 01:38:59 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T01:38:59Z.


The presenter already accepts the R10G10B10A2 family for its UNORM swap chain. The black-frame probe only sampled 8-bit color, so a black 10-bit frame was reported as nonblack.

Sample the existing pixel grid for all three R10G10B10A2 formats. Read the three packed RGB fields and round the maximum to the existing 8-bit diagnostic scale. Alpha is ignored and the warning threshold stays at 8. This composes cleanly with #2827 (PNG export) and #2837 (warning state).

On Windows/WARP, the same test presents opaque black, near-black red, just-above-threshold green, and bright blue through Host::present. At main 63bcca43c6a00a758510398fa43096ce7e4f7df0, all three 10-bit textures report four nonblack frames. On this patch, UNORM, TYPELESS with an UNORM view, and UINT all report [black, black, nonblack, nonblack]. The RGBA8 control reports this sequence before and after. Six paired runs, full GPU diagnostics suite (247 passed, 1 ignored), strict GPU Clippy with and without diagnostics, and asset policy passed.

AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5502368442 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T01:38:59Z. --- The presenter already accepts the R10G10B10A2 family for its UNORM swap chain. The black-frame probe only sampled 8-bit color, so a black 10-bit frame was reported as nonblack. Sample the existing pixel grid for all three R10G10B10A2 formats. Read the three packed RGB fields and round the maximum to the existing 8-bit diagnostic scale. Alpha is ignored and the warning threshold stays at 8. This composes cleanly with #2827 (PNG export) and #2837 (warning state). On Windows/WARP, the same test presents opaque black, near-black red, just-above-threshold green, and bright blue through `Host::present`. At main `63bcca43c6a00a758510398fa43096ce7e4f7df0`, all three 10-bit textures report four nonblack frames. On this patch, UNORM, TYPELESS with an UNORM view, and UINT all report `[black, black, nonblack, nonblack]`. The RGBA8 control reports this sequence before and after. Six paired runs, full GPU diagnostics suite (247 passed, 1 ignored), strict GPU Clippy with and without diagnostics, and asset policy passed. AI-assisted.
fuzeofficlal commented 2026-11-26 01:55:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:55:48Z.

Review: COMMENTED


Reviewed and verified against main (63bcca43) on Windows 11 (RTX 5090 + WARP, --features diagnostics, VICTORY_D3D12_DEBUG=1) — clean and ready to merge:

  • Properly feature-gated under diagnostics (zero impact on default builds).
  • capture.rs:789-798, 891-896 adds BlackProbe { buffer, packed_rgb10 } supporting DXGI_FORMAT_R10G10B10A2_{TYPELESS,UNORM,UINT}, unpacking the three 10-bit RGB channels and scaling ((max * 255 + 511) / 1023) as u8 against the < 8 black threshold while ignoring 2-bit alpha. (Non-blocking note: capture.rs:659's full-frame dump also handles format 89 XR_BIAS, which isn't included here.)

Local verification:

  • packed_10_bit_frames_are_sampled_for_black_detection: passed on both RTX 5090 and WARP (--features diagnostics, VICTORY_D3D12_DEBUG=1)
  • cargo clippy -p victory-gpu --all-targets (default & --features diagnostics) + cargo xtask policy (191 files ok): 0 warnings
<!-- greyfinch-sync:Marvisak/VIctory:review:6067525447 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962#pullrequestreview-6067525447). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T01:55:48Z. **Review:** COMMENTED --- Reviewed and verified against `main` (`63bcca43`) on Windows 11 (RTX 5090 + WARP, `--features diagnostics`, `VICTORY_D3D12_DEBUG=1`) — clean and ready to merge: - Properly feature-gated under `diagnostics` (zero impact on default builds). - `capture.rs:789-798, 891-896` adds `BlackProbe { buffer, packed_rgb10 }` supporting `DXGI_FORMAT_R10G10B10A2_{TYPELESS,UNORM,UINT}`, unpacking the three 10-bit RGB channels and scaling `((max * 255 + 511) / 1023) as u8` against the `< 8` black threshold while ignoring 2-bit alpha. *(Non-blocking note: `capture.rs:659`'s full-frame dump also handles format `89` `XR_BIAS`, which isn't included here.)* **Local verification**: - `packed_10_bit_frames_are_sampled_for_black_detection`: passed on both **RTX 5090** and **WARP** (`--features diagnostics`, `VICTORY_D3D12_DEBUG=1`) - `cargo clippy -p victory-gpu --all-targets` (default & `--features diagnostics`) + `cargo xtask policy` (`191 files ok`): 0 warnings
kotekompotek commented 2026-11-26 02:25:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T02:25:20Z.

Review: COMMENTED


Verified: the probe only handled 8-bit formats, so R10G10B10A2 back buffers never got black-frame detection. The fix is right on both axes — TYPELESS is viewed as UNORM for the copy footprint (legal since the buffer footprint just names texel layout), and the 10-bit channels are unpacked and rescaled to the existing 8-bit scale with alpha ignored. The hardware test covers all four format/view combos including the UINT path.

<!-- greyfinch-sync:Marvisak/VIctory:review:6067737934 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962#pullrequestreview-6067737934). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T02:25:20Z. **Review:** COMMENTED --- Verified: the probe only handled 8-bit formats, so R10G10B10A2 back buffers never got black-frame detection. The fix is right on both axes — TYPELESS is viewed as UNORM for the copy footprint (legal since the buffer footprint just names texel layout), and the 10-bit channels are unpacked and rescaled to the existing 8-bit scale with alpha ignored. The hardware test covers all four format/view combos including the UINT path.
steven-seagull27 commented 2026-11-26 03:05:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by steven-seagull27 on 2026-11-26T02:15:52Z.


Tested this head (895fc15) together with #2827 (8e7fd05) on RTX 5080, driver 621.40, and WARP. I resolved each D3D12 device LUID through DXGI. For every 64×64 rendered texture I saved both its source-format readback and the hidden swap-chain back buffer through the production PNG writer, then decoded both PNGs independently with Pillow.

Rendered RGB10 input 8-bit RGB in PNG Diagnostic result on both adapters
Uniform red 30, alpha 0 or 3 (7, 0, 0) level 7, black
Uniform green 31 (0, 8, 0) level 8, nonblack
Uniform blue 30 / 31 (0, 0, 7) / (0, 0, 8) black / nonblack
One red-31 pixel at (24,40); remainder black one (8,0,0) at PNG (12,20) level 8, nonblack
One blue-1023 pixel at (34,34); remainder black one (0,0,255) at PNG (17,17) level 0, black

That last pixel falls between the 4×4 probe locations: the PNG sees it and the probe correctly does not. The same results held for UNORM, TYPELESS with an UNORM RTV, and UINT. A separate 32×32 tile ramp exercised every code 0–1023 in each RGB channel and all four A2 values; all decoded pixels matched the reference, and the diagnostic level matched the brightest sampled channel (246).

Per adapter this covered 24 RGB10 presents, 48 decoded PNGs and 49,152 checked RGB pixels, plus six interleaved FP16 presents. Windows build 26300.10075, local synthetic fixture, no game images. Tested with Codex assistance.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180625591 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962#issuecomment-7180625591). Originally posted by [steven-seagull27](https://github.com/steven-seagull27) on 2026-11-26T02:15:52Z. --- Tested this head (`895fc15`) together with #2827 (`8e7fd05`) on **RTX 5080, driver 621.40**, and **WARP**. I resolved each D3D12 device LUID through DXGI. For every 64×64 rendered texture I saved both its source-format readback and the hidden swap-chain back buffer through the production PNG writer, then decoded both PNGs independently with Pillow. | Rendered RGB10 input | 8-bit RGB in PNG | Diagnostic result on both adapters | |---|---|---| | Uniform red 30, alpha 0 or 3 | (7, 0, 0) | level 7, black | | Uniform green 31 | (0, 8, 0) | level 8, nonblack | | Uniform blue 30 / 31 | (0, 0, 7) / (0, 0, 8) | black / nonblack | | One red-31 pixel at (24,40); remainder black | one (8,0,0) at PNG (12,20) | level 8, nonblack | | One blue-1023 pixel at (34,34); remainder black | one (0,0,255) at PNG (17,17) | level 0, black | That last pixel falls between the 4×4 probe locations: the PNG sees it and the probe correctly does not. The same results held for UNORM, TYPELESS with an UNORM RTV, and UINT. A separate 32×32 tile ramp exercised **every code 0–1023 in each RGB channel** and all four A2 values; all decoded pixels matched the reference, and the diagnostic level matched the brightest sampled channel (246). Per adapter this covered 24 RGB10 presents, 48 decoded PNGs and 49,152 checked RGB pixels, plus six interleaved FP16 presents. Windows build 26300.10075, local synthetic fixture, no game images. Tested with Codex assistance.
Marvisak commented 2026-11-26 06:03:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T05:39:53Z.


Automated triage for the maintainers.

Merge candidate. capture::probe (crates/victory-gpu/src/capture.rs) only accepted 8-bit RGBA/BGRA formats. Main does present R10G10B10A2 frames (swap_format in host.rs maps formats 23..=25 to an R10G10B10A2_UNORM swap chain), and for those the probe returned None, so present never reported a black frame. The PR adds the three R10G10B10A2 formats, copies a typeless source through a UNORM footprint, and in capture::black scales the largest of the three 10-bit channels to the existing 8-bit threshold, ignoring alpha. UINT sources hold the same raw 10-bit values, so the same scale applies. packed_10_bit_frames_are_sampled_for_black_detection (host.rs) clears real render targets just below and at the threshold for each format. The change is diagnostics-only. It complements, and does not duplicate, the same author's #2827 (PNG capture of these frames).

CI: passing (check).

Recommending a look, not approving.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7183692393 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962#issuecomment-7183692393). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T05:39:53Z. --- <!-- victory-triage v1 head=895fc15e93e014be7547d8aaab28d46401f6dfd0 verdict=merge-candidate at=2026-11-26T05:39:43Z --> Automated triage for the maintainers. **Merge candidate.** `capture::probe` (`crates/victory-gpu/src/capture.rs`) only accepted 8-bit RGBA/BGRA formats. Main does present R10G10B10A2 frames (`swap_format` in `host.rs` maps formats 23..=25 to an `R10G10B10A2_UNORM` swap chain), and for those the probe returned `None`, so `present` never reported a black frame. The PR adds the three R10G10B10A2 formats, copies a typeless source through a UNORM footprint, and in `capture::black` scales the largest of the three 10-bit channels to the existing 8-bit threshold, ignoring alpha. UINT sources hold the same raw 10-bit values, so the same scale applies. `packed_10_bit_frames_are_sampled_for_black_detection` (`host.rs`) clears real render targets just below and at the threshold for each format. The change is diagnostics-only. It complements, and does not duplicate, the same author's #2827 (PNG capture of these frames). CI: passing (`check`). Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Dukestar69 commented 2026-11-26 07:10:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T07:10:36Z.

Review: APPROVED


Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP):

  • cargo test -p victory-gpu --features diagnostics capture:: -- --test-threads=1 (RTX 5090 & WARP): all tests passed on both.
  • cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

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

<!-- greyfinch-sync:Marvisak/VIctory:review:6069874617 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962#pullrequestreview-6069874617). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T07:10:36Z. **Review:** APPROVED --- Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090 + WARP): - `cargo test -p victory-gpu --features diagnostics capture:: -- --test-threads=1` (RTX 5090 & WARP): all tests passed on both. - `cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
andrewpozdnakov7-jpg commented 2026-11-28 06:56:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T06:56:29Z.


I combined #2962 at 895fc15 with #3687 at 3e91c42 in 0e426a2. Both changes touch the black-frame probe. The resolution uses the copy format to choose how to read RGB, keeping the same 8-bit level scale for all three encodings.

Six isolated WARP runs covered RGBA8, FP16 and its typeless family, and all three R10G10B10A2 formats. Each run used the normal presentation path and produced [black, black, nonblack, nonblack] for opaque black, near-black red, green at level 8 and bright blue. The separate conversion unit test, strict GPU Clippy and the asset policy passed.

A maintainer can use this resolution if both PRs land together.

Please retain the Git authors on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding this resolution into another commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7235613496 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2962#issuecomment-7235613496). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T06:56:29Z. --- I combined #2962 at `895fc15` with #3687 at `3e91c42` in [0e426a2](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/0e426a20e218b7dec5625c9bb814bf8753c68ef0). Both changes touch the black-frame probe. The resolution uses the copy format to choose how to read RGB, keeping the same 8-bit level scale for all three encodings. Six isolated WARP runs covered RGBA8, FP16 and its typeless family, and all three R10G10B10A2 formats. Each run used the normal presentation path and produced `[black, black, nonblack, nonblack]` for opaque black, near-black red, green at level 8 and bright blue. The separate conversion unit test, strict GPU Clippy and the asset policy passed. A maintainer can use this resolution if both PRs land together. Please retain the Git authors on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding this resolution into another commit. AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/2962:upstream-pr/2962'
git switch 'upstream-pr/2962'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/2962'
git switch 'upstream-pr/2962'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/2962'
git switch 'upstream-pr/2962'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/2962'
git switch 'main'
git merge --squash 'upstream-pr/2962'
git switch 'main'
git merge --ff-only 'upstream-pr/2962'
git switch 'main'
git merge 'upstream-pr/2962'
git push origin 'main'
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!2960
No description provided.