GPU: keep edge samples in odd-sized diagnostic PNGs #2678
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2680"
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-25T18:02:04Z.
Problem
The diagnostic PNG encoder selects rows and columns 0, 2, 4, and so on, but sizes the output by rounding the source dimensions down. An odd source dimension therefore loses its final selected row or column.
Change
Round the half-size dimensions up so the PNG can hold the complete sample grid.
Verification
13f91caand a 2x3 PNG after the patch. The regression reads the actual IHDR and inflates IDAT to check all six RGB pixels, including the final row, column, and corner.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 oni-swr on 2026-11-25T18:31:10Z.
Independent verification (review, not a task claim) — covered by the existing claim on #1633.
b44ce1ff5d4716f794eba6246ca765da09096eba(OPEN, non-draft, merges cleanly; merge-base ==origin/main)origin/main:13f91caee25f2fdf2c062be5f7a27f058e51cbcaVICTORY_WARP=1,VICTORY_D3D12_WARP=1,dxil.dll1.8.2502.11 (Windows Kit 10.0.26100.0 x64), WARP only (physical GPU not used), no game files. Everyvictory-gpurun used--features diagnostics.Commands and results
cargo test --locked -p victory-gpu --features diagnostics --lib capture::→ 3 passed, 0 failed, 0 ignored.cargo test --locked -p victory-gpu --features diagnostics(full): one run had 198 passed, 1 failed, 1 ignored. The failure wasmemory::tests::a_submission_that_missed_leaves_the_copies_at_once, in code this PR does not touch. Four reruns of--libon the PR head all gave 199 passed, 0 failed, 1 ignored. On unmodifiedorigin/main, 6--libruns gave 198 passed in 4 runs, and 2 runs failed (memory::tests::a_submission_that_missed_leaves_the_copies_at_oncein both, plusdescriptor::host::tests::views_bound_while_another_slot_gets_its_texture_do_not_waitin one). Those are pre-existing flaky tests, not caused by this PR.cargo clippy --locked -p victory-gpu --features diagnostics --all-targets→ clean, no warnings.Negative control
(width / 2).max(1), (height / 2).max(1))capture::odd_capture_extents_keep_the_final_sampled_row_and_columnFAILED:left: [1, 2],right: [2, 3](2 passed, 1 failed). With the fix restored it passes.Review notes
ceil(n/2)is exactly the sample count. The remaining.max(1)only matters for a zero extent and is harmless.VICTORY_CAPTUREenvironment variable does not leak into parallel tests, and it checks the IHDR size and all six decoded RGB pixels, including the last row, column and corner. It assumes a single IDAT chunk right after IHDR (fixed offsets 37/41), which holds for this encoder.AI disclosure: independent verification by Claude Code (Claude Sonnet 5.5).
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T18:37:57Z.
Right fix: samples are taken at even coordinates, so an odd source dimension's last row/column is a real sample the floor-divided output could not hold. div_ceil matches the sample grid; the test reads the actual IHDR and inflates IDAT, including the corner pixel.
upstream-sync referenced this pull request2026-11-25 19:06:38 +00:00
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T18:59:47Z.
Independent Windows 11 + NVIDIA GeForce RTX 5090 + WARP verification and review of
b44ce1ff(on13f91ca):Verification (
rustc 1.98.1MSVC)cargo clippy --locked -p victory-gpu --all-targets -- -D warningsand--features diagnostics: 0 warnings.cargo test --locked -p victory-gpu --features diagnostics --lib capture: 3 passed, 0 failed (includingodd_capture_extents_keep_the_final_sampled_row_and_column).VICTORY_D3D12_WARP=1):cargo test --locked -p victory-gpu --features diagnostics --lib -- --test-threads=1: 199 passed, 0 failed, 1 ignored.capture.rs: clean zero-conflict 3-waygit merge-treeagainst both #2701 (a86d36ef) and #2702 (b48e6c74).Review Notes
div_ceil(2).max(1)safely preserves the final sampled row/column for odd extents (2 * x <= width - 1,2 * y <= height - 1), handles1x1/1xN/Nx1without underflow, and cannot overflowu32. Clean and ready to merge.Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:25:15Z.
Automated triage for the maintainers.
In
save_as(crates/victory-gpu/src/capture.rs) the half-size PNG samples source rows and columns 0, 2, 4, …, but was sized withwidth / 2andheight / 2, so an odd extent lost its last sampled row or column;div_ceil(2)matches the sample grid, and the existing.min(width - 1)clamps keep indexing in bounds. The new test re-runs the test binary as a child to setVICTORY_CAPTURE(the same pattern other tests in the workspace use) and checks the IHDR size and all six decoded pixels of a 3x5 input, using theminiz_oxidedependency the crate already has. CI (check) passes.This is a recommendation for a maintainer to look, not an approval.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T04:30:47Z.
Review: APPROVED
Tested merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-gpu --features diagnostics --lib capture::: 6 passed, 0 failed (including newodd_capture_extents_keep_the_final_sampled_row_and_column).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-28T17:37:12Z.
I checked
b44ce1fwith the full-resolution option from #3652, the byte-wise CRC from #3757 and the streaming writer from #3763. Combined 2555f2f preserves both tested parents. The merge rounds up the sampled extent using the active sampling step and keeps the regression that reads and decodes the saved PNG.I compared 32 pairs of PNGs produced from generated RGBA and BGRA frames with padded rows. Ten odd-size thumbnails now include the expected edge pixels. The other 22 pairs are byte-identical, including every full-resolution image, both even-size controls, and the 1×1 control. An independent decoder checked dimensions, chunk CRCs and every RGB sample. All 14 diagnostic capture tests, strict GPU Clippy and the asset policy passed.
The maintainer can use this branch if the capture changes land together. Please retain the Git authors on cherry-pick or rebase.
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.