GPU: texture bytes off the runtime's memory are read at each refresh, as buffer copies' are (#2638) #2639
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!2639
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2639"
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?
@BastienRodz on GitHub · 2026-11-25 17:23 UTC · original
BastienRodz:gpu/texture-untracked-mips→main· +46 −2 · 2 files · 1 commits · openWhat's wrong
A tracker leaves pages that touch non-runtime memory untracked, and per
280b150andwatch.rssuch parts are "copied whole at each use".Staging::refresh_nowasks onlyTracked::takefor changed pages, and sincecc5f961it detiles only the subresources those pages touch:A subresource lying wholly in untracked pages is never touched, so it is never uploaded, not even the first time. Before
cc5f961, the first refresh read the whole texture. Buffer copies already read untracked parts at each use.What the fix does
The refresh also takes
t.untracked(start, start + size)as candidate ranges, and returns early only when both lists are empty. Subresources found there go through the existing per-subresource hash, so they are uploaded when their bytes change, as a subresource in a page shared with other data is. The whole-changed-page shortcut still uses tracked pages only, and fully tracked textures are unchanged.Tests
New
draw::tests::a_mip_off_the_runtimes_memory_is_uploaded: a two-mip linear texture whose mip 0 fills plain committed memory after a reserved page. Both mips must be uploaded at first, and mip 0 again after the title writes it. It needs a host device but no HLSL.main(13f91ca) it fails:both mips at first,left: 1,right: 2.texture::,watch::,shadow::,bindless::,draw::andplacement::, the same tests fail with and without the change. Those are the ones compiling HLSL with[RootSignature], which Wine's compiler drops.Not tested
No title run, and no AMD/NVIDIA GPU.
280b150measured no memory copied whole in boot-to-world runs, so like that commit this is a robustness fix: it matters only for a texture that straddles into memory that is not the runtime's.Fixes #2638
AI-assisted (Claude Opus 5.5 found it and wrote the fix and test, Claude Code reviewed and verified it). No game data used.
🤖 Generated with Claude Code
@Bj0rnis on GitHub · 2026-11-25 17:42 UTC · original
Independent Windows 11 hardware + WARP verification of #2639 at
2f98c154(cleangit merge-treewithorigin/main13f91cae, Rust 1.98.1 MSVC):cargo test -p victory-gpu --features diagnostics --lib --locked -- --test-threads=1-> 197 passed, 2 failed, 1 ignored (2.77s; includes the new test, only the 2 pre-existing #1744 NVIDIA 1M view-heap baseline failures also present onmain13f91cae).VICTORY_D3D12_WARP=1): 199 passed, 0 failed, 1 ignored (1.69s).cargo clippy -p victory-gpu --all-targets --all-features --locked -- -D warnings-> 0 warnings.cargo xtask policy-> 184 files ok.Not tested: live game workload.
AI-assisted test run and summary.
@kotekompotek on GitHub · 2026-11-25 17:53 UTC · original
Reviewed: the regression test sets up a real reserve/commit split — mip 1's tail in a reserved page, mip 0 in committed-but-untracked memory — and asserts first-upload covers both, re-upload only the changed mip. Exercises exactly the fix (untracked memory read per refresh). CI green.
@oni-swr on GitHub · 2026-11-25 17:58 UTC · original
Independent verification of head
2f98c154f7c7764939ff2b7b543d2491afac4dadmerged ontoorigin/main13f91caee25f2fdf2c062be5f7a27f058e51cbca.-j 4, WARP only (VICTORY_WARP=1,VICTORY_D3D12_WARP=1; d3d10warp 10.0.26100.9818), DXC/DXIL 1.8.2502.11 (Windows SDK 10.0.26100.0 x64 dxil.dll on PATH). No physical GPU device was created by the test runs.texture.rs(Staging::refresh_now) plus one test indraw.rs; matches #2638 (subresources on untracked pages are now chosen viaTracked::untrackedas well astake). Merges cleanly.cargo clippy --locked -p victory-gpu --features diagnostics --all-targets: no warnings.cargo test --locked -p victory-gpu --features diagnostics: 199 passed, 0 failed, 1 ignored (origin/mainbaseline under WARP: 198 passed, 0 failed, 1 ignored; the delta is the new test).texture.rshunks (ranges.is_empty() && loose.is_empty()and.chain(&loose)):a_mip_off_the_runtimes_memory_is_uploadedfails (both mips at first, left != right). So the test really runs on a WARP host rather than returning early at thehost()check, and it catches the bug.Independent verification by Claude Code (Claude Sonnet 5.5), an AI. No game files, dumps or shader names were used. Each PR head was merged (no conflicts) onto
origin/mainand run with--locked; clippy used--all-targets.@fuzeofficlal on GitHub · 2026-11-25 18:07 UTC · original
Tested
2f98c154merged cleanly ontomain(13f91ca) on Windows 11 with NVIDIA GeForce RTX 5090 (32.0.16.1656) and D3D12 WARP (--features diagnostics):VICTORY_D3D12_WARP=0,--features diagnostics,--test-threads=1):texture::tests2/2,watch::tests12/12,draw::tests12/12 (includinga_mip_off_the_runtimes_memory_is_uploaded)VICTORY_D3D12_WARP=1,--features diagnostics,--test-threads=1): fullvictory-gpu --lib199 passed, 0 failed, 1 ignoredcargo clippy -p victory-gpu --all-targets -- -D warnings(default and--features diagnostics): clean (0 warnings)looseuntracked ranges feed subresource hashing without triggering the tracked-page unconditional fast path, andwatch::track_askeepsdirty_bit = Nonesoclean()never short-circuits — looks solid.@Marvisak on GitHub · 2026-11-25 23:21 UTC · original · edited 2026-11-26 07:18 UTC
Automated triage for the maintainers.
Same head, verdict unchanged (merge candidate). The agreed rule with #2985 is noted for whichever PR lands second: a subresource that overlaps a
looserange takes no row path and is read and hashed whole. CI: passing.Generated by Claude Code
@wwwwwwww3333333 on GitHub · 2026-11-26 03:15 UTC · original
Heads-up: #2985 also changes
Staging::refresh_now, reading and copying only the rows a changed tracked page touches inside a subresource that owns it. With both merged, a subresource that owns a changed tracked page and also overlaps one of thelooseparts added here would take that row path, which looks only at the tracked ranges. The rule I proposed there for whichever lands second: no row path where the subresource overlaps alooserange, so it is read and hashed whole as this PR does.@BastienRodz on GitHub · 2026-11-26 03:16 UTC · original
Agreed. With both merged, a subresource that overlaps a
looserange has bytes no tracked page accounts for, so the row path (tracked ranges only) would miss them. Your rule keeps it correct: no row path where the subresource overlaps alooserange, so it is read and hashed whole, as here.The two PRs also conflict textually (in
draw.rs, where both add tests), so whichever lands second has to be rebased anyway, and the rule goes in with that rebase. If #2985 lands first, I'll add it here; if this one lands first, it's yours to add as you proposed.@Dukestar69 on GitHub · 2026-11-26 05:07 UTC · original · approved these changes
Tested merged onto
origin/main(63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):cargo test -p victory-gpu --lib draw::tests: 21 passed, 0 failed (including newa_mip_off_the_runtimes_memory_is_uploaded).cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 13:51 UTC · original · approved these changes
Reviewed and verified head
2f98c154f7c7764939ff2b7b543d2491afac4dadcleanly merged ontoorigin/main(63bcca43) on Windows 11 x64 with NVIDIA GeForce RTX 5090 and D3D12 WARP (VICTORY_D3D12_WARP=1,VICTORY_D3D12_DEBUG=1, Rust 1.98.1).Code review
crates/victory-gpu/src/texture.rs(L571-584): addinglet loose = t.untracked(start, start + size)to both the early-exit check (ranges.is_empty() && loose.is_empty()) and thetouchedsubresource overlap filter (ranges.iter().chain(&loose)) brings texture staging in line withShadow::update_trackedfor memory straddling non-runtime pages (#2638).watch::track_asleavesdirty_bit = Nonewheneveruntrackedis non-empty, sot.clean()never short-circuits straddling textures, while fully tracked runtime-memory textures keepdirty_bit = Some(_)and continue taking the O(1)clean()fast path with zero extra reads or uploads.t.untracked(start, start + size)clamps every run to[start, start + size), sof - start/e - startcannot underflow;looseranges stay out of the tracked whole-page shortcut so subresources on untracked pages are deduplicated via their per-subresource BLAKE3 hash.last.hashes[i], causing one extra upload on the next unchanged refresh to seed the hash baseline before steady state settles to 0 uploads (sound, no missed writes). The agreed #2985 merge rule (skip row-sliced upload when a subresource overlapsloose) also makes sense for whichever lands second.crates/victory-gpu/src/draw.rs(L2689on PR head):a_mip_off_the_runtimes_memory_is_uploadedcleanly tests the exact reserved+committed mip boundary.Verification
cargo xtask policy:191 files ok;cargo clippy --locked -p victory-gpu --all-targets -- -D warnings(default &--all-features): 0 warningsorigin/main(63bcca43with only thedraw.rstest applied): fails as expected (both mips at first,left: 1, right: 2)draw::tests texture::tests watch::tests shadow::tests bindless::tests(--test-threads=1):--features diagnostics,VICTORY_D3D12_DEBUG=1): 50 passed, 0 failedVICTORY_D3D12_WARP=1,--features diagnostics,VICTORY_D3D12_DEBUG=1): 50 passed, 0 failedVICTORY_D3D12_DEBUG=1): verified steady-state hash dedup (2→0→1→0 subresources on the 2-mip split), a single 1-mip 128×256 texture straddling a reserved tracked page and plain committed page (1→1→0 steady state, then 1 on writing the untracked half → 0), and a fully write-watched pool texture keepingmaybe_changed() == falseafter first upload, all with 0 D3D12 Debug Layer messages.Clean, minimal fix; approving.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.