Capture: save packed R10G10B10A2 presentation frames #2825
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2827"
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-25T21:35:26Z.
The presenter already copies R10G10B10A2 textures into an UNORM swap chain, but the frame PNG path discards their readback. Decode the packed RGB fields while sampling pixels for the existing 8-bit PNG. UINT and TYPELESS use the displayed UNORM interpretation of the same packed colors. DXGI format documentation
The committed test encodes padded synthetic rows in-process through the same format selection and PNG encoder used by readback. It decodes the PNG and checks the dimensions and sampled RGB values for RGBA8, BGRA8, RGB10 UNORM, TYPELESS and UINT.
The original D3D12 fixture on inbox and Agility WARP produced the RGBA8 control PNG and skipped the 10-bit frame on the original base. With this change the same fixture produces the expected PNG for the control, the UNORM target and the TYPELESS target with an UNORM view. I reran the fixture on Agility WARP after the test refactor. Full GPU diagnostics passed (247 tests, one ignored), along with strict GPU Clippy in both builds and asset policy.
Coordination claim
AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T21:59:06Z.
Review: COMMENTED
Correct: R10G10B10A2 LE pixel unpacks R/G/B at shifts 0/10/20, the (c*255+511)/1023 rounding conversion is the standard 10->8 remap, alpha rightly dropped for RGB PNG. The PngPixel enum replaces the bgra bool cleanly and keeps the half-size read path identical. LGTM.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T22:47:30Z.
Verified
8e7fd059on Windows 11 (RTX 5090 + WARP) againstmain(f3578e3):cargo xtask policy(190 files ok),cargo clippy --locked -p victory-gpu --all-targets(default &--features diagnostics, 0 warnings).--features diagnostics):capture::tests3/3 passed (includingpacked_10_bit_frames_are_saved_as_rgb_pngs).R=[9:0],G=[19:10],B=[29:20]) and rounded scaling((c * 255 + 511) / 1023) as u8are exact (0->0,511->127,512->128,1023->255, max intermediate261,376), and switchingsave_read_back's mapped slice length tobuffer.GetDesc().Width as usizecleanly fixes the potential last-rowRowPitch * Heightover-read.Looks clean and ready to merge.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T02:22:47Z.
Automated triage for the maintainers.
Verdict: merge candidate. Re-reviewed at
ce361dc, which merges cleanly intomain. The test no longer starts a child process.packed_10_bit_frames_are_saved_as_rgb_pngsnow callsencode_rgb_pngon synthetic padded rows in-process and inflates the PNG to check the sampled pixels for five formats.PngPixel::for_present_formatincrates/victory-gpu/src/capture.rshandles the same R10G10B10A2 formats (TYPELESS/UNORM/UINT) thatswap_formatinhost.rscopies into a UNORM swap chain, and a comment now explains the UINT case. The 10-bit to 8-bit scaling rounds correctly. Sizing the mapped slice from the buffer's own width also avoids reading past the end on the last row.CI: passing. Recommending a look, not approving.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T02:33:50Z.
ce361dc replaces the self-spawned fixture with an in-process test of the production PNG encoder. The test decodes the resulting image for five source formats and checks the dimensions, pixel order, 10-bit rounding and padded-row sampling. The format selection documents the UNORM swap-chain interpretation for UINT sources.
The new regression passes. I also reran the original 4x2 D3D12 readback fixture privately on Agility WARP with this production code, and all three PNGs matched. Full GPU diagnostics passed (247 tests, one ignored), along with both strict Clippy builds and asset policy.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T03:33:37Z.
Review: APPROVED
Tested merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-gpu --features diagnostics --lib capture::tests: 6 passed, 0 failed (including newpacked_10_bit_frames_are_saved_as_rgb_pngs).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 andrewpozdnakov7-jpg on 2026-11-28T01:47:10Z.
I checked
ce361dcwith the resolved signed-capture branch from #3639, #2518 and #2320 on63bcca4. The conflict is limited to adjacent test insertions incapture.rs. The integration retains both test groups and all four exact PR commits. Integration branchc5b62abAll 21 capture tests passed in an isolated Rust harness compiled from the exact CPU conversion and PNG encoding functions. The packed test encodes and reads back the expected 2x2 RGB pixels for RGBA8, BGRA8 and all three RGB10 views, with padded source rows. The signed fixtures still pass for R8 and R16 colors and grayscale, including the aliased SNORM endpoints. This run covers generated rows through CPU conversion and encoding. The D3D12 readback path is covered by the original #2827 report. AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T07:07:15Z.
I combined #2827 at
ce361dcwith #3689 at9872963in 5a59b22. One PNG writer now samples RGBA8, BGRA8, packed 10-bit and FP16 pixels using their respective byte widths while retaining the same PNG dimensions and RGB layout.The two committed pixel tests passed. Seven isolated WARP runs then went through normal presentation and readback for RGBA8, BGRA8, both FP16 layouts and all three R10G10B10A2 formats. An independent decoder verified the dimensions, chunk CRCs and every sampled RGB value in both the black and colored frames from each run. Strict GPU Clippy and the asset policy passed.
A maintainer can use the tested resolution if both PRs land together.
Please retain the Git authors on cherry-pick or rebase, or add
Co-authored-by: andrewpozdnakov7-jpg <[email protected]>if folding this resolution into another commit.AI-assisted with OpenAI Codex.
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.