Preserve signed R8 contrast in PNG captures #994

Closed
DoubleD17 wants to merge 1 commit from upstream-pr/996 into main
DoubleD17 commented 2026-11-25 15:28:40 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by DoubleD17 on 2026-11-25T15:28:40Z.


The diagnostic capture converter reads signed 8-bit texture samples as unsigned, making negative color components appear bright and scrambling signed grayscale levels. Decode the signed RGBA8, RG8, and R8 SNORM and SINT formats as signed bytes and use the existing display scaling. This adapts Marvisak/VIctory #2518 to the fork's converter.

On Windows x64 with a Ryzen 7 5800X and Rust 1.98.1 MSVC, cargo test --offline --locked -p victory-gpu --features diagnostics --lib capture::tests:: passed 3/6 on fork main with the same fixtures and 6/6 on the tree of 6b3f314373128388989d56d492735757fc37de17. The cases check signed color, grayscale ordering, opaque alpha, and UINT, UNORM, sRGB, TYPELESS, and A8 controls. cargo xtask policy also passed. The synthetic CPU tests stop at the RGBA buffer passed to the PNG encoder.

AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6607967579 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/996). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-11-25T15:28:40Z. --- The diagnostic capture converter reads signed 8-bit texture samples as unsigned, making negative color components appear bright and scrambling signed grayscale levels. Decode the signed RGBA8, RG8, and R8 SNORM and SINT formats as signed bytes and use the existing display scaling. This adapts [Marvisak/VIctory #2518](https://github.com/Marvisak/VIctory/pull/2518) to the fork's converter. On Windows x64 with a Ryzen 7 5800X and Rust 1.98.1 MSVC, `cargo test --offline --locked -p victory-gpu --features diagnostics --lib capture::tests::` passed 3/6 on fork main with the same fixtures and 6/6 on the tree of `6b3f314373128388989d56d492735757fc37de17`. The cases check signed color, grayscale ordering, opaque alpha, and UINT, UNORM, sRGB, TYPELESS, and A8 controls. `cargo xtask policy` also passed. The synthetic CPU tests stop at the RGBA buffer passed to the PNG encoder. AI-assisted.
avt0m4t48 commented 2026-11-25 16:12:53 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T15:42:00Z.


I independently checked this against main 0b0074e0b2765e574c622e9a3de566f20f04135b and PR head 6b3f314373128388989d56d492735757fc37de17 using original synthetic pixel rows with padding. I ran the same six repository capture tests against both versions of the CPU functions. Main failed the three signed tests and passed all three controls. The PR head passed all six.

An independent integer reference compared all 34 rasters per revision, including PNG CRCs and decoded RGB pixels. For the six signed formats, main mismatched 10,240 of 12,288 RGBA pixels and 2,560 of 3,072 PNG pixels. The PR head matched every pixel. The two all-negative signed grayscale rasters matched on both revisions because grayscale normalization cancels the constant offset in that input range. All 22 unsigned control rasters were byte-identical between the revisions, including the encoded PNGs.

The GitHub test merge 3adb5dc9d62370e288fb6f9d53307e003c528ef7 has the same tree as the head. On Linux with Rust 1.98.1 it passed cargo check --offline --locked --target x86_64-pc-windows-msvc -p victory-gpu --all-targets --features diagnostics,blake3/pure, with an unrelated dead-code warning in indirect.rs. The fork's CI run reported action_required with zero jobs. My verification covered CPU conversion and encoding. Native Windows linking and execution and live D3D12 readback remain unverified by this check. No game files were used. Fork CI run

I also applied just the PR patch to the newer main 39731795d2d5117e6f90939273ee130428d28137. The converter was unchanged since the tested base, the patched converter was byte-identical to the PR head, and the same MSVC cross-target check passed there.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7167245223 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/996#issuecomment-7167245223). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T15:42:00Z. --- I independently checked this against main `0b0074e0b2765e574c622e9a3de566f20f04135b` and PR head `6b3f314373128388989d56d492735757fc37de17` using original synthetic pixel rows with padding. I ran the same six repository capture tests against both versions of the CPU functions. Main failed the three signed tests and passed all three controls. The PR head passed all six. An independent integer reference compared all 34 rasters per revision, including PNG CRCs and decoded RGB pixels. For the six signed formats, main mismatched **10,240 of 12,288 RGBA pixels** and **2,560 of 3,072 PNG pixels**. The PR head matched every pixel. The two all-negative signed grayscale rasters matched on both revisions because grayscale normalization cancels the constant offset in that input range. All 22 unsigned control rasters were byte-identical between the revisions, including the encoded PNGs. The GitHub test merge `3adb5dc9d62370e288fb6f9d53307e003c528ef7` has the same tree as the head. On Linux with Rust 1.98.1 it passed `cargo check --offline --locked --target x86_64-pc-windows-msvc -p victory-gpu --all-targets --features diagnostics,blake3/pure`, with an unrelated dead-code warning in `indirect.rs`. The fork's CI run reported `action_required` with zero jobs. My verification covered CPU conversion and encoding. Native Windows linking and execution and live D3D12 readback remain unverified by this check. No game files were used. [Fork CI run](https://github.com/fxceless/victory-fork/actions/runs/45645607399) I also applied just the PR patch to the newer main `39731795d2d5117e6f90939273ee130428d28137`. The converter was unchanged since the tested base, the patched converter was byte-identical to the PR head, and the same MSVC cross-target check passed there.
upstream-sync closed this pull request 2026-11-26 10:06:40 +00:00

Pull request closed

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
fxceless/victory-fork!994
No description provided.