Run the GPU tests on any adapter: XCL_ADAPTER, mesh-shader check, the test title's device from d3d12_xs #41

Manually merged
github merged 5 commits from gh-pr/41/head into gh-pr/41/base 2026-11-26 04:05:55 +00:00
Owner

@⁠grahamster2 on GitHub · 2026-11-22 19:48 UTC · original
grahamster2:adapter-select → main · +230 −30 · 10 files · 5 commits · merged 2026-11-22 21:37 UTC

Summary

Running the test suite on each GPU of a two-GPU machine (NVIDIA RTX 3080 + the AMD Radeon iGPU of a Ryzen 5 7600X) turned up three things, one commit each:

  1. XCL_ADAPTER: pick the D3D12 adapter. The title's device took the first hardware adapter in high-performance order and the GPU test bench always took adapter 0, so the second GPU could not be tested. d3d12_adapter in xcl.toml now also takes a number (that hardware adapter in high-performance order) or a part of the adapter's name (radeon, rtx 3080). XCL_ADAPTER overrides it, the same way XCL_RAYTRACING overrides raytracing. The new gpu::adapter module holds the choice, and hle::d3d12x::real and gpu::recomp::runner both use it. If the name matches no adapter, the title logs the adapters it found and falls back to auto. The test bench gives the same message as its skip reason. auto / warp behave as before.

  2. Mesh draws are skipped on adapters without mesh shaders. gpu_mesh_mode_two_passes and gpu_geometry_mode_es_gs_strip failed with E_INVALIDARG at mesh PSO creation on the RDNA2 iGPU. That adapter has wave 32–64 but reports MeshShaderTier NOT_SUPPORTED. The runner now reads D3D12_OPTIONS7, and the two tests skip with a note, as the wave64 tests do.

  3. The test title takes its device from d3d12_xs.dll. The title declares D3D12CreateDevice / D3D12SerializeRootSignature as raw-dylib imports from d3d12_xs. The windows crate imports the same two symbols from d3d12.dll, and the linker keeps that one: xcl inspect on the built title shows d3d12.dll: 2 Windows and no d3d12_xs import. So the title called the system's D3D12CreateDevice(NULL). D3D12 hands out one device per adapter, so the title still got XCL's device as long as XCL's adapter was the default adapter, and the e2e checks passed. On another adapter the title got a device XCL had never adopted. 5 D3D12.X checks then failed (no fallback PSO, no IDXGIDevice1, CreatePlacedResourceX E_INVALIDARG) and the run ended in an access violation in D3D12Core.dll. This also hits any machine where the high-performance GPU is not the display adapter, e.g. a laptop. The title now looks both functions up in d3d12_xs.dll with LoadLibraryW / GetProcAddress, which XCL serves from its HLE module.

  4. gpu_pso_e2e: the same mesh-shader check for the retail-pack tests. Console GS and NGG programs are drawn through a mesh pass. On the iGPU, four XCL_SAMPLE_RPF tests failed with E_INVALIDARG at mesh pipeline creation: retail_es_gs_voxelize_geometry_mode, retail_gs_pipeline_through_the_hook, retail_mesh_pipelines_through_the_hook, and the mesh half of retail_pipelines_built_in_the_background_behind_a_stand_in. They now check D3D12_OPTIONS7 on the backend's device and skip that part with a note. The VS / PS parts still run.

Plus one line in the README's Tests section.

Verification

Windows 11 Pro 26200, Rust stable MSVC, DXC 1.8.2502 from SDK 10.0.26100. cargo test --workspace --release --no-fail-fast -- --test-threads=4, once per adapter, no XCL_SAMPLE_* set:

XCL_ADAPTER adapter passed failed ignored GPU tests skipped (reason)
nvidia GeForce RTX 3080 (wave 32, mesh tier 1) 354 0 34 39 (no wave64)
radeon Radeon iGPU, RDNA2 (wave 32–64, no mesh shaders) 354 0 34 2 (no mesh shaders)

Before this branch, the default (RTX 3080) run passed too (352 passed, 2 fewer because the new unit tests were not there yet). Forcing the iGPU, which needs commit 1, gave 2 failed recompiler tests (commit 2) and a failed e2e test title with 5 D3D12.X checks failing (commit 3). New unit tests: gpu::adapter::tests::selector_parsing, selector_matching.

With XCL_SAMPLE_RPF set to a retail shaders.rpf (26 503 records), gpu_pso_e2e gives 6 / 6 on the iGPU. On the RTX 3080 it gives 4 / 6. The 2 failures there are retail_mesh_pipelines_through_the_hook (7 / 7 mesh pipelines fail) and the mesh half of the background-build test. That is the wave64-MS-on-wave32 limit discussed in #39, and this branch does not change it.

Not covered: a few probes and tests still create their own device with D3D12CreateDevice(None, …) (the default adapter): heap_probe.rs, two ignored experiments in recomp/tests.rs, texture.rs, list_x.rs, mfplat.rs. I left them alone.

The full per-adapter results are in #42.

**@⁠grahamster2** on GitHub · 2026-11-22 19:48 UTC · [original](https://github.com/xcl-dev/xcl/pull/41) `grahamster2:adapter-select` → `main` · +230 −30 · 10 files · 5 commits · merged 2026-11-22 21:37 UTC ### Summary Running the test suite on each GPU of a two-GPU machine (NVIDIA RTX 3080 + the AMD Radeon iGPU of a Ryzen 5 7600X) turned up three things, one commit each: 1. **`XCL_ADAPTER`: pick the D3D12 adapter.** The title's device took the first hardware adapter in high-performance order and the GPU test bench always took adapter 0, so the second GPU could not be tested. `d3d12_adapter` in `xcl.toml` now also takes a number (that hardware adapter in high-performance order) or a part of the adapter's name (`radeon`, `rtx 3080`). `XCL_ADAPTER` overrides it, the same way `XCL_RAYTRACING` overrides `raytracing`. The new `gpu::adapter` module holds the choice, and `hle::d3d12x::real` and `gpu::recomp::runner` both use it. If the name matches no adapter, the title logs the adapters it found and falls back to auto. The test bench gives the same message as its skip reason. `auto` / `warp` behave as before. 2. **Mesh draws are skipped on adapters without mesh shaders.** `gpu_mesh_mode_two_passes` and `gpu_geometry_mode_es_gs_strip` failed with `E_INVALIDARG` at mesh PSO creation on the RDNA2 iGPU. That adapter has wave 32–64 but reports `MeshShaderTier` NOT_SUPPORTED. The runner now reads `D3D12_OPTIONS7`, and the two tests skip with a note, as the wave64 tests do. 3. **The test title takes its device from `d3d12_xs.dll`.** The title declares `D3D12CreateDevice` / `D3D12SerializeRootSignature` as raw-dylib imports from `d3d12_xs`. The `windows` crate imports the same two symbols from `d3d12.dll`, and the linker keeps that one: `xcl inspect` on the built title shows `d3d12.dll: 2 Windows` and no `d3d12_xs` import. So the title called the system's `D3D12CreateDevice(NULL)`. D3D12 hands out one device per adapter, so the title still got XCL's device as long as XCL's adapter was the default adapter, and the e2e checks passed. On another adapter the title got a device XCL had never adopted. 5 D3D12.X checks then failed (no fallback PSO, no `IDXGIDevice1`, `CreatePlacedResourceX` E_INVALIDARG) and the run ended in an access violation in `D3D12Core.dll`. This also hits any machine where the high-performance GPU is not the display adapter, e.g. a laptop. The title now looks both functions up in `d3d12_xs.dll` with `LoadLibraryW` / `GetProcAddress`, which XCL serves from its HLE module. 4. **`gpu_pso_e2e`: the same mesh-shader check for the retail-pack tests.** Console GS and NGG programs are drawn through a mesh pass. On the iGPU, four `XCL_SAMPLE_RPF` tests failed with `E_INVALIDARG` at mesh pipeline creation: `retail_es_gs_voxelize_geometry_mode`, `retail_gs_pipeline_through_the_hook`, `retail_mesh_pipelines_through_the_hook`, and the mesh half of `retail_pipelines_built_in_the_background_behind_a_stand_in`. They now check `D3D12_OPTIONS7` on the backend's device and skip that part with a note. The VS / PS parts still run. Plus one line in the README's Tests section. ### Verification Windows 11 Pro 26200, Rust stable MSVC, DXC 1.8.2502 from SDK 10.0.26100. `cargo test --workspace --release --no-fail-fast -- --test-threads=4`, once per adapter, no `XCL_SAMPLE_*` set: | `XCL_ADAPTER` | adapter | passed | failed | ignored | GPU tests skipped (reason) | |---|---|---|---|---|---| | `nvidia` | GeForce RTX 3080 (wave 32, mesh tier 1) | 354 | 0 | 34 | 39 (no wave64) | | `radeon` | Radeon iGPU, RDNA2 (wave 32–64, no mesh shaders) | 354 | 0 | 34 | 2 (no mesh shaders) | Before this branch, the default (RTX 3080) run passed too (352 passed, 2 fewer because the new unit tests were not there yet). Forcing the iGPU, which needs commit 1, gave 2 failed recompiler tests (commit 2) and a failed e2e test title with 5 D3D12.X checks failing (commit 3). New unit tests: `gpu::adapter::tests::selector_parsing`, `selector_matching`. With `XCL_SAMPLE_RPF` set to a retail `shaders.rpf` (26 503 records), `gpu_pso_e2e` gives 6 / 6 on the iGPU. On the RTX 3080 it gives 4 / 6. The 2 failures there are `retail_mesh_pipelines_through_the_hook` (7 / 7 mesh pipelines fail) and the mesh half of the background-build test. That is the wave64-MS-on-wave32 limit discussed in #39, and this branch does not change it. Not covered: a few probes and tests still create their own device with `D3D12CreateDevice(None, …)` (the default adapter): `heap_probe.rs`, two ignored experiments in `recomp/tests.rs`, `texture.rs`, `list_x.rs`, `mfplat.rs`. I left them alone. The full per-adapter results are in #42.
The title's device took the first hardware adapter in high-performance
order and the GPU test bench always took adapter 0, so on a machine with
two GPUs only one of them could be tested.

`d3d12_adapter` in xcl.toml now also takes a number (that hardware
adapter in high-performance order) or a part of the adapter's name
("radeon", "rtx 3080"), and XCL_ADAPTER overrides it, as XCL_RAYTRACING
does for `raytracing`. gpu::adapter holds the choice; hle::d3d12x::real
and gpu::recomp::runner both use it. A name that matches no adapter is
logged with the adapters there are and the title falls back to auto;
the test bench reports it as the reason its GPU tests are skipped.
gpu_mesh_mode_two_passes and gpu_geometry_mode_es_gs_strip draw through
runner::mesh_draw and failed with E_INVALIDARG at mesh pipeline creation
on an AMD Radeon iGPU (RDNA2, Ryzen 7600X), which has wave64 but reports
mesh shader tier NOT_SUPPORTED. The runner now reads the tier
(D3D12_OPTIONS7) and the two tests skip with a note when it is missing,
like the wave64 tests do.
The title declared D3D12CreateDevice and D3D12SerializeRootSignature as
raw-dylib imports from d3d12_xs, but the windows crate imports the same
two functions from d3d12.dll and the linker kept that one: `xcl inspect`
on the built title shows `d3d12.dll: 2 Windows` and no d3d12_xs import.
So the title called the system's D3D12CreateDevice for the default
adapter. D3D12 returns one device per adapter, so this was XCL's device
as long as XCL used the default adapter too, and the D3D12.X checks
passed. On a different adapter the title got a device XCL had never
adopted: console shaders without a fallback, no IDXGIDevice, no placed
title memory, and an access violation in D3D12Core.dll (5 of the
title's D3D12.X checks failed).

The title now looks both functions up in d3d12_xs.dll with
LoadLibrary / GetProcAddress, which XCL serves from its HLE module.
Console GS and NGG programs are drawn through a mesh pass. On the RDNA2
iGPU, which has no mesh shader tier, four retail-pack tests failed with
E_INVALIDARG at mesh pipeline creation: the ES+GS geometry draw, the GS
and the MS pipelines through the hook, and the mesh half of the
background-build test. They now check D3D12_OPTIONS7 on the backend's
device and skip that part with a note; the VS / PS parts still run.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:05:53 +00:00
github manually merged commit 8ebba61826 into gh-pr/41/base 2026-11-26 04:05:55 +00:00
Author
Owner

@⁠ivall on GitHub · 2026-11-22 21:38 UTC · original

Thanks, merged! I tested it on top of current main, after #39 / #44 / #45 and the test title's new checks:

  • All tests pass on an RX 9070: 335 lib tests with the two adapter tests, the test title, and gpu_pso_e2e 6 / 6 with a retail shaders.rpf.
  • The test title now has no d3d12*.dll import at all. Its D3D12.X checks really run on XCL's device, including the three added today (descriptor heaps after a large graphics reservation, committed textures past the coherent room, the hidden title window). I had run into the same linker binding with CreateWindowExW there.
  • With auto, a game still picks the same adapter ("AMD Radeon RX 9070 (16191 MiB VRAM)") and runs as before.
**@⁠ivall** on GitHub · 2026-11-22 21:38 UTC · [original](https://github.com/xcl-dev/xcl/pull/41#issuecomment-7086198748) Thanks, merged! I tested it on top of current `main`, after #39 / #44 / #45 and the test title's new checks: - All tests pass on an RX 9070: 335 lib tests with the two adapter tests, the test title, and `gpu_pso_e2e` 6 / 6 with a retail `shaders.rpf`. - The test title now has no `d3d12*.dll` import at all. Its D3D12.X checks really run on XCL's device, including the three added today (descriptor heaps after a large graphics reservation, committed textures past the coherent room, the hidden title window). I had run into the same linker binding with `CreateWindowExW` there. - With `auto`, a game still picks the same adapter ("AMD Radeon RX 9070 (16191 MiB VRAM)") and runs as before.
This discussion has been locked. Commenting is limited to contributors.
No description provided.