GPU capture: decode signed R8 and R16 targets #3639
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3639"
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-28T01:24:44Z.
Signed one-channel render targets are decoded as unsigned words when producing a grayscale diagnostic image. This reverses contrast near zero and can make a negative pixel look like a bright positive one.
Decode
R8_SINTandR16_SINTas signed integers. DecodeR8_SNORMandR16_SNORMin[-1, 1], including the two negative endpoint encodings that both map to-1. The grayscale scaling and row-pitch handling stay in the existing path.The two new tests fail on main at
63bcca43and pass with the fix. The tests use generated rows with padding to check negative, zero and positive values in each format, and compare the lowest two SINT and SNORM encodings.DXGI format definitions. Claimed in #1633.
AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T01:25:03Z.
Verified main
63bcca43c6a00a758510398fa43096ce7e4f7df0and this heade0b5e8f7fbbea890f9a41ec95242305444e6c6e1with the same two generated-pixel tests. Both tests fail on main. The PR passed all 13 capture tests, strict all-features GPU Clippy, and the asset policy check (191 files).For padded rows with components
-2, 0, +2, all four signed R8/R16 formats now give the grayscale levels0, 127, 255. The two lowest SNORM encodings give the same level. Their SINT counterparts remain distinct. This ran through the capture decoder with generated rows and did not depend on game or driver output.Please preserve the Git author if cherry-picking or rebasing, or include this trailer if folding the change into another commit.
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T01:43:52Z.
#2518 and #2320 already cover the signed 8-bit and 16-bit color families, including two- and four-component targets. I resolved their overlaps with
e0b5e8fon63bcca4, keeping those color paths and #3639's single-channel SNORM endpoint handling. The branch preserves all three PR heads. Integration branchfd4476fThe two most-negative codes represent the same normalized value in SNORM. They remain distinct in SINT. I split #2518's grayscale ramp expectations accordingly. With inputs
80 ff 00 7f, the resulting 8-bit levels are0, 126, 127, 255for R8_SNORM and0, 127, 128, 255for R8_SINT. Direct3D SNORM conversionI compiled the unmodified CPU conversion functions from each revision in a small Rust test harness, with the same 20 capture fixtures in both runs. Main failed the seven signed-format checks. All 20 passed on the integration, including row padding and the unsigned/HDR/R32 controls. This covers CPU conversion from generated rows to RGBA. The full GPU crate was outside the run. AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-28T02:48:17Z.
Review: APPROVED
LGTM — verified on Windows:
cargo test -p victory-gpu --features diagnostics --lib capture::passed (13/13, includingsigned_grayscale_targets_keep_the_order_across_zero)cargo clippy -p victory-gpu --all-targets -- -D warningsand--features diagnostics --all-targets -- -D warningsboth passed with 0 warningscargo xtask policypassed (191 files ok)Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T06:44:53Z.
I added a paired signed/unsigned control for the two single-channel SINT formats. Each test passes the same bytes and pitch through both views of a generated 2×2 target, so it checks that the change restores signed order while keeping the unsigned output.
main(63bcca4)e0b5e8f)Both tests fail their signed assertion on
mainand pass on #3639. The unsigned expectations pass on both. On the PR head with the two tests, all 15 capture tests, strict GPU Clippy and the asset policy passed.Test-only branch
Please retain the Git author if you cherry-pick or rebase the tests. If you fold them into another commit, please retain the trailer below.
Co-authored-by: andrewpozdnakov7-jpg [email protected]
AI-assisted with OpenAI Codex.
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-29T21:15:55Z.
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
e0b5e8f(on its base63bcca4).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: 866 passed, 0 failed, 10 ignored.signed_grayscale_targets_keep_the_order_across_zero,signed_normalized_targets_alias_the_two_negative_endpointsonly build with thediagnosticsfeature, so the run above doesn't include them; they pass 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 passerbyyhx on 2026-11-30T23:21:04Z.
Added a GPU-to-PNG comparison on
e0b5e8f7fbbea890f9a41ec95242305444e6c6e1. On RTX 4090 Laptop and WARP, four typed R8/R16 SINT/SNORM textures were written and copied back at a real 256-byte row pitch. The original texel bytes matched between the head and base. An independent decoder then checked all rows of the 16 PNGs produced by the capture code (two devices × two revisions × four formats). On the head both SINT formats produced first-row grayscale0,127,255,191; both SNORM formats produced0,0,127,255, including the two negative endpoints.For this GPU fixture both revisions had the same local mapping-length adjustment to account for the final row's omitted trailing padding. Pixel decoding, sampling and PNG encoding were unchanged by that adjustment.
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.