GPU: skip zero-sized frame captures #488
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/488"
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 enzoduarte1 on 2026-11-24T03:58:28Z.
What
save_asin the frame-capture diagnostics computed the source row and pixel withheight as usize - 1andwidth as usize - 1. A zero-sized present underflowed (panic in debug, huge index in release) even though the code then clamped withmin.Zero-width or zero-height frames are now skipped: they have no pixels to sample, and the row slice can be empty. The clamping itself moved into a
source_coordhelper so its boundary behavior is testable without writing PNGs. Tests cover zero extent, normal clamping and the no-op on an empty frame.Tested
x86_64-pc-windows-gnu(no MSVC linker on this machine).cargo test -p victory-gpu --features diagnostics --lib: 46 passed, 1 ignored.cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean here; the pre-existinghost.rswarning fixed by PR #355 appears on a full rebuild and was allowed locally.git diff --check: clean.rustfmt --checkshows only unrelated pre-existing formatting in this file; the added lines match it.cargo xtask policy: 151 files ok. No game files or data taken from them were added.cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's/DELAYLOADflag, which MinGW rejects here; the same failure occurs on unmodifiedmain.Checklist
cargo fmt,cargo clippy --workspace --all-targetsandcargo test --workspacepass — see the toolchain limitations above; the changed crate is clean.cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).Imported from Marvisak/VIctory. Originally posted by DaviTostes on 2026-11-24T04:02:53Z.
Verified
62cf5ddon Arch Linux x86_64, Windows MSVC release build under Wine 11.22 (victory-gpu,--test-threads=1): 43 passed, 0 failed, 1 ignored.Not covered: a zero-sized capture actually requested at run time in the title (no game data here); the suite has no case for the capture path.
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T07:57:51Z.
Review: APPROVED
Tested
62cf5ddon Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (264 passed, 0 failed).height as usize - 1underflowed for a zero extent, which panics in debug before themin. Returning early for zero width or height and clamping withsaturating_subinsource_coordcovers it. The early return sits afterfolder(), so a capture that is off is still a no-op either way.No issues found.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:03:19Z.
Automated triage for the maintainers. Closing because it does not change behaviour the project needs (formatting, guards for cases that cannot occur, or notes and translations that cannot be kept current).
Guards the capture writer against a 0x0 frame, which cannot reach it: both callers pass the footprint of a live host texture (width and height >= 1). Its test's save(1, 0, 0, ..) returns at folder() before the new guard, so it tests nothing.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed