Preserve signed R8 contrast in PNG captures #2518

Open
github-bot wants to merge 1 commit from github-bot/gh-2518 into main AGit
Owner

@⁠DoubleD17 on GitHub · 2026-11-25 15:12 UTC · original
DoubleD17:fix/signed-r8-capture-contrast → main · +111 −4 · 1 files · 1 commits · open

The capture converter reads signed 8-bit DXGI channels as unsigned bytes, so a negative value can appear as a bright positive value. Decode the six signed SNORM and SINT formats in the RGBA8, RG8, and R8 families as i8 before applying the existing diagnostic scale. Negative color channels clamp to zero, and single-channel grayscale uses the observed signed minimum and maximum. Unsigned, sRGB, typeless, and alpha-only inputs retain their existing interpretation. Synthetic CPU tests on Windows x64 with Rust 1.98.1 MSVC and diagnostics passed 3 of 6 with the same fixtures on main 940d32f, then 6 of 6 on 26f1159. The tests check the RGBA bytes passed to the PNG encoder. A temporary combination with the signed R16 change in #2320 passed 8 of 8 capture tests after resolving adjacent textual conflicts. The default workspace CI test command runs without diagnostics; the focused capture test was performed locally.

AI-assisted.

**@⁠DoubleD17** on GitHub · 2026-11-25 15:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2518) `DoubleD17:fix/signed-r8-capture-contrast` → `main` · +111 −4 · 1 files · 1 commits · open The capture converter reads signed 8-bit DXGI channels as unsigned bytes, so a negative value can appear as a bright positive value. Decode the six signed SNORM and SINT formats in the RGBA8, RG8, and R8 families as `i8` before applying the existing diagnostic scale. Negative color channels clamp to zero, and single-channel grayscale uses the observed signed minimum and maximum. Unsigned, sRGB, typeless, and alpha-only inputs retain their existing interpretation. Synthetic CPU tests on Windows x64 with Rust 1.98.1 MSVC and `diagnostics` passed 3 of 6 with the same fixtures on main `940d32f`, then 6 of 6 on `26f1159`. The tests check the RGBA bytes passed to the PNG encoder. A temporary combination with [the signed R16 change in #2320](https://git.gtahub.st/github/Marvisak--VIctory/pulls/2320) passed 8 of 8 capture tests after resolving adjacent textual conflicts. The default workspace CI test command runs without `diagnostics`; the focused capture test was performed locally. AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:08:03 +00:00
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 16:13 UTC · original · edited 2026-11-25 16:45 UTC

Automated triage for the maintainers.

Merge candidate.

to_rgba in crates/victory-gpu/src/capture.rs now decodes the signed 8-bit DXGI formats as i8 before the existing scaling: 31/32 (R8G8B8A8 SNORM/SINT), 51/52 (R8G8) and 63/64 (R8). The unsigned, typeless, sRGB and A8 cases keep the byte path. The format numbers match DXGI. With main's scaling (colour from 0 using the 99th percentile of absolute values, grey from the observed min/max), negative colour clamps to black and signed grey uses its real range, which is what the new tests assert.

This only affects diagnostic PNG captures and does not change emulation. The tracing-subscriber test for the RGBA8 stats is more than strictly needed, but it is harmless. It complements #2320 (signed R16).

CI: check passing. CI builds without diagnostics, so the capture tests themselves were run only locally.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 16:13 UTC · [original](https://github.com/Marvisak/VIctory/pull/2518#issuecomment-7167703745) · edited 2026-11-25 16:45 UTC <!-- victory-triage v1 head=ff54044b1de400a7d9a8063a2e9ea0f38e759d59 verdict=merge-candidate at=2026-11-25T16:42:59Z --> Automated triage for the maintainers. **Merge candidate.** `to_rgba` in `crates/victory-gpu/src/capture.rs` now decodes the signed 8-bit DXGI formats as `i8` before the existing scaling: 31/32 (R8G8B8A8 SNORM/SINT), 51/52 (R8G8) and 63/64 (R8). The unsigned, typeless, sRGB and A8 cases keep the byte path. The format numbers match DXGI. With main's scaling (colour from 0 using the 99th percentile of absolute values, grey from the observed min/max), negative colour clamps to black and signed grey uses its real range, which is what the new tests assert. This only affects diagnostic PNG captures and does not change emulation. The tracing-subscriber test for the RGBA8 stats is more than strictly needed, but it is harmless. It complements #2320 (signed R16). CI: `check` passing. CI builds without `diagnostics`, so the capture tests themselves were run only locally. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 01:06 UTC · original

Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head ff54044 (on its base 67e8ae1).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 773 passed, 0 failed, 9 ignored.
  • signed_rgba8_clamps_negative_colour_and_keeps_alpha_opaque, signed_rg8_clamps_negative_colour, signed_r8_grayscale_uses_signed_extrema, unsigned_srgb_and_alpha_only_keep_their_byte_interpretation, unsigned_rgba8_logs_raw_channel_stats_excluding_row_padding only build with the diagnostics feature, so the run above doesn't include them; they pass in cargo test -p victory-gpu --lib --locked --features diagnostics (same skips).
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 01:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2518#issuecomment-7179433670) Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `ff54044` (on its base `67e8ae1`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **773 passed, 0 failed, 9 ignored**. - `signed_rgba8_clamps_negative_colour_and_keeps_alpha_opaque`, `signed_rg8_clamps_negative_colour`, `signed_r8_grayscale_uses_signed_extrema`, `unsigned_srgb_and_alpha_only_keep_their_byte_interpretation`, `unsigned_rgba8_logs_raw_channel_stats_excluding_row_padding` only build with the `diagnostics` feature, so the run above doesn't include them; they pass in `cargo test -p victory-gpu --lib --locked --features diagnostics` (same skips). - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
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 ff54044b (Windows 11 x64):

  • crates/victory-gpu/src/capture.rs (to_rgba): cleanly separates the six signed 8-bit DXGI formats (31..=32 RGBA8 SNORM/SINT, 51..=52 RG8 SNORM/SINT, 63..=64 R8 SNORM/SINT) to decode channels as i8, while preserving byte interpretation for unsigned/typeless/sRGB/A8 formats (27..=30, 48..=50, 60..=62 | 65). Negative color channels clamp to black with opaque alpha, and signed R8 grayscale maps observed signed extrema monotonically (-128, -1, 0, 127 -> 0, 127, 128, 255).
  • cargo xtask policy: 191 files ok.
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --all-features): 0 warnings.
  • Default build (cargo test --locked -p victory-gpu --lib capture): compiles cleanly.
  • Diagnostics build (--features diagnostics, capture::): 16/16 tests passed both sequentially (--test-threads=1) and across 20/20 consecutive parallel runs (--test-threads=8), confirming RGBA8_TRACE reliably guards the scoped subscriber test.
  • Extra synthetic edge probe (not committed): verified all-negative and all-zero RGBA8/RG8 inputs clamp cleanly to black without NaN/overflow, and signed R8 row-pitch padding (0x7f) does not skew extrema.
  • Verified clean co-merge with #2486 (both edit capture.rs), with clippy and all combined capture tests passing (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/2518#pullrequestreview-6079991960) · **approved these changes** Verified locally merged onto `origin/main` (`63bcca43`) at PR head `ff54044b` (Windows 11 x64): - `crates/victory-gpu/src/capture.rs` (`to_rgba`): cleanly separates the six signed 8-bit DXGI formats (`31..=32` RGBA8 SNORM/SINT, `51..=52` RG8 SNORM/SINT, `63..=64` R8 SNORM/SINT) to decode channels as `i8`, while preserving byte interpretation for unsigned/typeless/sRGB/A8 formats (`27..=30`, `48..=50`, `60..=62 | 65`). Negative color channels clamp to black with opaque alpha, and signed R8 grayscale maps observed signed extrema monotonically (`-128, -1, 0, 127` -> `0, 127, 128, 255`). - `cargo xtask policy`: 191 files ok. - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--all-features`): 0 warnings. - Default build (`cargo test --locked -p victory-gpu --lib capture`): compiles cleanly. - Diagnostics build (`--features diagnostics`, `capture::`): 16/16 tests passed both sequentially (`--test-threads=1`) and across 20/20 consecutive parallel runs (`--test-threads=8`), confirming `RGBA8_TRACE` reliably guards the scoped subscriber test. - Extra synthetic edge probe (not committed): verified all-negative and all-zero RGBA8/RG8 inputs clamp cleanly to black without NaN/overflow, and signed R8 row-pitch padding (`0x7f`) does not skew extrema. - Verified clean co-merge with `#2486` (both edit `capture.rs`), with clippy and all combined capture tests passing (including constant negative signed R8 rendering white while zero stays black). Synthetic tests only; looks ready to merge.
Author
Owner

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

LGTM — verified on Windows against origin/main (63bcca4).

  • Preserving signed R8 contrast in diagnostic PNG captures passes cleanly with both default and --features diagnostics builds.
  • cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1: all passed.
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default + --features diagnostics): 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 21:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/2518#pullrequestreview-6080513492) · **approved these changes** LGTM — verified on Windows against `origin/main` (`63bcca4`). - Preserving signed R8 contrast in diagnostic PNG captures passes cleanly with both default and `--features diagnostics` builds. - `cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1`: all passed. - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default + `--features diagnostics`): clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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/2518/head:github-bot/gh-2518'
git switch 'github-bot/gh-2518'

Merge

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