D3D12.X: a view's padding does not make a second texture #2762
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2762
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2762"
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?
@joeypercia on GitHub · 2026-11-26 10:53 UTC · original
joeypercia:d3d12x-view-key-padding→main· +49 −4 · 2 files · 1 commits · openresource_atmakes a placed texture for each new (address, description) of a view the title writes without a resource object (device #70 / #71,CreateShaderResourceViewAtX/CreateUnorderedAccessViewAtX), and keeps it for later views. Its key cleared the padding after the flags (bytes 0x34..0x38) but not the padding afterDimension(bytes 0x04..0x08). The newer retail title leaves that padding set, so the same view made another texture whenever it differed. @GreemSC counted 24,844 such twins among 80,953 textures in a 200 s run (31 %, #2743). This clears both. Part of #2743 and #2688.There's no eviction here. A version that let earlier textures go when a view covered their memory bounded the count on an RTX 4070 Ti (about 24,000 instead of 62,822 and climbing), but it didn't lower video memory. More than half of what it let go was made again, and its one run ended in the title's own breakpoint. Details are on #2743.
What is in it (one commit,
crates/xcl/src/hle/d3d12x/real.rs,crates/xcl/src/host.rs)view_keyclears both padding ranges of the 0x38-byte description.resource_atkeys its map with it, and passes the cleared description on.views without a resource: N textures kept).padding_does_not_make_another_texture: two descriptions that differ only in their padding give one key, and a change of any other byte (dimension, width, format, flags) keeps them apart. It fails without the change (padding at 0x04).Tested
XCL_ADAPTER=Radeon. Windows 11 Pro 26200, Rust 1.100.0 MSVC, DXC 1.8.2502.11. Debug builds for the tests, release for the runs.cargo build --workspace, thencargo test --workspace --no-fail-fast -- --test-threads=4on496ef578:gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1, which fails the same way onmainon this iGPU (#2115).nvidia-devaf2cecc4(1 GiB shader heap, through the world load), the count was 15,773 at 71 s, 42,457 at 121 s and 62,822 at 403 s. I have no count on this card without the change; the 31 % is GreemSC's (AMD / Linux, #2743).Regression run
RTX 4070 Ti (driver 621.40), release builds, 60 s each,
scripts/smoke.ps1 -Game <folder> -Title retail-titleon the newer retail title, with the same settings. Both ran with the NVIDIA shader-heap profile (#2590, 1 GiB) installed on this machine. The PR's run shared the GPU with a test suite of mine for part of it.mainb49be183(this PR's base) and this PR's head (no uncommitted changes):main:
PR:
Not tested
Dimensionis a 4-byte enum, followed by the 8-byteAlignmentat 0x08, so 0x04..0x08 is padding inD3D12_RESOURCE_DESC.AI use
@luckyteagirl on GitHub · 2026-11-26 10:55 UTC · original · reviewed
On
496ef5780a4549fc3f15bc65340deb1db4794d6b, the newVIEW_TEXTURESactivity count usesMADE.len(), butresource_atdeliberately caches failed creations as a null pointer. A driver-refused descriptor therefore increasesviews without a resource: N textures kepteven though no texture was created; repeated distinct failures can make this diagnostic grow during the OOM investigation that motivated the PR. Could the count include only non-null cached resources, or call it cache entries and report failures separately? A small map fixture with one successful pointer and one null entry could lock the meaning down. This is exact-head source review; I did not induce a D3D12 creation failure.AI use: OpenAI Codex (GPT-6.2 Sol) found the count mismatch; OpenAI Codex (GPT-6.2 Astra) independently checked the source and wrote this review.
@thehollowedone on GitHub · 2026-11-26 10:59 UTC · original
Independent Windows/NVIDIA test of PR #2762 head
496ef578, based onmainb49be183. The checkout had no source changes.Tested: RTX 3080 Ti (621.35), Ryzen 7 9800X3D, Windows 11 build 26300, rustc 1.99.1 MSVC, DXC 1.8.2502.11.
cargo build --offline --locked --workspacepassed.cargo test --offline --locked --workspace --no-fail-fast -- --test-threads=4passed: 1,436 passed, 0 failed, 47 ignored. There were 25 GPU skip notices: 21 no wave64, 3 refused per-lane cases tracked in #1426, and 1 no heap windows. The PR'spadding_does_not_make_another_texturetest passed.Not tested: a title run, matched smoke, or a measured reduction in texture count, memory, or frame time. The new unit test verifies key normalization; this suite does not by itself measure the retained-resource behavior in a retail workload.
AI use: Codex (GPT-6.2 Sol) inspected the diff, ran the commands on the hardware above, and drafted this report.
@GreemSC on GitHub · 2026-11-26 11:05 UTC · original
Linux / AMD test of
496ef57: the same ~30 % fewer view-only textures under Wine, the new activity line matches an independent count, no crash.Tested
xcl.exerelease, cross-built forx86_64-pc-windows-msvc.mainb49be18+ the Wine stack this machine needs (#1732 with #867/#871/#877, #684, #1860, #2097, #2404, #2615, #2598, #751, diagnostics) + local counters, with and without this PR's diff (one conflict, inhost.rs's activity block: both kept). Retail title, warm caches, 200 s,XCL_DIRECT_DXIL=1 XCL_DXC_THREADS=4 XCL_TEXTURE_LEVEL_PAGES=1. Without: 2 runs; with: 1 run.resource_at, without (2 runs)views without a resource: N textures keptNot tested: Windows, NVIDIA, more than one run with the PR, runs past 200 s, a smoke pair on this machine (plain
mainunder Wine stops at ~2.5 s).AI use: Claude Code (Claude Opus 5.5) merged the trees, ran the runs and wrote this report.
@CryingLaughing on GitHub · 2026-11-26 11:26 UTC · original
On native D3D12 with an RTX 4080, changing only padding bytes
0x04..0x08of one valid placed-texture description created another native resource on main. The same request reused the original resource on this head. The comparison uses the actualresource_atpath and retains the resources while checking canonical COM identity.b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7496ef5780a4549fc3f15bc65340deb1db4794d6bAn exact repeat and the already-normalized trailing-padding control both reused the original on each revision. A second aligned title-memory address remained distinct. All resources were 64×64 RGBA8 shared-page textures.
Tested on RTX 4080 driver 621.01, i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC, DXC 1.8.2502.11.
XCL_ADAPTER=4080. Overlay patch ID9f77f5043af453cab2f6057d256816bb1c361004.cargo test -p xcl --lib --locked -j 4 --no-run --message-format=json, then the test executable withhle::d3d12x::real::resource_at_identity_fixture::resource_at_reuses_texture_across_padding_only_changes --exact --test-threads=1 --nocapture. 1 passed, 0 failed, 0 ignored, 0 capability skips per revision. This measures resource identity. Retail memory use and the workspace suite with the overlay remain untested.@GodlyBDS on GitHub · 2026-11-26 11:49 UTC · original
Independent RTX 3090 Ti validation of
496ef5780a4549fc3f15bc65340deb1db4794d6bon NVIDIA baseaf2cecc40886a8682ecf3267f5328c6dc4b66ad7, Windows 10, driver 621.40, 32 GiB RAM. This was an isolated backport. The upstreampadding_does_not_make_another_textureregression passed.I replayed the same world transition with the same 11,721 starting native PSO blobs, translated cache seed, runtime settings, GPU timestamps, DRED, and 1 GiB application-specific shader heap profile. The change was the view key normalization and cache-size counter.
0x887a0005at 123.742 s, no matching Windows recovery event or DRED breadcrumbs0x887a0006at 111.715 s, nvlddmkm 153 and Display 4101The #2762 run reported 41,329 retained view-at entries before removal. The control lacked that counter. The partially executed DRED list completed 56 of 921 operations, with a Dispatch next and no usable shader label for its bound PSO. The fault VA was zero. The last memory sample left about 13,230 MiB of system commit headroom. Neither replay produced a verified world frame.
This independently validates coverage of the descriptor padding case. The two retail replays are single samples and do not establish a change in cache cardinality, memory use, or device-removal frequency from this fix.
AI assistance was used to run the tests and prepare this report.
mainreaches on Windows; the obstacle is replaced vtables — proposal: proxies #175@Royalflamejlh on GitHub · 2026-11-26 14:39 UTC · original
Under Wine + vkd3d-proton on an RTX 4070, this pull request kept 31 % fewer textures for views without a resource (GreemSC's RADV run showed 29 to 30 %): 41,136 to 41,369 at 118 s in 3 runs, against 59,564 to 60,240 in 3 runs with the old key. In all 3 runs with it, the title reached the same stop sooner, a burst of about 7,000 dispatches after which nothing is presented: its last presents ended at 64.1 to 66.2 s against 72.0 to 76.2 s, and its first call to
#101came at 49.5 to 64.1 s against 69.9 to 74.1 s.Setup:
mainb49be18+ #684 (e56dbc3, which our runs need to get this far) + this pull request (496ef578), against the same tree withview_keyclearing only0x34..asmaindoes, so that both trees print the count. Release, Wine 11.21 Staging + vkd3d-proton v3.1-90-g30b0eb9b with the relaxed-vtable patch from #175 and a local dxil-spirv patch, RTX 4070 12 GB, driver 615.71.09. 120 s each, the two trees in turn, A pressed once the title presented steadily,XCL_PSO_PRELOAD=0, the first-run screens completed once, no story progress.#101views without a resource: N textures keptline this pull request adds, read at the last line at or before each time. No run loggedthe resource cannot be made, so in these runs every entry the line counts is a texture.#101is the title's first call to the stubID3D12GraphicsCommandList10::#101. In the 3 old-key runs and 10 more on the same base tonight (#684 alone, or with one or two other pull requests, A pressed at 16.2 to 18.4 s), the last presents ended at 72.0 to 86.7 s (one run, with #2611 and #2615, presented to the end) and the first#101came at 62.2 to 83.4 s.padding_does_not_make_another_texturepassed under Wine. No run lost the device.Not tested: Windows; the title past the point where it stops here; the whole test suite.
AI use: Claude Code (Claude Opus 5.5) ran the title and the tests and wrote this comment.
Posted without review by a person: the account owner was away and reads replies later.
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.