GPU: detile only the subresources a texture's changed pages hold (fix ready on a fork) #915
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#915
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@talakasse on GitHub · 2026-11-24 14:04 UTC · original
Pull requests are limited to collaborators, so I'm posting this here. The fix is one commit on top of current
main(ffe310e). I checked all 612 open PRs, and none of them touches this shortcut.Branch: https://github.com/talakasse/VIctory/tree/gpu/partial-detile
Commit:
github.com/talakasse/VIctory@af4fef4037Related open PRs change the same refresh code in other ways: #143 (hash and detile from a kernel-read copy), #388 (detile into cached memory), #401 (skip hashing textures rewritten every frame), #641 (partially resident streamed textures). This one is orthogonal to them, but it will conflict textually with whichever merges first, and I can rebase it.
Problem
victory-gpu/src/texture.rs: "shortcut: a change detiles the whole texture, not the pages written." When one 64 KiB page of a title texture changed, the whole memory was read back (watched memory) or hashed as one, and then every mip and slice was detiled again. A streamed texture filling page by page paid that full cost at every submission that sampled it.Change
Layout::extents(mip, slice)(victory-formats): the tiled byte ranges a subresource is detiled from. There is one range per depth slice or slab, merged. Tail mips get the part of the tail block they span.Tests
extents_hold_what_a_subresource_detilescovers 9 layouts: tiled S/D at 256 B, 4 KiB and 64 KiB, linear, mip tails, arrays and 3D. It checks four things:texture::tests: overlap, changed pages and page-to-range conversion.Checked / not checked
cargo test -p victory-formatspasses, run on macOS.cargo clippy -p victory-formats -p victory-gpu --all-targets [--all-features] --target x86_64-pc-windows-msvc -- -D warningsis clean. Locally I needed blake3'spurefeature, because there is no Windows C compiler here.texture::testsunit tests and the GPU path have not been executed. The gain depends on how much frame time goes into detiling.🤖 Generated with Claude Code
@andrewpozdnakov7-jpg on GitHub · 2026-11-24 14:12 UTC · original
Native Windows 10 MSVC check at
af4fef4:victory-formats24 passed, 4 ignored. GPU diagnostics 56 passed, 1 ignored, including all three newtexture::tests.A synthetic WARP fixture with two mips and two array slices exercised
Staging::refresh_nowon pre-touched memory. Changing one texel on one 64 KiB page updated the expected mip and slice in the mapped upload buffer. Both hash and write-watch paths left a marker in the unrelated subresource untouched. The write-watch path read 64 KiB out of 256 KiB, then read zero bytes on the unchanged refresh.A separate control on this Windows host showed that the first read of newly committed, untouched pages can make all four 64 KiB blocks appear written, with either a CPU copy or the kernel read. This can make the initial follow-up copy larger. The fixture checked staging bytes without submitting a draw. AI-assisted.
@MamaLeVrai on GitHub · 2026-11-24 19:45 UTC · original
@talakasse your fix for this issue is now in a pull request, #1610, with seven other fixes from contributors' forks: the branch is merged as it is, with your commit(s) and your name unchanged, onto
mainffe310e. Clippy (both runs) andcargo test --workspacepass on the result. If you would rather open your own pull request for this one, say so and I will take it out of #1610. AI-assisted (Claude Code); no game data.@Marvisak on GitHub · 2026-11-25 06:59 UTC · original
Automated triage for the maintainers.
mainstill has the shortcut noted at the top ofcrates/victory-gpu/src/texture.rs: a change detiles the whole texture, not the pages written. This change is carried by open PR #1135 (divyeshganta, "Fixes #915"); the bundle #1610 that also carried it was closed unmerged. If you would rather open your own PR fromaf4fef4, pull requests are open to everyone; otherwise review continues on #1135. Whether to take it is for the maintainers.Generated by Claude Code