GPU: preserve wide float contrast in diagnostic captures #2653
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2655"
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 andrewpozdnakov7-jpg on 2026-11-25T17:38:58Z.
Problem
A diagnostic R32_FLOAT target can contain finite values at both ends of the float range. The grayscale span then overflows to infinity. Values with a finite numerator scale to zero, and the brightest values compute infinity divided by infinity and also become black.
Change
Halve the extrema and samples only when the span overflows. This keeps the ratios and reported statistics while bringing the span back into the f32 range.
Verification
13f91caand [0, 127, 191, 255] after the patch. The ordinary-range control produces [0, 127, 191, 255] in both versions.Coordination claim
AI-assisted (Codex 2). Please retain the Git author on cherry-pick or rebase. If folding this change into another commit, please retain Co-authored-by: andrewpozdnakov7-jpg [email protected].
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T17:54:17Z.
Reviewed: halving endpoints and samples when
high - lowoverflows to INF is a neat way to keep contrast without restructuring the normalizer, and logging the unscaled low keeps the report honest. Test covers the f32::MAX edge. CI green.Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T18:13:24Z.
Independent verification of head
ee109c3e8482aaa30d72049b8abac56bc77fd329onorigin/main13f91caee25f2fdf2c062be5f7a27f058e51cbca(merges cleanly, fast-forward).Environment: Windows 11 Pro 10.0.26100, WARP (d3d10warp 10.0.26100.9818) only, rustc/cargo 1.98.1 (per rust-toolchain.toml), DXC 1.8.2502.11 / dxil.dll 1.8.2502.11 (Windows SDK 10.0.26100.0 x64).
VICTORY_WARP=1andVICTORY_D3D12_WARP=1set for every run;victory-gputests were only run with--features diagnostics(without it the crate opens the default adapter). Limits: no physical GPU, no game files, no title-driven runs; this says nothing about behaviour on real hardware.... -p victory-gpu --features diagnostics grayscale_capture->capture::grayscale_capture_preserves_contrast_across_a_wide_float_range1 passed.origin/mainbaseline (cargo test -j 4 --locked -p victory-gpu --features diagnostics): 197 passed, 1 failed (memory::tests::a_submission_that_missed_leaves_the_copies_at_once,memory.rs:886), 1 ignored. That test passed in all four PR runs, so it looks flaky; I did not investigate it, and none of these PRs touchmemory.rs.if high - low == f32::INFINITY->if false) -> test fails for the-f32::MAX..f32::MAXcase: got all-black[0,0,0,255, 0,0,0,255, ...], wanted[0, 127, 191, 255]greys. Thef32::MAX/4case does not overflow and passes either way, so it acts as the non-overflow control.low/highstay the real values. No bugs found.AI disclosure: independent verification by Claude Code / Claude Sonnet 5.5, run for a user; no game files, dumps or hashes involved.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T22:19:08Z.
Automated triage for the maintainers.
Merge candidate (small, diagnostics only). In
to_rgba(crates/victory-gpu/src/capture.rs), when a grey target's finite spanhigh - lowoverflows f32 (for example a float target holding both -FLT_MAX and FLT_MAX, as a clear value can), the samples and both endpoints are halved so the ratios survive. Before this, the whole image came out black. I checked that infinities and NaN map as before, that the non-grey path cannot overflow (low is 0), and that the log line still reports the unscaled low. The regression test covers an overflowing and a non-overflowing range. It merges cleanly onto currentmain(it is based onf3578e3); CIcheck: passing.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T04:50:23Z.
Review: APPROVED
Tested merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-gpu --features diagnostics --lib capture::: 12 passed, 0 failed (including newgrayscale_capture_preserves_contrast_across_a_wide_float_range).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T09:15:17Z.
NVIDIA full-suite run, to go with the reports above by Dukestar69, oni-swr, since none of them names a GPU run. Tested exact head
61e9f8f(on its basef3578e3).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo 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: 863 passed, 0 failed, 10 ignored.grayscale_capture_preserves_contrast_across_a_wide_float_rangeonly builds with thediagnosticsfeature, so the run above doesn't include it; it passes incargo test -p victory-core -p victory-gpu -p victory-hle -p victory-loader -p victory-shader -p victory --lib --locked --features victory-core/diagnostics,victory-gpu/diagnostics,victory-hle/diagnostics,victory-loader/diagnostics,victory-shader/diagnostics,victory/diagnostics(same skips).--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#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_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T14:53:22Z.
Review: APPROVED
Reviewed
crates/victory-gpu/src/capture.rsat61e9f8f5merged ontoorigin/main(63bcca43) and verified on RTX 5090 and WARP (VICTORY_D3D12_WARP=1) withVICTORY_D3D12_DEBUG=1.capture.rs:717-731(strictly underdiagnostics), halvinglow,high, and finite samples only whenhigh - low == f32::INFINITYkeeps the span finite for wide-range signed float grayscale captures without altering non-grey targets (low == 0.0), all-non-finite images (high - low == -f32::INFINITY), or normal ranges, whilereported_lowpreserves the unscaled range in the log line.cargo run -p xtask -- policy: 191 files ok.cargo clippy -p victory-gpu --all-targets -- -D warnings(default and--all-features): clean.cargo test -p victory-gpu --lib --features diagnostics capture::: 12/12 passed on RTX 5090 + Debug Layer and 12/12 passed on WARP + Debug Layer (includinggrayscale_capture_preserves_contrast_across_a_wide_float_rangeatcapture.rs:777).NaN,±Inf, all-non-finite, asymmetric-f32::MAX..1e38, negative-only, all-zero, constant non-zero, tiny subnormal, andR16_FLOATinputs passed cleanly with no overflow or divide-by-zero.#2673(22/22capture+capture_difftests pass together on WARP + Debug Layer).View 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.