Preserve signed R16 contrast in PNG captures #2318
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2320"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by DoubleD17 on 2026-11-25T10:35:43Z.
The diagnostic capture converter treated signed R16 texture channels as unsigned, which could turn negative components into bright pixels. Decode the six signed R16 SNORM and SINT DXGI formats as little-endian i16 and keep the existing display normalization. On Windows with Rust 1.98.1, the base with the regression fixtures passed 2 of 4 focused tests and this commit passed 4 of 4. The synthetic tests check the RGBA passed to the PNG encoder for signed color and grayscale, including an unsigned control.
AI-assisted.
Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T10:42:05Z.
Review: APPROVED
Verified against
origin/main(940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:i16semantics incapture::to_rgbaprevents negative components in signed 16-bit formats from wrapping/brightening while keeping unsigned formats unchanged.cargo test -p victory-gpu --features diagnostics capture::tests: 4/4 passed on RTX 5090, 4/4 passed on WARP (includingsigned_r16_colours_do_not_brighten_negative_componentsandsigned_r16_luma_keeps_negative_zero_and_positive_in_order).cargo clippy -p victory-gpu --features diagnostics --all-targets -- -D warnings: 0 warnings.cargo xtask policy: 183 files ok.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T10:54:06Z.
Review: COMMENTED
PNG captures decode signed R16/R16G16 as signed (i16) instead of unsigned — contrast preserved. 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. Capture/diagnostics only, safe.
Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-25T12:39:06Z.
Independent local validation (Windows, Rust 1.100.0/MSVC, head
49bcd08, no game data):cargo test --locked -p victory-gpu --lib --features diagnostics signed_r16-> 2 tests passed (signed_r16_colours_do_not_brighten_negative_components,signed_r16_luma_keeps_negative_zero_and_positive_in_order), exit 0. The same command on main940d32fmatches 0 tests, confirming the PR adds both. Note:mod captureis gated by#[cfg(all(windows, feature = "diagnostics"))]at crates/victory-gpu/src/lib.rs:21-22, so the--features diagnosticsflag is required; the plaincapture::filter matches nothing. Two pre-existingfetch_update/try_updatedeprecation warnings. I did not run a real title capture or verify the PNG output with game data. AI-assisted (Hy4 flash). GPU/driver: N/A (CPU unit tests with diagnostics feature). No game data, assets or extracted content used.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T15:17:37Z.
Automated triage for the maintainers.
Merge candidate (worth a look). In
capture.rsto_rgba, this decodes the signed 16-bit formats asi16instead ofu16: R16G16B16A16 SNORM/SINT (13, 14), R16G16 SNORM/SINT (37, 38) and R16 SNORM/SINT (58, 59). Negative components therefore no longer show up as bright pixels in diagnostic PNG captures. I checked the format ranges against the DXGI numbering, so the UNORM/UINT and D16 arms keep the unsigned path, and worked the new tests through the existing scaling (colour clamped at 0 and scaled by p99; grey scaled from min to max): the expected bytes match. CI: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T02:08:26Z.
Review: COMMENTED
Reviewed and verified against
main(63bcca43) on Windows 11 — clean fix and ready to merge:13..=14RGBA16SNORM/SINT,37..=38RG16SNORM/SINT,58..=59R16SNORM/SINT) ontoi16::from_le_bytesprevents negative components from wrapping to65535and blowing out highlights while keeping signed single-channel R16 ordered acrossi16::MIN..=i16::MAX.Local verification:
cargo test --locked -p victory-gpu --features diagnostics --lib capture::: 13/13 passed (including both new signed R16 tests)cargo clippy --all-targets -p victory-gpu -- -D warnings(default &--features diagnostics) +cargo xtask policy(191 files ok): 0 warningsView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.