Repository navigation
D3D12.X: sampled textures go without their top mips while video memory fills up - #2385
Open
NWProgramming00 wants to merge 1 commit into
Open
NWProgramming00 wants to merge 1 commit into
NWProgramming00 wants to merge 1 commit into
Conversation
…y fills up When the device's local video memory passes 75 % of its budget, a new sampled title texture gets no pool tiles for its largest mips (the largest side kept: 2048 from 75 %, 1024 from 85 %, 512 from 92 %). Those tiles stay unmapped and every view of the texture is clamped to the first mip that has memory (ResourceMinLODClamp, which counts from the resource's first mip). With lazy levels (XCL_TEXTURE_LEVEL_PAGES=1) those levels never get pages. XCL_TEXTURE_BUDGET=0 turns it off; XCL_TEXTURE_MAX caps every new texture. Part of xcl-dev#1773. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NWProgramming00
force-pushed
the
vram/budget-top-mips
branch
from
November 25, 2026 18:23
61b2f2c to
d790a29
Compare
Contributor
|
Independent AMD RDNA4 (native wave64) test report on exact head Tested
Regression run (60 s retail-title smoke, (Matched Not tested
AI use
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the device's video memory fills up, new sampled title textures get no memory for their largest mips. Every view of such a texture is clamped to the first mip it has. A texture then gets less sharp up close instead of pushing the card past its budget. Part of #1773.
What it does
QueryVideoMemoryInfo, at most every 100 ms. Past 75 % of the budget, a new sampled texture keeps a largest side of at most:ResourceMinLODClamp= the mips left out, so sampling never reaches them. The clamp counts from the resource's first mip, not the view's; the new GPU test checks this.XCL_TEXTURE_BUDGET=0turns it off.XCL_TEXTURE_MAX=<texels>caps every new sampled texture at that size, whatever the fill. It is meant for tests and measurements.XCL_ACTIVITY'smemory:line gives the textures alive now without their top mips, and the MB of tiles they leave unmapped.What is in it
crates/xcl/src/hle/d3d12x/vram.rs:texture_cap,cap_for_fill,mips_to_skip);top_mip_tiles,top_mip_mask);Pages::bind/bind_rangemap all tiles but the masked ones; the mask is kept forremap_if_unmapped;XCL_TEXTURE_LEVEL_PAGES=1, D3D12.X: video memory use is high, title memory and textures are mirrored into VRAM #1773) the left-out levels never get pages inmap_levels(groups_to_map);clamp_skipped_mips.crates/xcl/src/hle/d3d12x/real.rs:dev_create_srv_xclamps the views of such a texture. When the title passes no description, it builds the default 2D view first.crates/xcl/src/host.rs: the counts on thememory:line.vram.rs:the_cap_follows_how_full_video_memory_isandtop_mips_go_until_the_largest_side_fits_and_one_tiled_mip_stays.lazy_levels_never_map_the_top_mips_left_out: with lazy levels, the left-out levels never get pages, the others once.gpu_a_texture_without_its_top_mip_samples_the_first_it_has, a GPU test. It binds a 512×512 4-mip reserved texture without mip 0 throughPages::bindand uploads every mip. Then it samples through three views:Tested
XCL_ADAPTER=radeon), AMD Ryzen 7 9700X, drivers 32.0.16.2124 (NVIDIA) and 32.0.21042.62 (AMD), Rust 1.100 MSVC, release.bind;cargo build --release --workspace, thencargo test --release --workspace --no-fail-fast -- --test-threads=4, with and withoutXCL_DIRECT_DXIL=all, against base68a284aon the same machine:68a284ad790a29)XCL_DIRECT_DXIL=allXCL_DIRECT_DXIL=allThe +4 are the new tests. The failing tests are the same on base and PR:
fuzz_validate_and_gpu_0..3on NVIDIA (#1905),fuzz_validate_and_gpu_1on RDNA2 (#2115, #2170),offline_compute_pipeline_is_reused_by_a_second_processwith direct DXIL (#1674), anda_bridged_mask_write_where_one_half_is_elsewhere_meets_no_barrieron both adapters in both modes (it came with254a058and fails on base too).SKIPPEDlines: 37 on NVIDIA, 19 on the Radeon, the same on base and PR.XCL_ACTIVITY=1, A pressed at 15–65 s, RTX 5070 Ti; made before the rebase onto68a284a, on base06c9f55):main06c9f55XCL_TEXTURE_MAX=1024mainrun on the Radeon iGPU reached it too, and the frames then stop at the known wait afterListX #101(Newer retail title (TitleID 7952987A): reaches world loading, then the title's GPU watchdog ("GPU Loc Sig") after ListX #101 stub #505). So I do not claim that this PR gets the title further.Regression run
Base (
main), NVIDIA GeForce RTX 5070 Ti:This PR, same card:
These 60 s runs end in the title's menus, before any texture is left without its top mips (video memory stays far under 75 % of the budget there), so they check that nothing else changed; the 300 s runs above are the ones that reach this code.
Not tested
title_memory_budget_mbis 13,824 MB regardless of the adapter's memory #1337, Retail Game potentially overcomitting VRAM - feasibility for 8GB VRAM cards? #320) would settle it.Load,mipsqueries). They are not clamped by a view, and read zero there.AI use
🤖 Generated with Claude Code