Skip to content

Tests: verify D3D12.X view, sampler, and descriptor-copy hooks - #1749

Open
Vadson159 wants to merge 1 commit into
xcl-dev:mainfrom
Vadson159:tests/d3d12-views-and-descriptors
Open

Vadson159 wants to merge 1 commit into
xcl-dev:mainfrom
Vadson159:tests/d3d12-views-and-descriptors

Conversation

@Vadson159

Copy link
Copy Markdown
Contributor

Part of #480. Adds integration tests in crates/xcl/tests/d3d12_views_and_descriptors.rs covering XCL's hooked ID3D12Device view, sampler, and descriptor-copy slots (17-24) against the host D3D12 driver and the console descriptor-heap ABI without requiring console game files.

What is in it

  • Host-driver parity and format/fallback checks (pc_views_samplers_and_copies_match_host_driver): compares ID3D12Device slots 17-24 against real::orig_fn for host callers; exercises CreateRenderTargetView (slot 20 override) translating console DXGI_FORMAT(86) / DXGI_FORMAT(115) on an R8G8B8A8_UNORM target, CreateDepthStencilView (slot 21) with NULL and explicit D32_FLOAT descs on a console typeless depth texture, CreateUnorderedAccessView (slot 19) null-UAV fallback on a depth texture without ALLOW_UNORDERED_ACCESS, and live command-list clears on a real queue.
  • Console heap & descriptor ABI checks (console_heap_cbv_srv_uav_and_sampler_write_expected_abi_descriptors): verifies GetDescriptorHandleIncrementSize (32 / 16 bytes), CreateDescriptorHeap (including XBOX_EXTRA_CBV_SRV_UAV = 4), heap start slots 9-10 in UMA window 0, CBV cbv_words for in-UMA vs non-UMA addresses, SRV descriptors (console buffer buffer_words, Texture2D xcl_image_for_view, TEXTURECUBE -> TEXTURECUBEARRAY 6-face mapping, RT AS bvh_words in/out of UMA, typeless depth resource, null resource), UAV descriptors (buffer, Texture2D mip scaling + ClearUnorderedAccessViewUint on console_heap::global_heap, depth null-UAV fallback), sampler descriptors (S# word 3), and console_heap::unregister on release.
  • Descriptor copy checks (console_copy_descriptors_renumbers_images_and_samplers_and_keeps_buffers): verifies CopyDescriptorsSimple (slot 24) and CopyDescriptors (slot 23, multi-range and NULL range sizes) renumber T# word 0 and S# word 3 to the destination slot while keeping CBV and BVH descriptors verbatim, and handle mixed PC/console copies without device removal.

Tested

  • Hardware: AMD Ryzen 7 9800X3D 8-Core Processor, AMD Radeon RX 9070 XT (driver 32.0.32029.2010), AMD Radeon(TM) Graphics (driver 32.0.21045.29003), and WARP (XCL_ADAPTER=warp); rustc 1.100.0 (0ef1bc386 2026-11-09), Windows 11 x64.
  • .\scripts\test.ps1 (cargo build --workspace && cargo test --workspace -- --test-threads=4): 861 passed, 0 failed, 42 ignored (SKIPPED heap_window_out_of_memory_falls_back_to_the_switch_form: no heap windows; XCL_SAMPLE_* sample tests skipped because env vars are unset); includes d3d12_views_and_descriptors: 3 passed, 0 failed, 0 ignored.
  • cargo test -p xcl --test d3d12_views_and_descriptors -- --test-threads=4 --nocapture (debug and --release on AMD Radeon RX 9070 XT): 3 passed, 0 failed, 0 ignored.
  • XCL_D3D12_DEBUG=1 cargo test -p xcl --test d3d12_views_and_descriptors -- --nocapture --test-threads=1: 3 passed, 0 failed, 0 ignored (zero D3D12 debug layer errors; two optimized-clear-value warnings id 820 / id 821).
  • XCL_ADAPTER="Radeon(TM)" cargo test -p xcl --test d3d12_views_and_descriptors -- --nocapture --test-threads=1: 3 passed, 0 failed, 0 ignored.
  • XCL_ADAPTER=warp cargo test -p xcl --test d3d12_views_and_descriptors -- --test-threads=4 --nocapture: 3 passed, 0 failed, 0 ignored.
  • python -B -m unittest discover -s scripts -p "test_*.py" -v: 16 tests ran, OK.

Regression run
main:

PR:

Not tested

  • Execution inside a retail Xbox Series X|S title (no console files on this machine; runtime files under crates/xcl/src/ outside tests are unchanged).
  • Non-Windows hosts (xcl builds and runs on Windows x64 only).

AI use

Add integration tests (part of xcl-dev#480) exercising XCL's hooked
ID3D12Device slots 17-24 against both the host D3D12 driver (host
caller paths, RTV/DSV/UAV format translation and null fallback, and GPU
queue clears) and the console descriptor heap ABI (CBV/SRV/UAV/sampler
descriptor words, CopyDescriptors/CopyDescriptorsSimple renumbering, and
console heap unregister on Release).

Verified on AMD Radeon RX 9070 XT, AMD Radeon(TM) Graphics, and WARP
(with and without XCL_D3D12_DEBUG=1), plus full .\scripts\test.ps1
(861 passed, 0 failed, 42 ignored; 1 GPU test skipped: no heap windows).

Assisted-by: Antigravity (Gemini 4 Hydrogen)
@futurepro62

futurepro62 commented Nov 24, 2026 •

Copy link
Copy Markdown

Full-suite run, since this PR has no test report yet. Tested exact head 4cadf23 (on its base 9039900).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 616.64, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, DXC + dxil.dll 1.9.2602.17 (Windows SDK 10.0.26100), debug, D3D12 debug layer installed.
  • cargo build --workspace, then XCL_REQUIRE_GPU=mesh cargo test --workspace -- --test-threads=4 --skip heap_window_out_of_memory_falls_back_to_the_switch_form --skip pso_measurement_compiles_an_exact_synthetic_record: 860 passed, 0 failed, 42 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.
  • The new tests ran and passed: pc_views_samplers_and_copies_match_host_driver, console_heap_cbv_srv_uav_and_sampler_write_expected_abi_descriptors, console_copy_descriptors_renumbers_images_and_samplers_and_keeps_buffers.
  • Same head on the AMD Radeon integrated GPU (iGPU) of the Ryzen 7 9800X3D (RDNA2, XCL_ADAPTER=radeon), cargo test --workspace -- --test-threads=4: 861 passed, 0 failed, 42 ignored. SKIPPED: heap_window_out_of_memory_falls_back_to_the_switch_form (no heap windows).
  • Two tests were skipped with --skip on NVIDIA. Both fail on main 7f7e768 too, not because of this PR: under XCL_REQUIRE_GPU=mesh, runner::skip_test turns their skips into failures. heap_window_out_of_memory_falls_back_to_the_switch_form skips when XCL_HEAP_WINDOWS is unset (Tests: heap_window_out_of_memory_falls_back_to_the_switch_form fails under XCL_REQUIRE_GPU=mesh (opt-in skip counted as missing coverage) #1651), and shaders::tests::pso_measurement_compiles_an_exact_synthetic_record skips because Developer Mode is off on this PC (it cannot disable the driver cache). The AMD run does not set XCL_REQUIRE_GPU, so there both just print SKIPPED.

Not tested

  • a release build, a game (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.

@ivall ivall added the off-goal Does not bear on the current goal (world loading); waits until it is reached label Nov 24, 2026
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~23 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling; clean on single-threaded rerun — same flake seen on unmodified main.)

Thanks!

@JJAutoCompare

Copy link
Copy Markdown

PR #1749 test report

Tested 4cadf2322d3fc528424e8a153a3e0ea6c6609c7d on STOR-WINLAB. The diff adds one integration test file for D3D12.X device slots 17–24.

Tested

  • Windows 11 Enterprise Evaluation build 26200.9974, Ryzen 7 3800X, Intel Arc A770 16 GiB, driver 32.0.101.9175. DoublePrecisionFloatShaderOps=0, wave range 8–32, and d3d12SDKLayers.dll absent.
  • rustc 1.100.0 (0ef1bc386 2026-11-09), DXC/DXIL 1.9.2609.5. cargo build --workspace and cargo test --workspace --no-run both succeeded in unoptimized profiles with debug info disabled.
  • cargo test -p xcl --test d3d12_views_and_descriptors -- --nocapture under the shared Arc lock: 3 passed, 0 failed, 0 ignored, 0 skipped. The log confirmed the real Arc backend and UMA initialization. All three also passed in the workspace run.
    • Host-caller views, samplers, and copies exercised hooked and original slots. RTV, DSV, and copied UAV clears completed on the GPU without device removal.
    • Console heaps produced the expected CBV, SRV, UAV, and sampler words. Copies reindexed images and samplers, preserved CBV and BVH words, and preserved the console destination in the mixed-heap case.
  • One cargo test --workspace --no-fail-fast -- --test-threads=4 run under the shared Arc lock exited 101. pr1749-suite.log contains 21 result summaries including doctests: 843 passed, 18 failed, 42 ignored. The reported passes include 3 SKIPPED markers excluded from coverage: two for no wave64 and one for no heap windows.

Workspace failures

  • 17 library GPU failures. CreateComputePipelineState returned 0x80070057 in 13 tests, including FP64 cases. Four shader assertions failed: fused FMA overflow control, implicit-LOD sampling, preservation of the high half of an FP16 result, and a pixel-shader wave reduction.
  • One synthetic-title e2e failure. The RSSetDepthBiasX check read blue where it expected green.

Not tested

Retail titles, other adapters or drivers, D3D12 debug-layer validation, and a main baseline. This run leaves the workspace failures unattributed.

AI use

T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high) ran the build and verification. Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against pr1749-suite.log and published this report.

@Toons29

Toons29 commented Nov 25, 2026

Copy link
Copy Markdown

Tested the PR's head 4cadf23 both as is (on its base 9039900) and merged into main 06c9f55 (merge commit 0367c0d5), then into the newer main 0829441. The three new tests pass at the head. Two of them fail after the merge into main, every time.

Tested

  • AMD Radeon RX 9070 (RDNA4), Adrenalin 26.11.2 (driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0 (stable MSVC), debug builds.
  • Merged into main 06c9f5505f63f10c5ec49ef932d75b2c28177324 (clean merge, commit 0367c0d5daad2f2995adf9ed54b49a4ec855c79b):
    • cargo build --workspace, then cargo test --workspace --no-fail-fast -- --test-threads=4: 1264 passed, 4 failed, 46 ignored.
    • Each new test alone, 5 times (cargo test --workspace -- --exact <test>):
      • pc_views_samplers_and_copies_match_host_driver: 5 of 5 passed.
      • console_heap_cbv_srv_uav_and_sampler_write_expected_abi_descriptors: 5 of 5 failed.
      • console_copy_descriptors_renumbers_images_and_samplers_and_keeps_buffers: 5 of 5 failed.
    • The two failing tests alone 3 more times each: 3 of 3 failed.
    • cargo test --locked -p xcl --test d3d12_views_and_descriptors -- --nocapture, 2 runs: 1 passed, 2 failed, 0 ignored both times.
  • Merged into the newer main 082944135cd2b96288470a595861fa608eee08dc (clean merge, commit c08a05a0), cargo test --locked -p xcl --test d3d12_views_and_descriptors -- --nocapture, 3 runs: 1 passed, 2 failed, 0 ignored each time, with the same two tests and the same assertion values as below.
  • main 06c9f55 with only crates/xcl/tests/d3d12_views_and_descriptors.rs from this PR added: the two tests fail 4 of 4 each, and pc_views_samplers_and_copies_match_host_driver passes 1 of 1.
  • Exact head 4cadf2322d3fc528424e8a153a3e0ea6c6609c7d on its base 9039900, cargo test --locked -p xcl --test d3d12_views_and_descriptors -- --nocapture, 3 runs: 3 passed, 0 failed, 0 ignored each time.
  • The failure output is the same in all 15 failing runs of each test (thread ids differ). From cargo test --locked -p xcl --test d3d12_views_and_descriptors -- --nocapture on the merge:
thread 'console_copy_descriptors_renumbers_images_and_samplers_and_keeps_buffers' (9464) panicked at crates\xcl\tests\d3d12_views_and_descriptors.rs:787:9:
assertion `left == right` failed
  left: [0, 0, 0, 6]
 right: [0, 0, 0, 1]
test console_copy_descriptors_renumbers_images_and_samplers_and_keeps_buffers ... FAILED
thread 'console_heap_cbv_srv_uav_and_sampler_write_expected_abi_descriptors' (7240) panicked at crates\xcl\tests\d3d12_views_and_descriptors.rs:590:9:
assertion `left == right` failed
  left: [32, 58720256, 0, 2415923116, 0, 0, 0, 0]
 right: [0, 0, 0, 0, 0, 0, 0, 0]
test console_heap_cbv_srv_uav_and_sampler_write_expected_abi_descriptors ... FAILED
test pc_views_samplers_and_copies_match_host_driver ... ok

test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.53s

The asserting lines in the PR's file:

  • line 590, after the null-resource SRV (title_create_srv(hook_srv, raw_dev, null_mut(), &null_srv, vslot(6))):
    assert_eq!(console_heap::words_at(rel32(uma, vslot(6))).unwrap(), [0; 8]);
  • line 787, after title_copy_simple(hook_copy_s, raw_dev, 2, s_dst(1), s_src(0), D3D12_DESCRIPTOR_HEAP_TYPE_SAMPLER.0 as u32):
    assert_eq!(console_heap::words_at(rel32(uma, s_dst(1))).unwrap()[..4], [0, 0, 0, 1]);

Not tested

  • Which of the 398 commits between 9039900 and 06c9f55 changes the result (no bisect).
  • Release builds, the D3D12 debug layer (not installed here), other GPUs, a retail title (test-only diff, no game run).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report from their logs; I approved posting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

off-goal Does not bear on the current goal (world loading); waits until it is reached

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants