D3D12.X: ensure view and sampler descriptor heaps before console-list dispatches #2323

Manually merged
github merged 1 commit from gh-pr/2323/head into gh-pr/2323/base 2026-11-26 05:27:29 +00:00
Owner

@⁠Decodere on GitHub · 2026-11-25 14:23 UTC · original
Decodere:fix-1991-console-list-sampler-heap → main · +135 −12 · 1 files · 1 commits · merged 2026-11-25 18:16 UTC

What is in it

Follow-up to #1991 in crates/xcl/src/hle/d3d12x/console_list.rs:

  1. Track bound descriptor heaps across HEAPS_MARKER: Replaces the single heaps_set: bool flag in console_list::close() with (bound_heaps: Vec<ID3D12DescriptorHeap>, has_sampler_heap: bool). When HEAPS_MARKER has n == 0, close() now clears the command list via SetDescriptorHeaps(&[]) and clears (bound_heaps, has_sampler_heap) to match list_x::set_descriptor_heaps_x; when n > 0, it records the bound heaps returned by list_x::pc_heaps and whether a sampler heap is among them.
  2. Ensure view and sampler descriptor heaps before translated dispatches: Adds a pure generic default_dispatch_heaps helper (mirroring list_x::default_bound_heaps) and calls ensure_dispatch_heaps(&list, &mut bound_heaps, &mut has_sampler_heap) before each translated compute dispatch. When fewer than 2 heaps are bound, ensure_dispatch_heaps lazily initializes console_heap::shared_sampler_heap via list.GetDevice() if needed, filters shared heaps to the list's device, binds both view and sampler heaps when 0 heaps are bound (or sampler alone when !pso::heap_windows()), and upgrades 1-heap bindings missing either a view or sampler heap so directly-indexed translated pipelines (SAMPLER_HEAP_DIRECTLY_INDEXED) never dispatch with 0 sampler heaps bound.

Tested

  • cargo test --release -p xcl --lib hle::d3d12x::console_list::tests:: -- --test-threads=1 --nocapture on NVIDIA GeForce RTX 4060 and under XCL_ADAPTER="Microsoft Basic Render Driver" / XCL_ADAPTER=warp: 7 passed, 0 failed, 0 ignored (0 skipped), including:
    • default_dispatch_heaps_binds_and_upgrades_missing_view_or_sampler (pure CPU): covers 0-heap binding under both heap_windows modes (Some(view) and None), 1-heap view->view+sampler and sampler->view+sampler upgrades, no-op when satisfied, and (None, None).
    • gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps (D3D12, skip_test-guarded): exercises ensure_dispatch_heaps_with on a real ID3D12GraphicsCommandList across 0-heap bind, idempotent repeat call, SetDescriptorHeaps(&[]) reset + !heap_windows sampler-only bind, 1-view-heap upgrade, 1-sampler-heap upgrade, and list.Close().
  • Full release workspace (cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture on RTX 4060): 23 test binaries, 1267 passed, 0 failed, 46 ignored (28 pre-existing hardware/debug-layer SKIPPED: 21 no wave64 on 32-lane GPU, 3 wave32 per-lane refused, 2 missing D3D12 debug layer, 1 driver cache toggle, 1 no heap windows; 0 skipped in console_list).

Regression run

Paired 60 s scripts/smoke.ps1 runs on the same RTX 4060 host against origin/main (06c9f5505f63f10c5ec49ef932d75b2c28177324) and PR head (a78ffa89f64c31ed248b1e643e6ebb6c1b31455f):

Baseline (origin/main):

xcl-smoke v1
commit: 06c9f5505f63f10c5ec49ef932d75b2c28177324
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1450 (PresentX 1450)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14415 MB

PR head:

xcl-smoke v1
commit: a78ffa89f64c31ed248b1e643e6ebb6c1b31455f
gpu: NVIDIA GeForce RTX 4060
title: 29640639
seconds: 60
exit: 0x0
frames shown: 1505 (PresentX 1505)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14464 MB

Not tested

  • Retail title run with XCL_CONSOLE_LISTS=1 enabled (default smoke runs without XCL_CONSOLE_LISTS=1; descriptor-heap binding logic is verified directly by the unit and D3D12 command-list tests).
  • AMD/Intel GPUs and D3D12 debug-layer checks (d3d12SDKLayers.dll is not installed on this host).

AI use

Implemented and verified with Google Antigravity (Gemini 4 Neon).

**@⁠Decodere** on GitHub · 2026-11-25 14:23 UTC · [original](https://github.com/xcl-dev/xcl/pull/2323) `Decodere:fix-1991-console-list-sampler-heap` → `main` · +135 −12 · 1 files · 1 commits · merged 2026-11-25 18:16 UTC **What is in it** Follow-up to #1991 in `crates/xcl/src/hle/d3d12x/console_list.rs`: 1. **Track bound descriptor heaps across `HEAPS_MARKER`**: Replaces the single `heaps_set: bool` flag in `console_list::close()` with `(bound_heaps: Vec<ID3D12DescriptorHeap>, has_sampler_heap: bool)`. When `HEAPS_MARKER` has `n == 0`, `close()` now clears the command list via `SetDescriptorHeaps(&[])` and clears `(bound_heaps, has_sampler_heap)` to match `list_x::set_descriptor_heaps_x`; when `n > 0`, it records the bound heaps returned by `list_x::pc_heaps` and whether a sampler heap is among them. 2. **Ensure view and sampler descriptor heaps before translated dispatches**: Adds a pure generic `default_dispatch_heaps` helper (mirroring `list_x::default_bound_heaps`) and calls `ensure_dispatch_heaps(&list, &mut bound_heaps, &mut has_sampler_heap)` before each translated compute dispatch. When fewer than 2 heaps are bound, `ensure_dispatch_heaps` lazily initializes `console_heap::shared_sampler_heap` via `list.GetDevice()` if needed, filters shared heaps to the list's device, binds both view and sampler heaps when 0 heaps are bound (or sampler alone when `!pso::heap_windows()`), and upgrades 1-heap bindings missing either a view or sampler heap so directly-indexed translated pipelines (`SAMPLER_HEAP_DIRECTLY_INDEXED`) never dispatch with 0 sampler heaps bound. **Tested** - `cargo test --release -p xcl --lib hle::d3d12x::console_list::tests:: -- --test-threads=1 --nocapture` on NVIDIA GeForce RTX 4060 and under `XCL_ADAPTER="Microsoft Basic Render Driver"` / `XCL_ADAPTER=warp`: `7 passed, 0 failed, 0 ignored` (`0` skipped), including: - `default_dispatch_heaps_binds_and_upgrades_missing_view_or_sampler` (pure CPU): covers 0-heap binding under both `heap_windows` modes (`Some(view)` and `None`), 1-heap view->view+sampler and sampler->view+sampler upgrades, no-op when satisfied, and `(None, None)`. - `gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps` (D3D12, `skip_test`-guarded): exercises `ensure_dispatch_heaps_with` on a real `ID3D12GraphicsCommandList` across 0-heap bind, idempotent repeat call, `SetDescriptorHeaps(&[])` reset + `!heap_windows` sampler-only bind, 1-view-heap upgrade, 1-sampler-heap upgrade, and `list.Close()`. - Full release workspace (`cargo test --release --workspace --no-fail-fast -- --test-threads=4 --nocapture` on RTX 4060): `23` test binaries, `1267 passed, 0 failed, 46 ignored` (`28` pre-existing hardware/debug-layer `SKIPPED`: `21` `no wave64` on 32-lane GPU, `3` wave32 per-lane `refused`, `2` missing D3D12 debug layer, `1` driver cache toggle, `1` `no heap windows`; `0` skipped in `console_list`). **Regression run** Paired 60 s `scripts/smoke.ps1` runs on the same RTX 4060 host against `origin/main` (`06c9f5505f63f10c5ec49ef932d75b2c28177324`) and PR head (`a78ffa89f64c31ed248b1e643e6ebb6c1b31455f`): Baseline (`origin/main`): ``` xcl-smoke v1 commit: 06c9f5505f63f10c5ec49ef932d75b2c28177324 gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1450 (PresentX 1450) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14415 MB ``` PR head: ``` xcl-smoke v1 commit: a78ffa89f64c31ed248b1e643e6ebb6c1b31455f gpu: NVIDIA GeForce RTX 4060 title: 29640639 seconds: 60 exit: 0x0 frames shown: 1505 (PresentX 1505) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14464 MB ``` **Not tested** - Retail title run with `XCL_CONSOLE_LISTS=1` enabled (default smoke runs without `XCL_CONSOLE_LISTS=1`; descriptor-heap binding logic is verified directly by the unit and D3D12 command-list tests). - AMD/Intel GPUs and D3D12 debug-layer checks (`d3d12SDKLayers.dll` is not installed on this host). **AI use** Implemented and verified with Google Antigravity (Gemini 4 Neon).
Track `(bound_heaps, has_sampler_heap)` across `HEAPS_MARKER` records in
`console_list::close()` (clearing both via `SetDescriptorHeaps(&[])` when
`n == 0` to match `list_x::set_descriptor_heaps_x`) and call
`ensure_dispatch_heaps` before translated compute dispatches.

`ensure_dispatch_heaps` mirrors `list_x::default_bound_heaps` via a pure
`default_dispatch_heaps` helper, lazily creates `shared_sampler_heap` via
`list.GetDevice()` when missing (filtering heaps to the list's device), binds
both view and sampler heaps when 0 heaps are bound (or sampler alone when
`!heap_windows()`), and upgrades 1-heap bindings missing a view or sampler heap
so directly-indexed translated pipelines (`SAMPLER_HEAP_DIRECTLY_INDEXED`) never
dispatch with 0 sampler heaps bound.

Assisted-by: Google Antigravity (Gemini 4 Neon)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:27:28 +00:00
github manually merged commit a78ffa89f6 into gh-pr/2323/base 2026-11-26 05:27:29 +00:00
Author
Owner

@⁠nnonno91 on GitHub · 2026-11-25 14:29 UTC · original

Independent Radeon check of a78ffa89f64c31ed248b1e643e6ebb6c1b31455f.

Tested

  • AMD Radeon(TM) Graphics driver 32.0.21042.62, Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC, unoptimized profile.
  • On the unchanged head, cargo test --locked -p xcl --lib hle::d3d12x::console_list::tests:: -- --nocapture --test-threads=1 gave 7 passed, 0 failed. This fixture uses the D3D12 default device.
  • I changed only the GPU fixture's device selection to explicitly select and print AMD Radeon(TM) Graphics. cargo test --locked -p xcl --lib gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps -- --nocapture --test-threads=1 then passed on the Radeon. It exercised empty bindings, sampler-only and one-heap upgrades, repeat binding and command-list close. Both runs had 0 ignores and no skips. The selection edit was restored.

Not tested

Retail smoke, the full workspace suite, and GPU shader output from a translated dispatch in this check.

AI use

OpenAI Codex (GPT-6.2 Sol) adapted the test fixture, ran the checks and wrote this report.

**@⁠nnonno91** on GitHub · 2026-11-25 14:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2323#issuecomment-7165362911) Independent Radeon check of `a78ffa89f64c31ed248b1e643e6ebb6c1b31455f`. **Tested** - AMD Radeon(TM) Graphics driver 32.0.21042.62, Ryzen 7 9800X3D, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC, unoptimized profile. - On the unchanged head, `cargo test --locked -p xcl --lib hle::d3d12x::console_list::tests:: -- --nocapture --test-threads=1` gave 7 passed, 0 failed. This fixture uses the D3D12 default device. - I changed only the GPU fixture's device selection to explicitly select and print AMD Radeon(TM) Graphics. `cargo test --locked -p xcl --lib gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps -- --nocapture --test-threads=1` then passed on the Radeon. It exercised empty bindings, sampler-only and one-heap upgrades, repeat binding and command-list close. Both runs had 0 ignores and no skips. The selection edit was restored. **Not tested** Retail smoke, the full workspace suite, and GPU shader output from a translated dispatch in this check. **AI use** OpenAI Codex (GPT-6.2 Sol) adapted the test fixture, ran the checks and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 17:53 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!

**@⁠DavidM1911** on GitHub · 2026-11-25 17:53 UTC · [original](https://github.com/xcl-dev/xcl/pull/2323#issuecomment-7170132738) 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!
Author
Owner

@⁠DarkPanda69 on GitHub · 2026-11-25 14:29 UTC · original · edited 2026-11-25 19:29 UTC

Correction: gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps creates its device with agility::create_device(None, ..), so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whatever XCL_ADAPTER says. Both runs of that test below were on the RX 9070 XT: the AMD result stands, but the RTX 3060 line for this test is not an RTX 3060 result. The per-card gpu:: counts are unaffected.


AMD run, plus an RTX 3060: the new GPU test passes on both, and nothing else in the GPU suite changes.

Head a78ffa8 applied on main 06c9f55, debug, Windows 11 Pro 26200, cargo test -p xcl --lib -- gpu:: --test-threads=4:

  • RX 9070 XT (RDNA4, driver 32.0.32029.2010): gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps ok. 638 passed, 2 failed, 22 ignored; the 2 failures are the AMD fuzz seeds tracked in #2115, the same on main.
  • RTX 3060 (driver 32.0.16.1088): the new test ok; 640 passed, 0 failed, 22 ignored.

Not tested: a title with XCL_CONSOLE_LISTS=1, the D3D12 debug layer (not installed here).
AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.

**@⁠DarkPanda69** on GitHub · 2026-11-25 14:29 UTC · [original](https://github.com/xcl-dev/xcl/pull/2323#issuecomment-7165348310) · edited 2026-11-25 19:29 UTC **Correction:** `gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps` creates its device with `agility::create_device(None, ..)`, so it runs on DXGI adapter 0, which on this machine is the RX 9070 XT, whatever `XCL_ADAPTER` says. Both runs of that test below were on the RX 9070 XT: the AMD result stands, but the RTX 3060 line for this test is not an RTX 3060 result. The per-card `gpu::` counts are unaffected. --- AMD run, plus an RTX 3060: the new GPU test passes on both, and nothing else in the GPU suite changes. Head `a78ffa8` applied on `main` `06c9f55`, debug, Windows 11 Pro 26200, `cargo test -p xcl --lib -- gpu:: --test-threads=4`: - **RX 9070 XT** (RDNA4, driver 32.0.32029.2010): `gpu_ensure_dispatch_heaps_binds_view_and_sampler_heaps` ok. 638 passed, 2 failed, 22 ignored; the 2 failures are the AMD fuzz seeds tracked in #2115, the same on `main`. - **RTX 3060** (driver 32.0.16.1088): the new test ok; 640 passed, 0 failed, 22 ignored. Not tested: a title with `XCL_CONSOLE_LISTS=1`, the D3D12 debug layer (not installed here). AI use: Claude Code (Claude Opus 5.5) ran the tests on this machine and wrote this report.
This discussion has been locked. Commenting is limited to contributors.
No description provided.