GPU: skip zero-sized frame captures #488

Closed
github-bot wants to merge 1 commit from gh-pr/488/head into gh-pr/488/base
Owner

@⁠enzoduarte1 on GitHub · 2026-11-24 03:58 UTC · original
enzoduarte1:gpu/capture-zero-extent → main · +22 −2 · 1 files · 1 commits · closed without merging

What

save_as in the frame-capture diagnostics computed the source row and pixel with height as usize - 1 and width as usize - 1. A zero-sized present underflowed (panic in debug, huge index in release) even though the code then clamped with min.

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_coord helper so its boundary behavior is testable without writing PNGs. Tests cover zero extent, normal clamping and the no-op on an empty frame.

Tested

  • Windows 11, Rust 1.98.1, 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-existing host.rs warning fixed by PR #355 appears on a full rebuild and was allowed locally.
  • git diff --check: clean. rustfmt --check shows 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.
  • Not tested: cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's /DELAYLOAD flag, which MinGW rejects here; the same failure occurs on unmodified main.

Checklist

  • cargo fmt, cargo clippy --workspace --all-targets and cargo test --workspace pass — see the toolchain limitations above; the changed crate is clean.
  • cargo xtask policy passes. The change adds no game files or data taken from them (docs/asset-policy.md).
  • If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
**@⁠enzoduarte1** on GitHub · 2026-11-24 03:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/488) `enzoduarte1:gpu/capture-zero-extent` → `main` · +22 −2 · 1 files · 1 commits · closed without merging ## What `save_as` in the frame-capture diagnostics computed the source row and pixel with `height as usize - 1` and `width as usize - 1`. A zero-sized present underflowed (panic in debug, huge index in release) even though the code then clamped with `min`. 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_coord` helper so its boundary behavior is testable without writing PNGs. Tests cover zero extent, normal clamping and the no-op on an empty frame. ## Tested - Windows 11, Rust 1.98.1, `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-existing `host.rs` warning fixed by PR #355 appears on a full rebuild and was allowed locally. - `git diff --check`: clean. `rustfmt --check` shows 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. - Not tested: `cargo test -p victory-loader --test load_probe`. Its fixture passes MSVC's `/DELAYLOAD` flag, which MinGW rejects here; the same failure occurs on unmodified `main`. ## Checklist - [ ] `cargo fmt`, `cargo clippy --workspace --all-targets` and `cargo test --workspace` pass — see the toolchain limitations above; the changed crate is clean. - [x] `cargo xtask policy` passes. The change adds no game files or data taken from them (`docs/asset-policy.md`). - [x] If an AI tool wrote part of this change, the description says so: an AI tool assisted with the code and test; I reviewed and ran them.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:05:53 +00:00
github-bot closed this pull request 2026-11-26 04:05:53 +00:00
Author
Owner

@⁠DaviTostes on GitHub · 2026-11-24 04:02 UTC · original

Verified 62cf5dd on 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.

**@⁠DaviTostes** on GitHub · 2026-11-24 04:02 UTC · [original](https://github.com/Marvisak/VIctory/pull/488#issuecomment-7121657840) Verified `62cf5dd` on **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.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:03 UTC · original

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.

**@⁠Marvisak** on GitHub · 2026-11-25 00:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/488#issuecomment-7148087094) 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

This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!488
No description provided.