D3D12.X: global shader-visible sampler heap, typed UAV validation, and occlusion/query VA fixes #1991
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!1991
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1991/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?
@raylitebull on GitHub · 2026-11-25 00:27 UTC · original
raylitebull:feat/victory-main-world-fixes-v2→main· +635 −78 · 5 files · 1 commits · merged 2026-11-25 10:40 UTCFixes 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
@yinx080 on GitHub · 2026-11-25 00:44 UTC · original
A data point for the 2-plane path, from the retail title in Series S mode on Windows (RTX 3060 Laptop, NVIDIA
610.91):
UI plane with the menus (the account prompt). With only plane 0 shown, the window stays black on the prompt.
ID3D12Resource**at +0x10, …). Readingplane 1 at +0x40 found nothing.
alpha
ONE/INV_SRC_ALPHA) showed the prompt.Glad to test this PR on the same setup when it is ready.
AI use: Claude Code (Claude Opus 5.5).
@raylitebull on GitHub · 2026-11-25 00:47 UTC · original
Overlap note: full credit to #615 (@0x6461726B) for multi-plane
PresentXoverlay compositing (present.rs).We will drop the duplicate
present.rs2-plane compositing changes from #1991 in favor of #615 so #1991 stays scoped strictly to its independent D3D12.X fixes: the global shader-visible PC sampler heap, typed UAV sRGB/cap validation, andresolve_query_data_x/ occlusion dropped-draw fallback.@gsucristo on GitHub · 2026-11-25 00:57 UTC · original
Technical review findings:
Blocking
set_descriptor_heaps_xforwards CPU-only sampler heaps whenglobal_heap()isNone(list_x.rs,pc_heaps+real.rs,dev_create_descriptor_heap_x):dev_create_descriptor_heap_xstripsSHADER_VISIBLEfrom title sampler heaps whenevershared_sampler_heap(dev)is true, butset_descriptor_heaps_xstill short-circuits whenglobal_heap().is_none(), forwarding the downgraded CPU-only sampler heap directly to PCSetDescriptorHeaps.console_heap.rs,GLOBAL_SAMPLER_MAX,SAMPLER_PAGE_SLOTS,slot): Once the 63 pages (SAMPLER_PAGE_SLOTS = 32, wasting 31 slots at the tail and up to 31 per small heap) fill up,reserve_global_samplerreturnsNone,slot()falls back to(k, 0), andpublish()becomes a no-op — while shaders still bindGLOBAL_SAMPLERand indexkinto unrelated samplers.default_bound_heapsskips bindingGLOBAL_SAMPLERwhen a non-global view heap is bound orheap_windows()is false (list_x.rs,default_bound_heaps): Only appendssamplerwhencurrent.is_empty()orcurrent == [v], leaving 0 sampler heaps bound forSAMPLER_HEAP_DIRECTLY_INDEXEDwheneverview == Noneor a non-global view heap is bound.Major
dev_create_uav_checked_x(real.rs): Whendescis non-null withdesc.Format == DXGI_FORMAT_UNKNOWN (0)(ordescis null),eff_fmt != raw_fmt && raw_fmt != 0skips patching sRGB/promoted formats. Also the null-view fallback hardcodesD3D12_UAV_DIMENSION_TEXTURE2Dregardless of resource dimension, andTYPED_UAV_SUPPORTcaches by raw device pointer without invalidation.dev_create_srv_xbuffer SRV early-return (real.rs): Leavesslot.pc_srv(and itsGLOBALslot) uninitialized/stale for any PC/fallback shader reading that slot, and leaves the duplicateD3D12_SRV_DIMENSION_BUFFERbranch below dead.present.rs2-plane compositor (if kept):try_composite_two_planeschecksui_descfor MSAA/TEXTURE2Dbut notsrc_desc;build_compositorcallsreal::orig_fnwithoutreal::is_adopted; failedbuild_compositorretries full RS/heap/PSO creation every frame.@futurepro62 on GitHub · 2026-11-25 01:00 UTC · original · edited 2026-11-25 01:11 UTC
Full-suite run, since this PR has no test report yet. Tested exact head
fbbd982(on its base6567c5f).Tested
cargo build --workspace, thenXCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip gpu::recomp::lower_dxil::tests::f16_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f32_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::integer_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::f64_programs_on_the_gpu --skip gpu::recomp::lower_dxil::tests::const_and_null_mask_operands_agree_with_hlsl_on_the_gpu --skip gpu::dxil::fuzz_tests: 992 passed, 0 failed, 43 ignored. SKIPPED (no wave64):a_2d_or_3d_group_agrees_with_the_hlsl_path_on_the_gpu,a_per_lane_2d_or_3d_group_runs_on_the_gpu,coalesced_guarded_runs_agree_with_the_hlsl_path_on_the_gpu,cross_lane_reads_agree_with_the_hlsl_path_on_the_gpu,gpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware,the_wave64_lowering_agrees_with_the_hlsl_path_on_the_gpu.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,extract_present_planes_reads_series_s_two_plane_stride,composite_shaders_compile_to_sm5_dxbc.XCL_ADAPTER=radeon),cargo test --workspace -- --test-threads=4 --skip gpu::dxil::fuzz_tests::fuzz_validate_and_gpu_1: 1002 passed, 0 failed, 45 ignored. SKIPPED:f16_programs_on_the_gpu(f16 arithmetic, wave32, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 arithmetic, wave64, per-lane form: refused (unsupported V_MUL_F16 (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave32, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f16_programs_on_the_gpu(f16 packed, wave64, per-lane form: refused (unsupported V_PK_MUL_F16: VOP3 modifiers (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave32, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),f32_programs_on_the_gpu(f32 conversions, wave64, per-lane form: refused (unsupported V_CVT_F16_F32 (its #1426 semantics differ from the console's))),heap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).--skipleaves out tests that fail on main7994cd1too, not because of this PR. On NVIDIA:heap_window_out_of_memory_falls_back_to_the_switch_form(#1651), the fourgpu::recomp::lower_dxil::tests::*_programs_on_the_gputests andconst_and_null_mask_operands_agree_with_hlsl_on_the_gpu(follow-up on #1651) fail becauserunner::skip_testturns their skips into failures underXCL_REQUIRE_GPU=mesh, andgpu::dxil::fuzz_testsseeds 70, 545, 1019 and 1507 failCreateComputePipelineStatewithE_OUTOFMEMORYon this card (drivers 616.64 and 621.40). On AMD:fuzz_validate_and_gpu_1fails on seed 540 (res[833]0x7 vs CPU 0x6). The AMD run does not setXCL_REQUIRE_GPU.Not tested
AI use
@raylitebull on GitHub · 2026-11-25 01:15 UTC · original
Thanks for the thorough review and pointers,
@gsucristoand@0x6461726B!Updated
#1991cleanly onto0f293be(71639e0):present.rs2-plane compositing hunks:0changes inpresent.rsnow, deferring multi-plane compositing cleanly to#615and eliminating overlap with#1988.list_x.rs,console_heap.rs,real.rs):set_descriptor_heaps_xno longer short-circuits whenglobal_sampler_heap().is_some()(never forwardingSHADER_VISIBLE-stripped CPU-only sampler heaps).SAMPLER_PAGE_SLOTS(32 -> 8) and mappedGLOBAL_SAMPLERexhaustion on hosted sampler heaps to reserved zero-sampler slot0instead of aliasing(k, 0).Bindings::has_sampler_heapsodefault_bound_heapsappendsGLOBAL_SAMPLEReven with non-global view heaps orheap_windows() == false(and prepends the shared view heap when only a sampler heap is bound).dev_create_uav_checked_xhandlesdesc == NULL/desc.Format == 0sRGB/view mapping, matches null-viewViewDimensionto resource dimension, and keysTYPED_UAV_SUPPORTbyGetAdapterLuid().dev_create_srv_xwrites a valid null PC buffer SRV (and publishes) whenbuffer_delta != 0soslot.pc_srv/GLOBALare never stale, and drops the dead duplicate buffer branch.real::is_adoptedguard onresolve_query_data_x+unbinding_all_heapstest alignment.Verified locally (
cargo check --workspace --tests+XCL_ADAPTER=warp cargo test -p xcl --lib hle::d3d12x:: -- --test-threads=4).@Anon64 on GitHub · 2026-11-25 01:47 UTC · original
Regression run for this PR: head
76d2681, based onmain80f4819. RTX 3060 12 GB (581.80, wave32), Windows 11 26200, release,XCL_NETWORK=0, A pressed every 4 s from 20 s,scripts/smoke.ps1on a retail title for 60 s, in one batch with themainrun.main
80f4819: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:
XCL_DIRECT_DXILandXCL_HEAP_WINDOWSunset).Written with Claude Code (Claude Opus 5.5) from runs on this machine.
@JJAutoCompare on GitHub · 2026-11-25 02:25 UTC · original
PR #1991 empirical verification
Tested
xcl-dev/xclPR #1991 at71639e02ba90f85d8ba36ef638402e8ee2971e28. The live PR ref still matched after the run, and the worktree was clean before and after testing.git merge-tree --write-tree origin/main HEADexited 0 against the initialorigin/mainataaa093657bd96a146c05c0c1a9b61149fe761453(treeb10a58c30a14c5f6c7f2c337fc87448065f78e10). The recheck against the updatedorigin/mainatcbc296ab65a2661a61e3e2da109134bcd5319f60also exited 0 (treea1b8f61cdd9b7453c47356c6ed6862fc92e7f7de).What is in it
console_heap.rs,list_x.rs).device_x.rs,real.rs).bind.rs,list_x.rs).Tested
32.0.101.9175,DoublePrecisionFloatShaderOps=0, wave size 8–32), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation build26200.9974.rustc 1.100.0 (0ef1bc386 2026-11-09), DXC/DXIL1.9.2609.5, unoptimized dev and test profiles with debug info and incremental compilation disabled.XCL_ADAPTER=A770.cargo build --workspaceandcargo test --workspace --no-runboth exited 0 outside the GPU lock.SKIPPEDmarkers). The same six also passed in the workspace run.One full suite run under the shared GPU lock:
SKIPPEDmarkers across 16 named tests, including tests that skipped individual cases. Skipped cases do not add coverage. Seepr1991-suite.login this directory for the complete run.xcl --libreported 25 failures. In 21,CreateComputePipelineStatereturned0x80070057. The other four were result mismatches ingpu_nonfused_mad_and_mac_prevent_fma_contraction,gpu_ps_image_sample_offset_implicit_lod_between_mips,gpu_valu_16_and_64_bit, andgpu_wave64_ps_whole_wave_reductions.xcl --test e2ereported one failure intest_title_runs_and_game_folder_is_untouched. The dynamic depth bias check (#94) read blue[0, 0, 255, 255]where it expected green afterRSSetDepthBiasX(-1000.5).All
SKIPPEDlines from the suite:Not tested
maintest run or retail-title smoke comparison. The suite alone does not establish which failures reproduce onmain.XCL_SAMPLE_RPFunset, yielded no sample coverage. The suite also reported early returns for missing audio and system XGameRuntime.AI use
Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified the counts against
pr1991-suite.logand published this report.@DavidM1911 on GitHub · 2026-11-25 03:31 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Toons29 on GitHub · 2026-11-25 03:49 UTC · original
Regression run of
71639e02on the retail title, for this PR's Regression run section. Both blocks are fromscripts/smoke.ps1as printed, not edited:mainoncbc296ab, this PR on its head commit with no uncommitted changes, same title and time.Against the limits in CONTRIBUTING.md: 101 % of
main's frames, 101 % of its peak commit, no crash, no device removal.AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0,
cargo build --release -p xcl, 60 s,XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.AI use: Claude Code (Claude Opus 5.5) built both trees and ran
scripts/smoke.ps1; a script posted this right after the run, with both blocks exactly as printed.@mokkamokacaffe on GitHub · 2026-11-25 05:02 UTC · original
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).XCL_NETWORK=0: 101% of main's frames, 101% of its peak commit, no crash and no device removal.Regression run
main:
PR:
Both blocks were produced by
scripts/smoke.ps1from clean trees, with the same title and duration. This checks startup/menu stability; it does not prove that the run reached every path changed by this PR.Not tested
cargo test --workspacesuite.AI use
@raylitebull on GitHub · 2026-11-25 10:38 UTC · original
Thanks @Toons29 for running and sharing the exact-head 60 s
scripts/smoke.ps1pair on71639e0(0 device removals, 0 crashes) — added to the PR description!@Kalmarv on GitHub · 2026-11-25 10:52 UTC · original
Heads-up:
mainfails a unit test since this merge (cbfc67bc, still onaaa931b2), so "Build and test" fails on every PR's merge commit (seen on #1912's run, job 139149025089).main's own runs on both commits were cancelled, so they did not show it.device_x::tests::pc_resource_desc_strips_uav_on_unsupported_formats_and_msaapanics withformat 85 kept(left 28, right 85).587d77be). It expects B5G6R5 (85) with ALLOW_UNORDERED_ACCESS to keep its format and lose the flag.71639e02from this PR promotes it to R8G8B8A8_UNORM (28) instead, and its own test atdevice_x.rs:1523expects that.Reproduced on
aaa931b2withcargo test -p xcl --lib --release -- pc_resource_desc_strips_uav: 0 passed, 1 failed. Which behaviour is wanted is yours to say; the two tests can't both pass.AI use: Claude Code (Claude Opus 5.5) found the failure, ran the test and wrote this note.