GPU: preserve wide float contrast in diagnostic captures #2655
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2655
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-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?
@andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:38 UTC · original
andrewpozdnakov7-jpg:codex2/capture-wide-float-range→main· +24 −2 · 1 files · 2 commits · openProblem
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].
@kotekompotek on GitHub · 2026-11-25 17:54 UTC · original
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.@oni-swr on GitHub · 2026-11-25 18:13 UTC · original
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.
@Marvisak on GitHub · 2026-11-25 22:19 UTC · original
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
@Dukestar69 on GitHub · 2026-11-26 04:50 UTC · original · approved these changes
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).
@futurepro62 on GitHub · 2026-11-26 09:15 UTC · original
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
@fuzeofficlal on GitHub · 2026-11-26 14:53 UTC · original · approved these changes
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.