GPU: saturate the texture byte accounting against a wild reported size #3933

Open
kotekompotek wants to merge 3 commits from upstream-pr/3933 into main
kotekompotek commented 2026-12-01 10:30:14 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-12-01T10:30:14Z.


Summary

  • GetResourceAllocationInfo can price a description unreasonably high; every sum over those bytes then risks wrapping in debug builds. Clamp the reported size at 1 TiB (and warn once with the dimensions).
  • Make the texture census and the eviction/give-up byte sums saturating so one wild entry cannot wrap the accounting.

Observed as two debug runs aborting inside Meter::frame/present on overflow panics; the title still ran with the accounting floored.

Test plan

  • cargo test -p victory-gpu resource — 20 tests green
  • Boot runs no longer abort on the byte sums

AI-assisted. Tested on GTX 1050 2GB, Windows 11.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5583831594 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3933). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-12-01T10:30:14Z. --- ## Summary - `GetResourceAllocationInfo` can price a description unreasonably high; every sum over those bytes then risks wrapping in debug builds. Clamp the reported size at 1 TiB (and warn once with the dimensions). - Make the texture census and the eviction/give-up byte sums saturating so one wild entry cannot wrap the accounting. Observed as two debug runs aborting inside `Meter::frame`/`present` on overflow panics; the title still ran with the accounting floored. #### Test plan - [x] `cargo test -p victory-gpu resource` — 20 tests green - [x] Boot runs no longer abort on the byte sums AI-assisted. Tested on GTX 1050 2GB, Windows 11.
passerbyyhx commented 2026-12-01 12:32:48 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by passerbyyhx on 2026-12-01T12:32:48Z.


On Windows at cc71d20d, the diagnostics build hits E0689 on the census accumulator. A controlled driver-quote harness for the PR's arithmetic confirmed the 1 TiB boundary and saturating sums in debug and release. Two oversized quotes emitted two warnings. The candidate explicitly types the accumulator and gates the diagnostic once, then passes all 18 native resource tests. Author-branch fix: https://github.com/kotekompotek/VIctory/pull/2.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7311289015 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3933#issuecomment-7311289015). Originally posted by [passerbyyhx](https://github.com/passerbyyhx) on 2026-12-01T12:32:48Z. --- On Windows at cc71d20d, the diagnostics build hits E0689 on the census accumulator. A controlled driver-quote harness for the PR's arithmetic confirmed the 1 TiB boundary and saturating sums in debug and release. Two oversized quotes emitted two warnings. The candidate explicitly types the accumulator and gates the diagnostic once, then passes all 18 native resource tests. Author-branch fix: https://github.com/kotekompotek/VIctory/pull/2.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3933:upstream-pr/3933'
git switch 'upstream-pr/3933'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/3933'
git switch 'upstream-pr/3933'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3933'
git switch 'upstream-pr/3933'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3933'
git switch 'main'
git merge --squash 'upstream-pr/3933'
git switch 'main'
git merge --ff-only 'upstream-pr/3933'
git switch 'main'
git merge 'upstream-pr/3933'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!3933
No description provided.