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

Merged
Decodere merged 1 commit from upstream-pr/2323 into main 2026-11-25 18:16:20 +00:00
Decodere commented 2026-11-25 14:23:04 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by Decodere on 2026-11-25T14:23:04Z.


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).

<!-- greyfinch-sync:ivall/xcl:issue:6606669176 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2323). Originally posted by [Decodere](https://github.com/Decodere) on 2026-11-25T14:23:04Z. --- **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).
DarkPanda69 commented 2026-11-25 15:07:49 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DarkPanda69 on 2026-11-25T14:29:02Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7165348310 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2323#issuecomment-7165348310). Originally posted by [DarkPanda69](https://github.com/DarkPanda69) on 2026-11-25T14:29:02Z. --- **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.
nnonno91 commented 2026-11-25 15:07:50 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by nnonno91 on 2026-11-25T14:29:37Z.


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.

<!-- greyfinch-sync:ivall/xcl:comment:7165362911 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2323#issuecomment-7165362911). Originally posted by [nnonno91](https://github.com/nnonno91) on 2026-11-25T14:29:37Z. --- 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.
DavidM1911 commented 2026-11-25 18:04:43 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T17:53:01Z.


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!

<!-- greyfinch-sync:ivall/xcl:comment:7170132738 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2323#issuecomment-7170132738). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T17:53:01Z. --- 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!
upstream-sync closed this pull request 2026-11-25 19:08:11 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!2313
No description provided.