GPU: VICTORY_TEXTURE_DROP_MIPS=N leaves out a texture's N largest levels on the host (8 GB cards) #610
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/fxceless--victory-fork!610
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-610"
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?
@ofc0urse on GitHub · 2026-11-25 03:12 UTC · original
ofc0urse:gpu/texture-drop-mips→main· +619 −9 · 5 files · 5 commits · openProblem
On an 8 GB card the textures picked by index do not fit. With the current main, the card sits at its memory budget (about 6.8 GB in use of 7.1 GB), about 15,000 textures stay waiting for room, and frames that pass the budget get slow: the GPU time per frame triples once the system starts moving card memory into the PC's.
Change
VICTORY_TEXTURE_DROP_MIPS=N(0 by default, at most 4): the host copy of a 2D texture the title fills leaves out its N largest levels. Each level left out is three quarters of the texture's bytes.Only textures where this is exact: 2D (arrays and cubes too), no render target, depth or UAV flag, single sample, at least 512 texels on the shorter side, and sides that halve into whole 4-texel blocks. Host level
mis then title levelm + Ntexel for texel.resource.rs:drop_levelsdecides per description;host_texturemakes the smaller copy;host_subresourcemaps a title subresource to the host one.texture.rs: the staging buffer is laid out from the host texture as before, and detiles title levelm + dropinto host levelm.descriptor/host.rs: shader views shift their first level, level count and LOD clamp down by the same amount (shift_levels, with a unit test). A view of only the left-out levels shows the largest level the host has.list.rs: a buffer-to-texture copy into such a texture goes to the level it has (none for a left-out level). Other copies and read-backs involving such a texture are skipped, logged once.texture::aliasfalls back to the title-memory upload when the two textures leave out different levels.Shaders see these textures at half size per level left out. Code that samples is unaffected apart from detail. Code that
Loads with integer coordinates computed from the title's own sizes can read out of range. I have not seen that in the first room.Measurements
RTX 4060 Ti 8 GB (driver 621.24), i5-14400F, 32 GB RAM, Windows 11, Series X profile, diagnostics build. Main
c96b4f2with #426 and #571 on top, default settings,VICTORY_TEXTURE_NO_WAIT=1, warm shader cache, same automated walk into the first room, 15 to 17 minutes each:DROP_MIPS=0DROP_MIPS=1Captured frames of the first room look right in both. With the switch, fine texture detail is softer (expected), and there is visibly less temporal smearing, from the shorter frames.
cargo build(diag and release) clean,cargo test -p victory-gpu views_shift_downpasses. Not tested: other cards, other scenes, AMD, Wine.Developed with Claude Code.
🤖 Generated with Claude Code
@Filip722 on GitHub · 2026-11-25 03:48 UTC · original · edited 2026-11-25 03:56 UTC
I reproduced a texture-to-buffer copy failure on this PR at 5971e08. With a retained mip on the second array slice, dropping one level left the destination untouched. The same copy succeeded with zero levels dropped.
81e1f7a is a cherry-pickable fix on this PR's head. It maps the retained source subresource before creating a host texture. The new D3D12 test checks the pixels, crop, row pitch, destination offset and surrounding bytes. It passes with both settings on Bazzite 44, RTX 5060 Laptop GPU (8 GB), NVIDIA 615.78.08, Proton Experimental 11.0-20261112 and vkd3d-proton 3.2.0. The wider resource suite passed 10/11 on both revisions with dropping disabled. The same depth-plane test failed during root signature creation on both.
This result uses generated textures. Gameplay impact remains unverified. Code and testing assisted by OpenAI Codex (GPT-6.2-Sol).
I also compared the setting itself during offline Series X loading, using one build of fork main
310c6ebwith this PR and local Proton compatibility changes. Both runs used the same cache/profile seed, input, CPU cap and 50% texture-room setting. Around 90 seconds the renderer counted 7,510 title-filled textures using 2,342 MiB at zero levels dropped, versus 7,403 using 1,343 MiB with one dropped. Around two minutes it held 7,531 versus 15,388. Both showed loading artwork and a fade to black. The full-size run stopped at the VRAM reserve after 164 s. The reduced-size run stopped at the host RAM reserve after 168 s. These are single runs per setting. World entry and in-game performance remain unverified.@lucaseddd on GitHub · 2026-11-25 04:16 UTC · original
RTX 3060 Laptop 6 GB / Windows 10 22H2 follow-up. The operator reported that the opening cutscene looked better with one mip level dropped, with dark/missing-looking surfaces and low frame rate still present.
Builds: fxceless
c96b4f2+310c6eb6(packed-texture queue and reuploads at full budget) + Xeltax/VIcky#9 (integer render-target blending, adapted to both depth paths). The second build also includes #610 at 5971e08 and sets VICTORY_TEXTURE_DROP_MIPS=1. Both used Agility SDK 1.620.2, diagnostics, VICTORY_CARD_BUFFERS_MB=512, VICTORY_TEXTURE_GUARD=0, VICTORY_TEXTURE_NO_WAIT=1 and VICTORY_SHADER_LOOP_LIMIT=256. Both loaded an existing host pipeline library. The test was offline, with title data on an HDD.What worked: The #610 build reached the world sooner in this pair, reduced the queue, and improved observed cutscene presentation. Separately, the blend backport turned the same E_INVALIDARG mesh pipeline into a successful creation on this GPU (VIctory #806 reproduction). The targeted blend, packed-neighbor and mip-view tests passed.
What remained: The full-mip build still hit a large texture backlog after
310c6eb6, even with the compilation queue empty. Dropping one mip still produced slow intervals and visible dark areas. In several later 3D intervals with zero pipelines being built, copy-back was still about 142–281 ms per frame. This makes waiting for pipeline compilation alone an unproductive next test for that section. I also checked whether VIctory's cd94d353/940d32f6 page-marked copy-back changes could be applied directly to this tree. They conflicted across the host, descriptor, and shader-emission paths, so they were not part of either run.The runs used successive pipeline caches and were not frame- or camera-matched. The table is an observational comparison, not an isolated speedup estimate. Upload counts are cumulative counters, not VRAM residency.
@sagouindupm on GitHub · 2026-11-25 04:19 UTC · original
Measured on an 8 GB card in the Series S profile, since that is what this is for.
Setup. RTX 3050 8 GB, i5-12400F, 32 GB, Windows 11, release build. Tree:
mainat310c6eb+ #32 + #188 + #86 + DLSS (Marvisak/VIctory#1704) + #51 + #640 + this PR + #467 + #518, assagouindupm/victory-forkseries-s-perf. Each run loads the same checkpoint (first room of the world), about 5 minutes, no input; the frame time is read from the window title every 9 s.VICTORY_TEXTURE_DROP_MIPSSo here
=1takes the settled world from about 355 ms to about 220 ms a frame and frees about 1 GB of the card;=2frees another 0.9 GB and changes nothing more in the frame time, so on 8 GB one level is enough in this scene. I did not see a loss of sharpness at 1920x1080 output from 1280x720 in the screenshots (character, room, yard through the window).Two things to know:
=1runs the scene came up wrong (a flat green wall behind the character, frames of 2 s for about two minutes, then 225 ms). The second=1run and the=2run were right. One odd launch in three is too few to say it is this PR and not the known launch-to-launch differences on this base (the first room's walls are missing in about every other launch without this PR too), so take it as a count.Not tested:
=3and=4, anything past the first room, Series X, this PR alone without #467 and #518.AI-assisted: Claude Code (Claude Fable 5.2) made the runs and wrote this note.
@Filip722 on GitHub · 2026-11-25 05:11 UTC · original
One more result for the 8 GB texture mode. With one mip dropped, the host texture shrank as intended, but a CPU refresh still read and hashed the omitted high-resolution data. An asset-free 512×512 RGBA8 test on this PR's head (
5971e08b8e74112339ddbde33e298e2701b58a15) reproduced it. A single-slice, four-mip texture read 1,392,640 bytes, including the 1,048,576-byte level the host had omitted.Cherry-pickable follow-up on this PR's head. It limits the CPU refresh to the retained mip range for single-slice 2D textures. The same texture then read 344,064 bytes. Changing only the excluded level left the upload clean. Changing a retained texel updated the expected staging byte and preserved its adjacent channels. With dropping off, the single-slice control still read 1,392,640 bytes. The two-slice control still read 2,785,280 bytes and preserved the original slice stride in both modes.
The focused texture-memory suite passed 4/4 with dropping off and 4/4 with one mip dropped. The retained-layout test compares all output bytes for linear, 4 KiB tiled and 64 KiB tiled layouts, including packed mip tails. The asset policy passed across 169 files. These byte counts measure the synthetic texture. I haven't established a title-level loading-time or FPS gain.
RTX 5060 Laptop GPU (8 GB), NVIDIA 615.78.08, Bazzite 44, Proton Experimental 11.0-20261112, vkd3d-proton 3.2.0 (
ec20719452e916b), Rust 1.98.1 Windows MSVC target. Codex (GPT-6.2-Sol, high reasoning) assisted with the change, tests and report.@sagouindupm on GitHub · 2026-11-25 05:35 UTC · original
@Filip722 the title-level number you said was missing, for your follow-up
3169410, on the same 8 GB card and scene as my comment above (RTX 3050, Series S,VICTORY_TEXTURE_DROP_MIPS=1, the tree of that comment with your commit cherry-picked on top:series-s-perf). Two runs each; frame time read from the window title every 9 s from 100 s after launch.3169410So here: no regression (both runs reach the world, picture as before, walls present in both), and no gain I can measure in either the settled frame time or the time the world takes to settle; both are inside the run-to-run spread on this base. The texture part of a settled frame is only 2 to 9 ms here, so there is little for it to save once the world is up; a gain would have to show while textures arrive, and with four runs I cannot see one.
AI-assisted: Claude Code (Claude Fable 5.2) made the runs and wrote this note.
@CuteBooty on GitHub · 2026-11-25 05:54 UTC · original
A second card: RTX 3070 8 GB, Series X mode, N=1
5971e08b picked onto
c96b4f2+ main310c6eb6(with #605 left out) and a number of other open PRs. The prologue'sfirst room and what follows, warm shader cache, settled medians of the log's frame lines:
=1, 4 runsroughly 390 ms", not to the millisecond.
=1and a longer bake budget sat at 533-584 ms; the longest was 29 minutes with no error,no device removal.
blank texture to it. Detail is softer, as expected.
=1(6.5-7.0 GB in use of 6.4-6.9 GB, 5-7.6 GB shared), so later scenesstill lose textures; the switch moves the limit, it does not remove it.
Not tried:
=2, and the switch together with #704 (see the note there).Setup: RTX 3070 8 GB (driver 621.24, 32-lane waves), Ryzen 5 3600, 32 GB, Windows 11, Series X mode, 1920x1080, relay at its default (stage 2), card buffers 1 / 1024 MB, a diagnostics build.
@ArturoWolff on GitHub · 2026-11-25 06:27 UTC · original
Integration note for rebasing #610 (
5971e08) onto8dd30ab: unlike the earlier 8 GB frame-time tests, this checks whether the new opt-in levels-on-demand path and mip dropping agree on level numbers. It is independent of the default cross-view guard.The merge builds. In
resource.rs, however, the reserved texture goes throughhost_texture_as, which reduces the host mip chain, thenTiled::makegets the originalr.desc.mip_levels. The shape test that admits textures to this path does not exclude a nonzerodrop_levels(&r.desc). There are further runtime eligibility checks; this alone does not show a game texture actually got mapped incorrectly.I extracted the existing shape test unchanged and ran an asset-free Windows-target unit test in fresh GE-Proton11-14 processes on Linux. For a single-slice 1024×1024 RGBA8 texture with 11 levels, the invariant “a texture whose levels were dropped must not enter the unshifted tile path” passed at
VICTORY_TEXTURE_DROP_MIPS=0and failed at1,2, and4. Adding&& drop_levels(&r.desc) == 0to tiled eligibility made all four cases pass; the 256×256, nine-level control stayed eligible at all four settings. #610's existing view-shift test also passed before the change at0and1, so it doesn't catch this interaction.Conservative integration option: keep mip dropping on the existing non-reserved path for affected textures and keep on-demand tiling for the rest, until tile mapping supports the same title-to-host mip offset. No game or hardware tiling run, pixel readback, VRAM/FPS measurement, or wall-rendering claim here.
AI disclosure: Hermes Agent inspected the merge, wrote and ran the regression test, and posted these results on ArturoWolff’s behalf.
@CuteBooty on GitHub · 2026-11-25 08:04 UTC · original
Both fixes ran in the game here
Both applied to our tree with line offsets only (3169410's test needed its
staged_memory/fingerprintcallsadapted). With them in, three Series S runs of 12, 25 and 24 minutes with
VICTORY_TEXTURE_DROP_MIPS=1, from thefirst room to the first mission of Chapter I: no error, no device removal, and nothing in the picture I can tie to
either change. No measurable frame-time change, as expected.
The once-per-run line "copy with a texture whose host copy leaves out levels skipped" still fires; that is the
texture-to-texture path in
unlike(), which neither commit touches. A few textures with wrong contents (anarmband, a bag) are still there and may belong to that path; not shown.
Setup: RTX 3070 8 GB (driver 621.24, 32-lane waves), Ryzen 5 3600, 32 GB, Windows 11, Series S mode (PR #188), 1920x1080,
VICTORY_TEXTURE_DROP_MIPS=1, relay at its default (stage 2), card buffers 1 / 1024 MB, a diagnostics build of a tree with a number of open PRs picked.@ofc0urse on GitHub · 2026-11-25 08:34 UTC · original
Rebased onto
mainat9376fd6, with the review fixes folded in:fc4b3dd,7d0e398: @Filip722's two follow-ups (retained-level read back; a refresh reads only the retained levels), cherry-picked with their authorship.bd2ccd8: a texture that leaves out levels stays off the levels-on-demand tile path, the check @ArturoWolff suggested.68e6f6a(new): copies with such textures go level by level instead of being skipped.CopyTextureRegionmaps the source subresource the way it already mapped the destination.CopyResourcebetween host copies that leave out different numbers of levels copies each level both have. A title level has the same size in every host copy that has it, so boxes stay as they are. The "skipped" warning no longer fires in a run.Same machine as before (RTX 4060 Ti 8 GB, driver 621.24, Series X profile, diagnostics build, warm cache, same automated walk into the first room). Settled minutes,
a26859f+ this PR:DROP_MIPSOn the new main the switch no longer changes the frame time here: the card room work in
a26859falready keeps this card inside its budget. What changes is how much is on the card: about three times the indexed textures and 2.7 times the title-filled copies in the same 2 GB. In the captures that is the window glass, the textured building and the clothing of the people in the yard, which stay plain with=0.One open problem I could not pin down. With
=1ona26859fand9376fd6, four of five runs (one of them the BC-only test below) show two static, blocky patches in the lower corners of the first room (stale content where the lower wall should be; same pixels in every capture of a run). Two runs with=0did not show them. What I ruled out:68e6f6a, where no copy is skipped;The same staircase edge appears on a character's shoulder with
=0as well, so the switch may only move an existing artefact onto a larger area.=1was clean onc96b4f2. If someone knows which pass draws the lower wall there, I can test further.Not tested: other cards, scenes past the first room, levels on demand together with the switch, AMD, Wine.
🤖 Generated with Claude Code
@ArturoWolff on GitHub · 2026-11-25 08:58 UTC · original
Verified the tile-eligibility part of your rebase (
bd2ccd8, tested at68e6f6a) on Linux/GE-Proton11-14. In the earlier comparison, a 1024² RGBA8 texture still qualified for the unshifted tile path atDROP_MIPS=1/2/4. On this head it no longer qualifies at any of those settings; at0it still does.I extracted the
hostedshape predicate into a private helper used by bothhostedand the test. WithVICTORY_LEVELS_ON_DEMAND=1, four fresh processes (VICTORY_TEXTURE_DROP_MIPS=0,1,2,4) each reported1 passed; 0 failed. The 512² case followed 1024²; 508² and 256² stayed eligible below the size threshold, as did 516² where dropping would violate block alignment. These were single-slice descriptors, not hardware tile allocations.That resolves the specific predicate failure I reported. This test does not exercise the new copy commands or identify which pass draws the lower wall.
AI-assisted: Hermes Agent wrote and ran the regression fixture, compared the results, and posted this follow-up for ArturoWolff.
@laptopnotebook on GitHub · 2026-11-25 18:31 UTC · original
Another 8 GB card, Windows 11, NVIDIA, Series X profile,
N=2againstN=0.Tree:
mainat0b0074e+ this PR + #799, #868, #768, #864, #860, #936, #432, #932, #922, #896, #964 (the set the "nvidia-8gb" fork uses, minus #812 and #854, which conflict). Launcher settings of that fork, warm prison shaders, the opening cutscene, unattended withVICTORY_KEYS.N=0N=2N=2, release build, played by handWith
N=0most textures never arrive: people are flat silhouettes and the walls are black. WithN=2faces, walls, floor and lighting show. It is still a little over budget, so the view through the cell window and a strip along the bottom stay blocky.One merge note: on
0b0074ethis PR conflicts inlist.rs(copy_texture_region) with main's new check for a copy between the same subresource of one host texture (same = texture.as_raw() == to.as_raw() && ...). I kept both, with this PR's level remap first (it can return before the copy) and main'ssamecheck after it, unchanged.cargo test --workspacepasses on that tree.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.