Preserve signed R16 contrast in PNG captures #892

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

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


PNG capture previews interpreted R16 SNORM and SINT samples as unsigned words, making negative RGB and RG channels appear bright and reversing the ordering of signed grayscale intensities. Read signed little-endian samples for the signed RGBA, RG, and single-channel formats. Color channels clamp negative samples to black, and grayscale maps the observed minimum and maximum in each capture to black and white. This adapts Marvisak/VIctory #2320. On Windows x64 with a Ryzen 7 5800X and Rust 1.98.1 MSVC, the six focused capture tests went from 3/6 on the base with the same fixtures to 6/6 on the candidate. They cover RGB, RG, two padded grayscale rows, and unsigned and depth controls. The asset policy check passed. The tests exercise synthetic CPU conversion to RGBA.

AI-assisted.

<!-- greyfinch-sync:fxceless/victory-fork:issue:6604062086 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/893). Originally posted by [DoubleD17](https://github.com/DoubleD17) on 2026-11-25T12:04:40Z. --- PNG capture previews interpreted R16 SNORM and SINT samples as unsigned words, making negative RGB and RG channels appear bright and reversing the ordering of signed grayscale intensities. Read signed little-endian samples for the signed RGBA, RG, and single-channel formats. Color channels clamp negative samples to black, and grayscale maps the observed minimum and maximum in each capture to black and white. This adapts [Marvisak/VIctory #2320](https://github.com/Marvisak/VIctory/pull/2320). On Windows x64 with a Ryzen 7 5800X and Rust 1.98.1 MSVC, the six focused capture tests went from 3/6 on the base with the same fixtures to 6/6 on the candidate. They cover RGB, RG, two padded grayscale rows, and unsigned and depth controls. The asset policy check passed. The tests exercise synthetic CPU conversion to RGBA. AI-assisted.
avt0m4t48 commented 2026-11-25 13:05:59 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by avt0m4t48 on 2026-11-25T12:19:56Z.


I independently verified the signed R16 capture change at 0846c2b against its parent f85101b and repeated the comparison on current main a253706 with the PR patch applied locally.

  • Five signed-format assertions failed on the parent and on unpatched main. All nine tests passed on the PR head and on patched main, using the same Linux CPU harness with the capture conversion and PNG writer taken from each revision.
  • Both signed grayscale formats (DXGI 58 and 59) produced monotonically increasing output over the full 65,536-value signed range, with padding between rows. Signed RGBA and RG checks covered negative channels, the shared positive peak, and padding.
  • I decoded the emitted 2×2 PNGs and checked their chunk CRCs. Both signed formats changed from row-major grayscale values [254, 255, 0, 0] to [0, 85, 170, 255]. The R16 UNORM and UINT control PNGs were byte-identical across revisions, and the R16 depth conversion control also passed.
  • Patched main passed cargo check --locked --offline -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --features diagnostics,blake3/pure with Rust 1.98.1.

The fixtures were synthetic. The Windows check covered cross-target compilation from Linux. Native Windows execution and D3D12 readback were outside this verification.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7162230201 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/893#issuecomment-7162230201). Originally posted by [avt0m4t48](https://github.com/avt0m4t48) on 2026-11-25T12:19:56Z. --- I independently verified the signed R16 capture change at `0846c2b` against its parent `f85101b` and repeated the comparison on current main `a253706` with the PR patch applied locally. - Five signed-format assertions failed on the parent and on unpatched main. All nine tests passed on the PR head and on patched main, using the same Linux CPU harness with the capture conversion and PNG writer taken from each revision. - Both signed grayscale formats (DXGI 58 and 59) produced monotonically increasing output over the full 65,536-value signed range, with padding between rows. Signed RGBA and RG checks covered negative channels, the shared positive peak, and padding. - I decoded the emitted 2×2 PNGs and checked their chunk CRCs. Both signed formats changed from row-major grayscale values `[254, 255, 0, 0]` to `[0, 85, 170, 255]`. The R16 UNORM and UINT control PNGs were byte-identical across revisions, and the R16 depth conversion control also passed. - Patched main passed `cargo check --locked --offline -p victory-gpu --all-targets --target x86_64-pc-windows-msvc --features diagnostics,blake3/pure` with Rust 1.98.1. The fixtures were synthetic. The Windows check covered cross-target compilation from Linux. Native Windows execution and D3D12 readback were outside this verification.
upstream-sync closed this pull request 2026-11-26 10:06:36 +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!892
No description provided.