D3D12.X: ask for tiled support before making a GPU-owned texture reserved (#940) #951
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!951
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/951/head"
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?
@artor410 on GitHub · 2026-11-24 09:24 UTC · original
artor410:fix/940-reserved-depth-fallback→main· +79 −8 · 1 files · 1 commits · merged 2026-11-24 11:03 UTCPart of #940. Some drivers have no
TILEDsupport forR32G8X24_TYPELESSdepth, at 1 or 4 samples. Todayplace_on_pagesstill callsCreateReservedResource, gets refused (debug layer errors 738 / 723), and only then falls back to an arena. This PR asks the device first and goes to the arena directly. The result is the same arena texture, without the failed call or the debug-layer error.If a query itself fails,
reservablereturns yes, so creation decides as before. This does not address 1422 (first RT/DS use without Discard/Clear), 538 or 824 from the issue. Those need a separate change.What is in it
vram.rs:can_reserve(pure) andreservable(device query), checked beforeCreateReservedResource. The arena log line now gives the reason.reserved_needs_tiled_format_and_tiled_msaa(unit) andreservable_agrees_with_the_driver(GPU, or WARP if no hardware adapter). The second checks thatreservablematches whatCreateReservedResourceactually does for R32G8X24_TYPELESS ×1/×4, R32_TYPELESS and RGBA8. Both failed to compile before the fix and pass after it.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4: 715 passed, 3 failed, 41 ignored (SKIPPED GPU tests:gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware: no wave64)placed_title_textures_share_vram_and_preserve_pixels(cubemap page count under parallel tests), thentransitions_apply_when_their_list_is_submittedandd32s8_targets_take_their_own_size_of_video_memory(poisonedVRAM_TEST_LOCK). Main077ce40fails the same 3, twice in a row. All 3 pass with--test-threads=1on this branch.d32s8_targets_…now logsformat 19 … not reserved (no tiled support for its format or sample count): in an arena, so the new path is exercised.Regression run
I have no retail title to run. Both runs below use the repo's own test title (
tests/data/testgame+xcl_testtitle.exe, assembled as ine2e.rs). It stops at itsargvcheck becausesmoke.ps1passes no--hello, and it behaves the same on both builds.main:
PR:
Not tested
XCL_D3D12_DEBUG=1, which is what would confirm 738/723 are gone. The test title never creates these depth targets.AI use
Two-way door: one early return in front of an existing fallback. The blast radius is GPU-owned texture placement only.
🤖 Generated with Claude Code
@ettehn on GitHub · 2026-11-24 09:26 UTC · original
Verified
38ea451on native Windows, RTX 5070 Ti Laptop. All 9hle::d3d12x::vram::testspassed. For the 3840×2160 format-19 depth targets, the placement log changed from the old driver refusal (0x80070057) tono tiled support for its format or sample count, followed by successful arena placement. The depth/stencil readback test also passed.One small edge in
reservable: whenFORMAT_SUPPORTsucceeds with TILED clear, the code still queries MSAA for multisampled textures. If that second query errors, it returns true even though the first query already ruled the format out. An earlyreturn falseon a known-clear TILED bit would preserve the first result and avoid the second query for these formats. This is from code inspection; my adapter passed the driver comparison. No retail files used.Verification assisted by OpenAI Codex (GPT-6.2 Astra).
@dcastell1 on GitHub · 2026-11-24 09:53 UTC · original
Verified on Windows 11 10.0.26300, NVIDIA GeForce RTX 5090 (driver 621.24), Rust 1.100.0 MSVC 14.44.35207, debug build, on
main@077ce40(baseline 716 passed, 0 failed, 41 ignored on this box):Two more passing tests than the baseline; asking for tiled support before making a GPU-owned texture changes no verdict.
Tree restored afterwards (full diff against a clean checkout), hardware adapter, no Wine, no game data. AI-assisted (opencode): applied the patch to a built tree, ran the suite, reverted it.
@oVolkra on GitHub · 2026-11-24 10:05 UTC · original
Tested
38ea451(PR head, based on077ce40) on an RTX 3060 12 GB, driver 617.14, Ryzen 5 5600X, 15.9 GB RAM, Windows 11 10.0.26100, rustc 1.100.0, debug.New tests:
reserved_needs_tiled_format_and_tiled_msaaandreservable_agrees_with_the_driverpass in both full runs that reached them, andcargo test -p xcl --lib hle::d3d12x::vram -- --test-threads=1gives 7 passed, 0 failed.New path: here the driver reports no TILED support for R32G8X24_TYPELESS (1 and 4 samples; a temporary, uncommitted
eprintlnshowedSupport2 = 0x0), andd32s8_targets_…logsnot reserved (no tiled support for its format or sample count): in an arenainstead of(0x80070057). Main077ce40logs the old0x80070057.Whole suite (
cargo test --workspace --no-fail-fast -- --test-threads=1, 2 SKIPPED:gpu_geometry_wave32_prefix_count_over_a_maskandgpu_wave32_program_in_wave64_hardware, no wave64):38ea451-p xcl --libaborted:memory allocation of 3145728 bytes failed077ce40The failures are not from the PR: main's run 2 fails the same 5 tests as the PR's run 2. They are
sparse::…ensure_mapped_with_query_holes…andtitle_textures::gpu_mirror_upload_…withE_OUTOFMEMORY(0x8007000E), thenplaced_title_textures_…,transitions_apply_…andd32s8_targets_…withPoisonErrorfrom the poisonedVRAM_TEST_LOCK. This PC cannot always run the whole suite.Not tested:
scripts/smoke.ps1and any title,--test-threads=4, AMD, the earlyreturn falsesuggested by ettehn.Not explained: in 3 isolated runs of
d32s8_targets_…right after a full suite, the log showed the old0x80070057(soreservablelet it through; by design it says yes when its query fails). It did not repeat in the next 6 runs.AI use: Claude Code, Claude Sonnet 5.5, ran the tests and wrote this report.
@eizispark on GitHub · 2026-11-24 10:31 UTC · original
Hardware check of
38ea451dc69d11119bd27c334292c3093e3c0030(verified clean merge withmain6efdabc): pass.Tested
rustc 1.100.0 (0ef1bc386 2026-11-09), release + test profilecargo test --workspace -- --test-threads=4:715 passed, 3 failed, 41 ignored(GPU tests skipped on this adapter:none); the 3 parallel failures were the known concurrent VRAM/lock-poison set (hle::d3d12x::title_textures::tests::placed_title_textures_share_vram_and_preserve_pixelsand downstreamPoisonErrors inhle::d3d12x::vram::tests::d32s8_targets_take_their_own_size_of_video_memoryandhle::d3d12x::title_textures::tests::transitions_apply_when_their_list_is_submitted), each1 passed, 0 failedsolo (--exact --test-threads=1)cargo test -p xcl --lib hle::d3d12x::vram::tests -- --test-threads=1:9 passed, 0 failed(reserved_needs_tiled_format_and_tiled_msaaandreservable_agrees_with_the_driverpass; on RDNA4 the driver also reports noTILEDsupport forR32G8X24_TYPELESS, sod32s8_targets_take_their_own_size_of_video_memorylogsnot reserved (no tiled support for its format or sample count): in an arenabeforeCreateReservedResourceand places all 143840x2160D32S8 targets directly in arenas)Regression run
main(6bac4b4):PR (
38ea451):Not tested
XCL_D3D12_DEBUG=1; gameplay past the menusAI use
scripts/smoke.ps1harness on this machine and formatted this report.@SlopTart on GitHub · 2026-11-24 10:38 UTC · original
Linux / AMD RDNA3 datapoint.
Merged state: head
38ea451onto main9aec53d, clean merge.Full suite,
cargo test --workspace --release --no-fail-fast --target x86_64-pc-windows-gnu -- --test-threads=4: 715 passed, 11 failed, 41 ignored; failures are the known Wine-lane set from my #42 rows plus this rig's title-textures flake family (see #718). tiled-support probe for GPU-owned textures green.Not tested: retail titles (none here), Windows, RDNA4.
Counts only, no game data.
Machine: RX 7900 XT (RADV NAVI31), Mesa 26.2.5, kernel 7.2 (Arch), Proton Experimental (wine-11.0), patched vkd3d-proton v3.1, Rust cross
x86_64-pc-windows-gnu,XCL_NETWORK=0, release profile,--test-threads=4. My Linux rows: #42 / #718.AI use: Hermes agent (local Qwen-class) ran the suite and drafted this; I checked it before posting.
@raylitebull on GitHub · 2026-11-24 10:41 UTC · original
Looks very close — just two small items to tidy up before merge: (1) return
falseearly whenD3D12_FORMAT_SUPPORT2_TILEDis unset (before running the MSAA quality-level query), and (2) refresh thexcl-smokeblock so thePR descriptioncheck passes.@ivall on GitHub · 2026-11-24 11:04 UTC · original
Merged in
6828e07– thanks. On top of it,24d8b92takes the review point of @ettehn and @raylitebull: with TILED clear,reservablenow says no before the MSAA query, so a failing second query cannot send the texture to CreateReservedResource again. On the retail run below the new path was taken for 4 depth textures (no tiled support for its format or sample count). Tested on the merged batch (#990, #1037, #951, #1016):cargo test --workspace --no-fail-fast -- --test-threads=4: 741 passed, 0 failed, 41 ignored, no SKIPPED. Retail title, 90 s with scripted presses, againstmainbefore the batch the same way: exit 0, no crash, no device removal, 1500 frames, peak process commit 27.7 GB against 29.2 GB.@mikebuckets171 on GitHub · 2026-11-24 11:29 UTC · original
The inputs of this gate, measured on a macOS / D3DMetal host - and this host is exactly the shape your change guards against.
Host: MacBook Pro M5 Pro (48 GB), macOS 27.2.1, CrossOver 26 with D3DMetal (the adapter reports "AMD Compatibility Mode"), Rosetta 2. A plain D3D12 program (no XCL, no game content), cross-built with LLVM-MinGW (clang 23.1.6), run under Wine. Feature level requested 12_1,
MaxSupportedFeatureLevel0xc100.Device (
CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS), S_OK):TiledResourcesTier 2,ResourceBindingTier 3,ResourceHeapTier 2,StandardSwizzle64KBSupported 0,MaxGPUVirtualAddressBitsPerResource 64.So
Pages::new()'s tier check passes here: on this host the "textures in title memory, tiled resources on 64 KiB pages" path is taken rather than the arena fallback - whileStandardSwizzle64KBSupportedreads 0.Per-format
Support2: none of these formats reportsD3D12_FORMAT_SUPPORT2_TILED(0x200). All queries S_OK:Support1Support2R32G8X24_TYPELESSD32_FLOAT_S8X24_UINTD24_UNORM_S8_UINTD32_FLOATR32_FLOATR8G8B8A8_UNORM/B8G8R8A8_UNORM/R8G8B8A8_UNORM_SRGBR16G16B16A16_FLOATBC7_UNORMThe MSAA half is the permissive part, which is what your ordering change fixes:
CheckMultisampleQualityLevelsreturns S_OK withNumQualityLevels = 1for every format above at 1, 2, 4 and 8 samples - including the typeless depth formats. So on this host, before this changereservable()said yes forR32G8X24_TYPELESSat 1 and 4 samples (the #940 pair) purely from the quality-level query, andCreateReservedResourcethen had to refuse it. With the TILED check first, reservation is declined up front and the driver call never happens - the sequence your commit message describes, on a second host.One thing this host shows that is worth keeping in mind for the rest of the VRAM work: the two gates disagree here. The device says
TiledResourcesTier 2, yet no format'sSupport2carries TILED. So on D3DMetal, tier 2 does not imply any reservable format - if anything downstream treats a passing tier as "reserved textures will work", this host is a counter-example, and the format query is the one that actually decides per texture.Not tested here: a title actually creating reserved resources or tiled MSAA textures; no native-Windows or AMD-driver comparison (I have no host where
Support2is expected to carry TILED, so I cannot show what a "yes" looks like in the same table);Support2was read for the ten formats above, not for every format XCL can be asked for.Host: macOS 27.2.1 (Apple silicon, M5 Pro), CrossOver 26, D3DMetal; local inference unloaded and the bottle's wineserver stopped for the run. The probe is a ~300-line plain D3D12 PE with no XCL in it and it reads no files. AI use: GPT-6 Luna wrote and ran the probe and drafted this comment; the codes, masks and tier values are from that run.