Preserve signed R8 contrast in PNG captures #2518
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!2518
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2518"
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?
@DoubleD17 on GitHub · 2026-11-25 15:12 UTC · original
DoubleD17:fix/signed-r8-capture-contrast→main· +111 −4 · 1 files · 1 commits · openThe capture converter reads signed 8-bit DXGI channels as unsigned bytes, so a negative value can appear as a bright positive value. Decode the six signed SNORM and SINT formats in the RGBA8, RG8, and R8 families as
i8before applying the existing diagnostic scale. Negative color channels clamp to zero, and single-channel grayscale uses the observed signed minimum and maximum. Unsigned, sRGB, typeless, and alpha-only inputs retain their existing interpretation. Synthetic CPU tests on Windows x64 with Rust 1.98.1 MSVC anddiagnosticspassed 3 of 6 with the same fixtures on main940d32f, then 6 of 6 on26f1159. The tests check the RGBA bytes passed to the PNG encoder. A temporary combination with the signed R16 change in #2320 passed 8 of 8 capture tests after resolving adjacent textual conflicts. The default workspace CI test command runs withoutdiagnostics; the focused capture test was performed locally.AI-assisted.
@Marvisak on GitHub · 2026-11-25 16:13 UTC · original · edited 2026-11-25 16:45 UTC
Automated triage for the maintainers.
Merge candidate.
to_rgbaincrates/victory-gpu/src/capture.rsnow decodes the signed 8-bit DXGI formats asi8before the existing scaling: 31/32 (R8G8B8A8 SNORM/SINT), 51/52 (R8G8) and 63/64 (R8). The unsigned, typeless, sRGB and A8 cases keep the byte path. The format numbers match DXGI. With main's scaling (colour from 0 using the 99th percentile of absolute values, grey from the observed min/max), negative colour clamps to black and signed grey uses its real range, which is what the new tests assert.This only affects diagnostic PNG captures and does not change emulation. The tracing-subscriber test for the RGBA8 stats is more than strictly needed, but it is harmless. It complements #2320 (signed R16).
CI:
checkpassing. CI builds withoutdiagnostics, so the capture tests themselves were run only locally.Generated by Claude Code
@futurepro62 on GitHub · 2026-11-26 01:06 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
ff54044(on its base67e8ae1).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: 773 passed, 0 failed, 9 ignored.signed_rgba8_clamps_negative_colour_and_keeps_alpha_opaque,signed_rg8_clamps_negative_colour,signed_r8_grayscale_uses_signed_extrema,unsigned_srgb_and_alpha_only_keep_their_byte_interpretation,unsigned_rgba8_logs_raw_channel_stats_excluding_row_paddingonly build with thediagnosticsfeature, so the run above doesn't include them; they pass incargo test -p victory-gpu --lib --locked --features 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 20:10 UTC · original · approved these changes
Verified locally merged onto
origin/main(63bcca43) at PR headff54044b(Windows 11 x64):crates/victory-gpu/src/capture.rs(to_rgba): cleanly separates the six signed 8-bit DXGI formats (31..=32RGBA8 SNORM/SINT,51..=52RG8 SNORM/SINT,63..=64R8 SNORM/SINT) to decode channels asi8, while preserving byte interpretation for unsigned/typeless/sRGB/A8 formats (27..=30,48..=50,60..=62 | 65). Negative color channels clamp to black with opaque alpha, and signed R8 grayscale maps observed signed extrema monotonically (-128, -1, 0, 127->0, 127, 128, 255).cargo xtask policy: 191 files ok.cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default and--all-features): 0 warnings.cargo test --locked -p victory-gpu --lib capture): compiles cleanly.--features diagnostics,capture::): 16/16 tests passed both sequentially (--test-threads=1) and across 20/20 consecutive parallel runs (--test-threads=8), confirmingRGBA8_TRACEreliably guards the scoped subscriber test.0x7f) does not skew extrema.#2486(both editcapture.rs), with clippy and all combined capture tests passing (including constant negative signed R8 rendering white while zero stays black).Synthetic tests only; looks ready to merge.
@Dukestar69 on GitHub · 2026-11-26 21:11 UTC · original · approved these changes
LGTM — verified on Windows against
origin/main(63bcca4).--features diagnosticsbuilds.cargo test -p victory-gpu --lib --features diagnostics capture:: -- --test-threads=1: all passed.cargo clippy -p victory-gpu --all-targets -- -D warnings(default +--features diagnostics): clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.