GPU: a texture subresource in untracked memory is uploaded (#2638) #2689
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!2689
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2689/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?
@Calvix2k on GitHub · 2026-11-25 18:15 UTC · original
Calvix2k:codex/gpu-texture-untracked→main· +139 −1 · 1 files · 1 commits · closed without mergingFixes #2638.
Since
280b150the change tracker leaves untracked any 64 KiB page that touches memory other than the runtime's; such parts are copied whole at each use, and buffer copies follow it (shadow.rs,Tracked::untracked).Staging::refresh_nowasked onlytakefor changed pages, so sincecc5f961a subresource whose bytes lie only in untracked pages was never read and never uploaded: its host texture kept its initial zeros, even after the title wrote it.Read the untracked parts at every refresh too, and let the subresources lying in them through the touched filter. They are detiled and uploaded when their bytes change; only textures touching non-runtime memory pay the read.
The test places a two-mip 128x128 RGBA8 texture 48 KiB into a write-watched page that is followed by a plain one, so mip 1 lies wholly in the plain page. It is uploaded at the first refresh and again after a write; with only the changed pages it is never uploaded (checked by removing the fix).
Tests:
cargo test -p victory-gpu --features diagnostics --lib texture::(3 passed),cargo clippy -p victory-gpu --all-targets --features diagnosticsclean.@Calvix2k on GitHub · 2026-11-25 18:24 UTC · original
Duplicate of #2639, which takes exactly the approach the review asks for: untracked spans stay separate, select candidates for the per-subresource hash, and only tracked changed pages take the whole-page shortcut (plus the unchanged-refresh test). Closing this in its favour.
@oni-swr on GitHub · 2026-11-25 18:29 UTC · original
Independent verification (review, not a task claim) — covered by the existing claim on #1633.
183e974d0fbf1a64435096584016cc8d199686c2(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 texture::→ 3 passed, 0 failed, 0 ignored (repeated 3 more times, stable).cargo test --locked -p victory-gpu --features diagnostics(full crate) → lib 199 passed, 0 failed, 1 ignored; doc-tests 0.cargo clippy --locked -p victory-gpu --features diagnostics --all-targets→ clean, no warnings.Negative control
host()ortrack()is unavailable, so I confirmed it really runs: with the one-line fix reverted (ranges.extend(t.untracked(..))removed)a_subresource_lying_only_in_untracked_memory_is_uploadedFAILED with "the subresource wholly in untracked memory is uploaded" (2 passed, 1 failed). Restored, it passes again.Review notes
takeanduntrackedreturn disjoint ranges, and the latertouchedfilter only needs a range overlap, so adding the untracked ranges is safe. Hash-based change detection still keeps unchanged untracked subresources from being re-uploaded.refresh_nowstill returns early ont.clean()before the untracked ranges are read. A texture that has both tracked pages and untracked pages, with no tracked page changing, would not see a change in the untracked part until a tracked page changes. The test passes, so it does not hit this, and I have not tried to build such a case. It may be worth a follow-up or a comment.AI disclosure: independent verification by Claude Code (Claude Sonnet 5.5).
@kotekompotek on GitHub · 2026-11-25 18:38 UTC · original
Root cause matches the history: take() yields only changed tracked pages, so a subresource wholly inside pages the tracker declines (touching non-runtime memory) was never read. Extending with untracked() is the narrow fix - refresh still costs only for textures that actually touch such memory. The two-page fixture (watched + plain, mip 1 fully in the plain one) reproduces the exact geometry that slipped through, and the remove-the-fix check proves the test isn't vacuous.
Pull request closed