Repository navigation
D3D12.X: global shader-visible sampler heap, typed UAV validation, and occlusion/query VA fixes - #1991
Conversation
|
A data point for the 2-plane path, from the retail title in Series S mode on Windows (RTX 3060 Laptop, NVIDIA
Glad to test this PR on the same setup when it is ready. AI use: Claude Code (Claude Opus 5.5). |
|
Overlap note: full credit to #615 (@0x6461726B) for multi-plane We will drop the duplicate |
|
Technical review findings: Blocking
Major
|
|
Full-suite run, since this PR has no test report yet. Tested exact head Tested
Not tested
AI use
|
fbbd982 to
71639e0
Compare
|
Thanks for the thorough review and pointers, Updated
Verified locally ( |
|
Regression run for this PR: head main this PR: No device removals or crashes; 99 % of main's frames, 104 % of its peak commit. Not tested: the whole suite; world loading; whether the title reaches all of the changed code in these 60 s (default settings: Written with Claude Code (Claude Opus 5.5) from runs on this machine. |
PR #1991 empirical verificationTested
What is in it
Tested
cargo test -p xcl --lib -- --show-output shared_sampler_pages_preserve_zero_slot_and_clamp_tails uav_format_promotion_and_linearization occlusion_tracks_dropped_draws_and_active_counter default_bound_heaps_always_includes_sampler_heap_when_available nested_occlusion_queries_end_the_outer_one_early resolve_query_data_applies_buffer_delta_to_pc_resolve_and_occlusion_writebackOne full suite run under the shared GPU lock: Set-ExecutionPolicy -Scope Process Bypass -Force
& 'L:/XclTooling/Invoke-ArcTest.ps1' -Test { cargo test --workspace --no-fail-fast -- --test-threads=4 --show-output }
All Not tested
AI use Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against |
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
|
Regression run of Against the limits in CONTRIBUTING.md: 101 % of AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, AI use: Claude Code (Claude Opus 5.5) built both trees and ran |
|
Fixes three D3D12.X runtime issues across shared sampler heaps, typed UAV validation, and occlusion/query tracking (multi-plane
Part of #1833. What is in it
Tested
Regression run main: PR: Both blocks were produced by Not tested
AI use
|
|
Thanks @Toons29 for running and sharing the exact-head 60 s |
|
Heads-up:
Reproduced on AI use: Claude Code (Claude Opus 5.5) found the failure, ran the test and wrote this note. |
Brings main to full parity with upstream/main (cdb0891), including: - World rendering & gameplay: xcl-dev#1991, xcl-dev#1988, xcl-dev#1984, xcl-dev#2028, xcl-dev#2078 - Memory / VRAM / PSO: xcl-dev#1985, xcl-dev#2157, xcl-dev#2178, xcl-dev#2195, xcl-dev#2176, xcl-dev#1996, xcl-dev#1914 - Direct DXIL & shaders: xcl-dev#2120, xcl-dev#2174, xcl-dev#2194, xcl-dev#2207, xcl-dev#1951, xcl-dev#1973, xcl-dev#2156, xcl-dev#2064 - Preserves local Linux/Wine customizations: docs/linux.md, scripts/linux/*, in-process Wine XAsync (xgameruntime/api.rs), loader watchdog bypass, and Wine MEM_WRITE_WATCH bypass on coherent UMA windows (gpu/uma.rs). Assisted-by: Antigravity (Gemini 4)
…LUID, and use device-aware footprints fallback Follow-up to #1988 and #1991 fixing three D3D12.X resource/format bugs in `crates/xcl/src/hle/d3d12x/device_x.rs` and `crates/xcl/src/hle/d3d12x/real.rs`: 1. Clear-value format mismatch on promoted B5G6R5 / B8G8R8X8 RT+UAV textures: #1991 promoted B5G6R5_UNORM (85) + UAV -> R8G8B8A8_UNORM (28) and B8G8R8X8_UNORM (88) + UAV -> B8G8R8A8_UNORM (87) in `pc_resource_desc`, but resource creation still mapped `clear.Format` via `pc_clear` (leaving 85/88 unchanged), causing D3D12 `CreateCommittedResource`/`CreatePlacedResource` to fail with `E_INVALIDARG`. Add `pc_clear_format` / `pc_clear_for_desc` to align `(28, 85) => 28` and `(87, 88) => 87` (preserving native 85/88 on RT-only textures without UAV) across `create_placed_resource_x`, `dev_create_committed_resource_x`, `dev_create_placed_resource_x` fallback, and `own_memory_if_larger_on_the_pc`. 2. Pointer-ABA stale cache in `device_format_supports_uav`: `UAV_FORMAT_SUPPORT` keyed by raw `device as usize` pointer without eviction on release; reusing a freed device address on another adapter returned stale UAV support. Key `UAV_FORMAT_SUPPORT` by `((luid.LowPart, luid.HighPart), format)` via `ID3D12Device::GetAdapterLuid()` (matching `TYPED_UAV_SUPPORT`). 3. Device-unaware retry in `get_copyable_footprints_x`: Retry used `pc_resource_desc(&x)` instead of `pc_resource_desc_for_device(this, &x)`, leaving device-unsupported `ALLOW_UNORDERED_ACCESS` intact so `GetCopyableFootprints` still returned `UINT64_MAX`. Switch to `pc_resource_desc_for_device(this, &x)`. Assisted-by: Google Antigravity (Gemini 4 Neon)
…checks in console_heap Follow-up to #1991 (shared shader-visible PC sampler heap `GLOBAL_SAMPLER`) fixing three bugs in `crates/xcl/src/hle/d3d12x/console_heap.rs`: 1. `release_global_sampler` pushed raw `(first, count)` entries into `s.free` without guarding `count == 0` or coalescing via `merge_release` (unlike `release_global`). Freeing adjacent small sampler pages (< 8 slots) left unmerged shards that could not satisfy an 8-slot `SAMPLER_PAGE_SLOTS` request, prematurely exhausting the 2048-descriptor `GLOBAL_SAMPLER` heap and dropping new pages onto reserved zero-sampler slot 0. Guard `count == 0` and coalesce through `merge_release(&mut s.free, first, count)`. 2. `in_global(obj)` checked `h.obj == obj && !h.pages.is_empty()` without `!h.sampler`, so shared sampler heaps (which now populate `h.pages`) falsely reported true for the shared view heap. Add `&& !h.sampler`. 3. `census()` compared sampler `w[3] & 0xFFF == k` instead of the shared sampler page index, misreporting live shared samplers as "with another" in `XCL_TRACE_FRAME`. Extract `sampler_own_index(&h.pages, k)` (matching `slot()` and view-heap `own_index`) and use it in `census()`. Assisted-by: Google Antigravity (Gemini 4 Neon)
Fixes three D3D12.X runtime issues across shared sampler heaps, typed UAV validation, and occlusion/query tracking (multi-plane
PresentXcompositing has been dropped from this PR and deferred cleanly to #615):console_heap.rs,list_x.rs,real.rs): enables a shared PC sampler heap (shared_sampler_heap,global_sampler_heap,SAMPLER_PAGE_SLOTS = 8with overflow mapped cleanly to reserved zero-sampler slot0), tracksBindings::has_sampler_heapsodefault_bound_heapsalways bindsGLOBAL_SAMPLEReven alongside non-global view heaps orheap_windows() == false, and avoids short-circuiting CPU-only sampler heaps inset_descriptor_heaps_x.device_x.rs,real.rs): addsdev_create_uav_checked_x(pc_uav_linear_format,pc_typed_uav_supportedkeyed byGetAdapterLuid(), handlingdesc == NULL/Format == 0sRGB/view mapping and matching null-viewViewDimensionto resource dimension) to bind a null view when host hardware lacksTYPED_UNORDERED_ACCESS_VIEWsupport, plus writing a valid null PC buffer SRV indev_create_srv_xwhenbuffer_delta != 0.resolve_query_data_xtracking (list_x.rs,bind.rs): tracks active occlusion query state and dropped draws (note_dropped_draw) so skipped draws andresolve_query_data_xstay coherent, guardingorig_fnwithreal::is_adopted(falling back toGetGPUVirtualAddress) and aligningunbinding_all_heaps_lets_the_shared_heap_be_bound_againwith shared sampler heap binding.Part of #1833.
What is in it
crates/xcl/src/hle/d3d12x/console_heap.rs,list_x.rs,bind.rs,device_x.rs,real.rs(5files;0changes inpresent.rs):shared_sampler_pages_preserve_zero_slot_and_clamp_tailsuav_format_promotion_and_linearizationocclusion_tracks_dropped_draws_and_active_counterdefault_bound_heaps_always_includes_sampler_heap_when_availableTested
rustc 1.99.1 (58cf8f9c3 2026-10-13), rebased cleanly onto0f293be(71639e0).cargo check --workspace --tests: passed.XCL_ADAPTER=warp cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=4: passed (shared_sampler_pages_preserve_zero_slot_and_clamp_tails,uav_format_promotion_and_linearization,occlusion_tracks_dropped_draws_and_active_counter,default_bound_heaps_always_includes_sampler_heap_when_available, andunbinding_all_heaps_lets_the_shared_heap_be_bound_againincluded and passed).scripts/smoke.ps1regression pair on AMD Radeon RX 9070 (@Toons29): passed (0 device removals, 0 crashes).Regression run
60 s
scripts/smoke.ps1pair on exact head71639e0vsmain(AMD Radeon RX 9070, driver 32.0.32029.2010, Windows 11 26300, release,XCL_NETWORK=0on a retail title), contributed by@Toons29:main:
this PR:
Not tested
scripts/smoke.ps1pair on71639e0, fullcargo test --workspacesuite, runtime GPU execution across AMD / NVIDIA / Intel hardware, and Linux/Wine/vkd3d-proton.AI use