GPU: keep Staging::detile inside the staging buffer and harden committed() #1658
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1658
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1658/head"
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?
@HailLucifer666 on GitHub · 2026-11-24 20:33 UTC · original
HailLucifer666:fix/texture-staging-oob-and-committed-guard→main· +71 −10 · 1 files · 1 commits · merged 2026-11-25 00:14 UTCIssue:
Staging::detilebuildsfrom_raw_parts_mut(data + offset, pitch * rows * depth). Because D3D12GetCopyableFootprintsdoes not pad the final row of the final subresource toRowPitch(e.g., 4x4 RGBA8:total = 784whilepitch * rows = 1024), the slice extends past the mapped upload buffer allocation (UB / page-boundary fault).committed(at, len)computesp + lenunchecked (wraps toend < pin release and returnstrue) and checks onlyMEM_COMMIT, lettingPAGE_NOACCESS/PAGE_GUARDpages pass.Fix:
Staging.sizeunconditionally and clamp each subresource slice tosize - footprint.Offsetviasubresource_len().checked_add/saturating_addand rejectPAGE_NOACCESS | PAGE_GUARDincommitted().subresource_len_stays_inside_staging_totalandcommitted_rejects_overflow_and_noaccess_pages.Verification:
cargo clippy -p victory-gpu --all-targets --locked -- -D warnings(clean)cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings(clean)cargo test -p victory-gpu --locked(52 passed, 0 failed, 1 ignored)cargo test -p xtask --locked(4 passed, 0 failed)@acetonahard-code on GitHub · 2026-11-24 22:12 UTC · original
Heads-up: #1191 (opened earlier today,
Closes #935) fixes the same two things intexture.rs, thedetilespan past an unpadded last row and the overflow incommitted(), as part of a larger rewrite. The two conflict.Tested on Windows 11, RTX 4070 SUPER (driver 621.14), with the repo toolchain, merged into current
main(70564ae):cargo test -p victory-gpumainmain+ this PRmain,--all-featuresmain+ this PR,--all-featurescargo clippy --all-targets -- -D warnings, with and without--all-features: clean.cargo fmt --checkwould rewrap 3 blocks this PR adds (texture.rs).mainisn't rustfmt-clean either, so take it or leave it.victory-gputests fail on currentmainon this NVIDIA card:dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views. That's the 1,000,000-view heap cap, see #1744. They fail the same way with this PR, and no other test does.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.