Streamed textures fit on 12 GB cards: host copies go without their largest mips past a cap #60
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/DexNom--VIctory!60
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-60"
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?
@SpeezusChrist23 on GitHub · 2026-11-26 00:32 UTC · original
SpeezusChrist23:rx6700xt-texture-cap→main· +440 −20 · 4 files · 1 commits · openStreamed textures fit on 12 GB cards: host copies go without their largest mips past a cap
On a 12 GB card the runtime reaches the card's video-memory budget early in the prologue. The log says
textures picked by index: VRAM texture budget reached; new allocations wait, and textures that stream in after that stay blank. People and walls show missing colours and textures.This change gives large streamed textures a host copy without their largest mips while memory fills. They show slightly softer instead of not at all. It is ported from Belobug's AMD fork (Belobug/VIctory-Belobug-AMD:
over_cap,skipped_mips,HostTexture.skip,without_mips) and adapted to this fork's lazy host copies and staging buffers.What is capped
Backing::Address/ViewAddress).The cap
VICTORY_TEXTURE_MAX=<px>sets it;0turns it off.room()is unchanged and stays the last resort.Where the code changed
resource.rs: the skip and the cap rule; the host copy is made smaller.texture.rs: skipped mips are not staged or uploaded; the remaining mips go to the right host subresources.descriptor/host.rs: SRVs moveMostDetailedMip,MipLevelsandResourceMinLODClamppast the skipped mips.list.rs: texture copies and read-backs map to the host copy's subresources; copies of skipped mips are left out.Tested
resource::tests::a_large_streamed_texture_goes_without_its_largest_mipsresource::tests::subresources_map_past_the_skipped_mipstexture::first_mip_tests::staged_parts_go_to_the_host_copys_subresourcesdescriptor::host::tests::a_view_moves_past_the_skipped_mipscargo clippy --workspace --all-targets --locked -- -D warnings: clean.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: clean.cargo test --workspace --locked: all pass except somevictory-shaderemit::barycentric_tests. Those fail the same way on unmodifiedmain(2e01ab4) on this machine, so they are not related to this change; probably the DXIL validator setup here.Known limits
Unrelated to this change: the title also runs stable into gameplay on this RDNA2 card (about 4-5 fps), which the README's list of tested cards does not include yet.
🤖 Generated with Claude Code
https://claude.ai/code/session_01S4xxd1tzZBWeKd4wieFYTZ
Ported from Belobug's AMD fork (Belobug_VIctory-Belobug-AMD; over_cap, skipped_mips, HostTexture.skip and without_mips arrived in its imported base 78028ad; 5d7bd16 builds on the same mip skipping for views with a least level of detail and is not ported). Adapted to this fork's lazy host copies and staging buffers. A streamed texture (placed by address or made from a view, Backing::Address / ViewAddress) that is 2-D, block-compressed (BC1-BC7), has a mip chain and no target, depth or unordered access flag gets a host copy without the fewest largest mips that bring both sides to the cap (at least one mip stays; sides stay multiples of 4). The cap is VICTORY_TEXTURE_MAX (pixels, 0 = no cap) or by default 1024 while the card is under 70% of its budget, 512 under 85%, 256 above; it is decided when the host copy is made (again after the sweep lets one go). - resource.rs: HostTexture.skip; over_cap / mips_over / texture_max; host_texture shrinks width, height and mip count; skipped_mips, skip_of, host_subresource (title subresource -> host one). - texture.rs: staging buffers stage title mips from max(first, skip) on and copy each part into the host subresource slice * (mips - skip) + mip - skip; skipped mips are neither read nor uploaded. - descriptor/host.rs: SRVs of such a copy move MostDetailedMip, MipLevels and ResourceMinLODClamp down by skip (without_mips / cut_mips). - list.rs: CopyTextureRegion / read backs map subresource indices to the host copy's and drop copies of skipped mips; CopyResource between copies with different skips is left out. room() stays the last resort, now counting the smaller host copies. Tested on an RX 6700 XT (12 GB, RDNA2), Windows 11, the title's prologue: before, the runtime reached the card's budget ("textures picked by index: VRAM texture budget reached; new allocations wait") at about 10.0 of 11.0 GB and later textures stayed blank; with the cap, 8.6 of 11.0 GB and they show (largest mip left out, e.g. 1024 -> 512). Frame rate unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01S4xxd1tzZBWeKd4wieFYTZ@SpeezusChrist23 on GitHub · 2026-11-26 00:34 UTC · original
Before
https://github.com/user-attachments/assets/e6e5d83c-c355-4730-904e-3bbeb6e8f3ed
@SpeezusChrist23 on GitHub · 2026-11-26 00:36 UTC · original
After
https://github.com/user-attachments/assets/f8a2ccec-b0c4-4c1f-b5ec-52d8a2660d2b
@SpeezusChrist23 on GitHub · 2026-11-26 00:51 UTC · original
Found a bug while testing, please hold off on merging.
With the cap on, some character skin textures load corrupted, as rainbow pixel noise. In the photo below, both of the guard's arms are affected and one hand is blue. Most other textures in the same scenes look correct.
For comparison, with the cap off (VICTORY_TEXTURE_MAX=0), the same kind of skin textures don't load at all and show up black. So the cap does get them loading, but some of them land with their data in the wrong place.
My suspect is how the skipped mips interact with textures that stream in only partly, for example when only their middle pages are resident. I'm working on a fix and will update this PR once it's tested on the same scene.
Tested on an RX 6700 XT (12 GB), retail title, prologue (prison).
@SpeezusChrist23 on GitHub · 2026-11-26 00:54 UTC · original
Update: false alarm for this PR. The rainbow-noise skin does not come from the texture cap. I was testing a second, separate change at the same time (an ambient-light stand-in for the missing ray-traced lighting), and that one causes it:
VICTORY_TEXTURE_MAX=0): the guard's arms are still rainbow noise and his body is black (unloaded).So this PR is ready for review again. Sorry for the noise! The ambient change stays local until its issue is fixed.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.