Skip to content

Tests: verify desc::image_d3d12 and sampler_d3d12 against D3D12 - #540

Open
amazedturnip wants to merge 1 commit into
xcl-dev:mainfrom
amazedturnip:xcl/tests-desc-d3d12-srv-and-sampler-debug-layer-con-012601
Open

amazedturnip wants to merge 1 commit into
xcl-dev:mainfrom
amazedturnip:xcl/tests-desc-d3d12-srv-and-sampler-debug-layer-con-012601

Conversation

@amazedturnip

Copy link
Copy Markdown
Contributor

Add an integration test (crates/xcl/tests/desc_d3d12_e2e.rs) that exercises gpu::desc::image_d3d12 and gpu::desc::sampler_d3d12 against real D3D12 CreateCommittedResource, CreateShaderResourceView, and CreateSampler calls across all ImageType variants, mip/slice subranges, RGBA/BGRA/BC formats and swizzles, and sampler filter/reduction/comparison modes, checking ID3D12InfoQueue/ID3D12InfoQueue1 when the D3D12 debug layer is installed.

What is in it

  • crates/xcl/tests/desc_d3d12_e2e.rs: add e2e test exercising CreateCommittedResource, CreateShaderResourceView, and CreateSampler for desc::image_d3d12 and desc::sampler_d3d12 across all ImageType variants, mip/slice subranges, RGBA/BGRA/BC formats and component swizzles, and sampler filter/reduction/comparison modes, asserting zero ID3D12InfoQueue/ID3D12InfoQueue1 errors when the D3D12 debug layer is present

Tested

  • Hardware / OS / Rust: AMD Ryzen 7 9800X3D 8-Core Processor, Windows 11 Pro 10.0.26100 (Build 26100), rustc 1.94.1 (e408947bf 2026-03-25), stable-x86_64-pc-windows-msvc, debug build
  • AMD (AMD Radeon(TM) Graphics (driver 32.0.21043.19003, DXC 1.9.2609, native wave64), XCL_ADAPTER=radeon): cargo test --workspace -- --test-threads=2 — 681 passed, 0 failed, 41 ignored (SKIPPED GPU tests: none)
  • Verification / negative control: new test suite — verified 3x deterministic; includes an in-test InfoQueue negative control (3D SRV on 2D resource) gated on debug-layer availability

Not tested

  • ID3D12InfoQueue/ID3D12InfoQueue1 message assertions (host missing D3D12 debug layer SDK component 0x887A002D)
  • NVIDIA adapter (excluded per VRAM hygiene policy)
  • retail Xbox Series X|S title (not available on this host)

AI use

  • Antigravity CLI (Gemini 4 Hydrogen (Medium)) assisted with diagnosis, implementation, tests, review, and description; all tests executed locally on AMD Radeon (native wave64).

@thehollowedone

thehollowedone commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Retest after subprocess isolation

The stock fixture passed 3/3 fresh runs on 09998c3. The D3D12 debug layer was active on the RTX 3080 Ti, with no GPU or validation skips. The parent passed all 23 SRV and seven sampler InfoQueue checks. The child captured the expected negative-control error and exited successfully, and the parent device passed its health assertion in every run.

Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug. cargo test --offline --locked -p xcl --test desc_d3d12_e2e desc_d3d12_srv_and_sampler_debug_layer -- --exact --nocapture --test-threads=1. GPU sampling readback, the full workspace suite, and retail use remain untested. Codex with GPT-6.2 Sol ran the tests and drafted this update.

Earlier same-process result

Tested

Reran d665f50 with Windows Graphics Tools installed. Windows 11 build 26300, Ryzen 7 9800X3D, RTX 3080 Ti / 621.35, Rust 1.99.1 MSVC, debug.

cargo test --offline --locked -p xcl --test desc_d3d12_e2e -- --test-threads=1 --nocapture ran the fixture on native D3D12 with the debug layer enabled (0 passed, 1 failed, 0 ignored, no GPU skip). All 23 SRV and seven sampler cases passed their InfoQueue assertions. The deliberate 3D SRV on a 2D resource triggered error 32, followed by device removal (error 232, DXGI_ERROR_INVALID_CALL). The fixture then failed its shared-device health assertion.

A diagnostic-only rerun compared the two devices' IUnknown identities before the control. They matched. Microsoft documents reuse of the process's existing D3D12 device for the same adapter.

Not tested

GPU sampling readback, full workspace suite, and retail titles.

AI use

Codex with GPT-6.2 Sol ran the tests and drafted this report.

@futurepro62

Copy link
Copy Markdown

Tested exact head 5d7f6e1 on NVIDIA and an AMD iGPU with the D3D12 debug layer installed (Graphics Tools), so the ID3D12InfoQueue checks and the negative control that Not tested lists ran.

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (driver 616.64) + AMD Radeon(TM) Graphics iGPU (driver 32.0.21036.18), Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.100.0 MSVC, debug.
  • cargo test -p xcl --test desc_d3d12_e2e -- --nocapture, 3 runs each with XCL_ADAPTER=nvidia and XCL_ADAPTER=radeon: 1 passed, 0 failed every time. The log shows D3D12: debug layer enabled and backend 'real' on the adapter asked for.
  • With the debug layer active, the SRV and sampler cases gave no errors. The only debug-layer errors were those of the negative control (step 4), so it is not vacuous:
    • error, id 32: CreateShaderResourceView: The ViewDimension in the View Desc is incompatible with the type of the Resource.
  • .\scripts\test.ps1 (no XCL_ADAPTER, RTX 5070 Ti): 681 passed, 0 failed, 41 ignored. SKIPPED (no wave64): gpu_geometry_wave32_prefix_count_over_a_mask, gpu_wave32_program_in_wave64_hardware.

Observations

  • On both adapters the negative control's invalid SRV is followed by error, id 232: ID3D12Device::RemoveDevice: Device removal has been triggered ... (DXGI_ERROR_INVALID_CALL ...). The test still passes because nothing uses the device after step 4. The device is XCL's shared backend device (real::device_raw()), so a test added to this file later, or run after this one in the same process, would get a removed device. I did not check GetDeviceRemovedReason myself; this is from the debug layer's message.
  • Four warning, id 1361 from CreateSampler2: ComparisonFunc is ALWAYS with non-comparison filters (MIN_MAG_MIP_LINEAR, ANISOTROPIC, MINIMUM_MIN_MAG_MIP_LINEAR, MAXIMUM_ANISOTROPIC). Warnings only; the test checks errors.

Not tested

  • A discrete AMD card, wave64 hardware, retail titles, game-data tests (XCL_SAMPLE_* unset).

AI use

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

@amazedturnip

Copy link
Copy Markdown
Contributor Author

Addressed both observations from @futurepro62:

  1. Negative-control device removal: Moved step 4's mismatched-SRV negative control onto a dedicated temporary ID3D12Device created on the same adapter LUID (create_adapter_device) with its own ID3D12InfoQueue/ID3D12InfoQueue1 and descriptor heap, and added dev.GetDeviceRemovedReason().is_ok() to confirm real::device_raw() remains healthy.
  2. Non-comparison sampler warnings (id 1361): Changed compare_func from 7 (ALWAYS) to 0 (NEVER) on the four non-comparison sampler test cases (comparison = false).

Re-ran cargo test -p xcl --test desc_d3d12_e2e -- --nocapture with XCL_ADAPTER=radeon: 1 passed, 0 failed, 0 ignored (note: Graphics Tools / D3D12 debug layer is unavailable on this host, 0x887A002D, so the debug-layer InfoQueue/negative-control path was not exercised locally).

@amazedturnip
amazedturnip force-pushed the xcl/tests-desc-d3d12-srv-and-sampler-debug-layer-con-012601 branch from 5d7f6e1 to d665f50 Compare November 24, 2026 01:56
@MonkeyPython

Copy link
Copy Markdown

NVIDIA data point (the author excluded NVIDIA for VRAM hygiene; 12 GB is well clear of it): the desc verification passes on an RTX 3080 Ti with the debug layer active.

Setup: Windows 11 Pro 26300, Ryzen 7 7800X3D, 32 GB, RTX 3080 Ti 12 GB (driver 621.01), PR head 5d7f6e1, release build.

Run: cargo test -p xcl --release --test desc_d3d12_e2e -- --test-threads=4 → desc_d3d12_srv_and_sampler_debug_layer ... ok, 1 passed / 0 failed / 0 ignored in 0.34 s. No D3D12 InfoQueue errors in the test output.

Not tested: Intel, WARP, other NVIDIA cards.

AI use: Gentle Shell (Pi coding agent), model qwen4-max: ran the test and wrote this report from the log; a human reviews it before posting. No code changes.

@caua-an

caua-an commented Nov 24, 2026

Copy link
Copy Markdown

Tested: Clean head d665f505c49d8f8071bf8eeea2a4c45ffe558afe; Windows 11 Home build 26200, Core Ultra 9 185H, Rust 1.100.0 MSVC x64, debug build, XCL_REQUIRE_GPU=1. Intel Arc integrated graphics driver 32.0.101.8860; RTX 4070 Laptop driver 616.92.

With the D3D12 debug layer confirmed active, cargo test --offline --locked -p xcl --test desc_d3d12_e2e -- --test-threads=1 --nocapture reported 0 passed, 1 failed on both XCL_ADAPTER=intel and XCL_ADAPTER=nvidia. The negative control produced the expected invalid-view error, then DXGI_ERROR_INVALID_CALL on device removal, and the final shared backend device should remain healthy assertion failed. This is consistent with D3D12 returning the existing device for the same adapter in the same process. Suggest running the negative control in a separate process.

Not tested: Full workspace suite, release builds, retail titles, or game-data samples (XCL_SAMPLE_* unset).

AI use: OpenCode with GPT-6.2 Sol ran the tests and drafted this report.

@amazedturnip

Copy link
Copy Markdown
Contributor Author

Thanks for catching and reproducing the D3D12CreateDevice per-adapter singleton behavior when the D3D12 debug layer is active.

Updated crates/xcl/tests/desc_d3d12_e2e.rs to run the negative-control invalid SRV in a child process of the test executable (XCL_DESC_D3D12_NEG_CONTROL_LUID) targeting the parent's adapter LUID via xcl::gpu::agility::{configuration_interface, create_device}, requiring ID3D12InfoQueue, clean setup, a captured validation error, exit status 0, and a completion marker. This keeps the child's RemoveDevice isolated from XCL's shared backend device in the parent process.

Local check (XCL_ADAPTER=radeon, Windows Graphics Tools unavailable on this host): cargo test -p xcl --test desc_d3d12_e2e -- --test-threads=2 --nocapture -> 1 passed, 0 failed, 0 ignored.

@amazedturnip
amazedturnip force-pushed the xcl/tests-desc-d3d12-srv-and-sampler-debug-layer-con-012601 branch from d665f50 to 09998c3 Compare November 24, 2026 03:16
@JoaoPauluu

Copy link
Copy Markdown

Test report: #540 under Wine with vkd3d-proton as the host driver (Linux, NVIDIA)

The other runs here are native Windows drivers. Under Wine, the host driver this test compares XCL with is vkd3d-proton (D3D12 on Vulkan), and the test passes there as well.

Setup

Result: desc_d3d12_e2e test binary under Wine, --test-threads=1: 1 passed, 0 failed, 0 ignored (one run).

  • desc_d3d12_srv_and_sampler_debug_layer: ok. vkd3d-proton has no debug layer (d3d12core_GetDebugInterface: Returning DXGI_ERROR_SDK_COMPONENT_MISSING), so the debug layer was not active in this run.

Not tested

  • Windows, AMD, other Wine / vkd3d-proton versions; the rest of the suite on this branch; a title run (test-only PR)

AI use: Claude Code (Claude Opus 5.5) built the test, ran it on the machine above and wrote this report. The results are pasted from those runs. The account owner asked for test reports to be posted while they were away and has not reviewed this one.

@MesshM

MesshM commented Nov 24, 2026

Copy link
Copy Markdown

Test run of 09998c343280f2b5dc66fbe4cc06f0bebdfc7af8 on AMD RDNA4. I merged it onto current main 64b3f35 locally (clean merge).

Tested

  • AMD Radeon RX 9060 XT 16 GB (RDNA4), driver 32.0.32029.2010; Ryzen 7 5700X, 64 GB RAM, Windows 11 Pro build 26200, Rust 1.100.0 stable-x86_64-pc-windows-msvc, debug
  • cargo build --workspace + cargo test --workspace -- --test-threads=4 on the merge: 702 passed, 0 failed, 41 ignored, exit code 0; xcl lib tests 660 passed, 0 failed, 21 ignored
  • 0 SKIPPED; desc_d3d12_srv_and_sampler_debug_layer and the other desc_d3d12_e2e tests pass (single adapter here).

Review: Test-only; adds an AMD RDNA4 run to the many above. I found nothing to change.

Not tested: no retail title or regression run (I have no unpacked game), no XCL_SAMPLE_* tests, release build; the PR's head on its old base was not run, only its merge onto main.

Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.

@JJAutoCompare

Copy link
Copy Markdown

Empirical test report (09998c3)

Independent Intel Arc A770 D3D12 verification of PR #540 at detached head 09998c343280f2b5dc66fbe4cc06f0bebdfc7af8 (clean worktree).

Hardware / environment

  • Intel Arc A770 Graphics (16,258 MiB VRAM, driver 32.0.101.9175), AMD Ryzen 7 3800X, Windows 11 Enterprise Evaluation x64 build 26200.9974 (D3D12 debug layer d3d12SDKLayers.dll absent).
  • rustc 1.100.0 (0ef1bc386 2026-11-09) (x86_64-pc-windows-msvc), DXC 1.9.2609.5 (01b62ad47), unoptimized Cargo test profile with debug info and incremental compilation disabled.

Commands and results

  • Located prebuilt integration test binary via cargo test -p xcl --tests --no-run --message-format=json outside the GPU lock.
  • Ran inside Invoke-ArcTest.ps1 with XCL_ADAPTER=A770 and RUST_TEST_NOCAPTURE=1:
    • desc_d3d12_e2e.exe --nocapture --test-threads=1 (exit 0, 0.30s).
  • 1 passed, 0 failed, 0 ignored, 0 skipped.

Observed behavior

  • desc_d3d12_srv_and_sampler_debug_layer opened real backend Intel(R) Arc(TM) A770 Graphics and completed driver CreateCommittedResource, CreateShaderResourceView, and CreateSampler calls with exit 0.
  • Because the D3D12 debug layer is unavailable on this host (0x887A002D), the test logged that it ran without InfoQueue validation.

Not tested

  • D3D12 InfoQueue validation / negative invalid-SRV debug-layer checks (missing host SDK layers), full GPU workspace suite, and game smoke runs were omitted.

AI use

Verified and published with T3 Code / Antigravity (gemini-4-neon).

@DavidM1911

Copy link
Copy Markdown
Contributor

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

Thanks!

Exercise CreateCommittedResource, CreateShaderResourceView, and CreateSampler across all ImageType variants, mip/slice subranges, RGBA/BGRA/BC formats and swizzles, and sampler filter/reduction/comparison modes, checking ID3D12InfoQueue/ID3D12InfoQueue1 when the D3D12 debug layer is installed.
@amazedturnip

Copy link
Copy Markdown
Contributor Author

Thanks for the reports. The subprocess isolation the review surfaced is already in place at this head (the negative control runs in a child process; parent device stays healthy). My local run on the current head found one additional real defect: the B5G5R5A1 case used GFX10 format 135, which is the 5_5_5_1 layout (no DXGI equivalent, image_d3d12 correctly returns None) instead of the actual B5G5R5A1 format 134 (1_5_5_5). Fixed the test's format number; the run now passes (0 passed, 1 failed -> 1 passed, 0 failed) on AMD Radeon (debug layer unavailable on this host). No other changes needed.

@amazedturnip
amazedturnip force-pushed the xcl/tests-desc-d3d12-srv-and-sampler-debug-layer-con-012601 branch from 09998c3 to 9a69001 Compare November 25, 2026 15:55
@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

@upipibi

upipibi commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

RTX 3070 8 GB run of 9a69001 (as-is on its base 0829441, not merged with current main) with the D3D12 debug layer on (inbox d3d12SDKLayers.dll), which the description's AMD run did not have.

  • cargo test -p xcl --test desc_d3d12_e2e -- --nocapture --test-threads=1, 3 runs: 1 passed, 0 failed, 0 ignored each; no SKIPPED; log shows debug layer enabled and the real backend on the 3070.
  • Steps 1-3 (9 view-type, 12 format/swizzle including the changed B5G5R5A1 = 134, 7 sampler cases): no debug-layer error or warning; the id 1361 sampler warnings seen on 5d7f6e1 are gone.
  • Negative control (child process): with a local print added only to show its messages, the child got id 32 (ViewDimension incompatible with the resource) and id 232 (device removed), exited 0, and the parent's device stayed healthy.

Not tested: the no-layer path, AMD, release builds, a merge with current main.
NVIDIA 616.56, Windows 11 26100, Rust 1.100.0, debug.

AI use: Claude Code (Claude Opus 5.5) ran the tests and wrote this.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

Nothing has happened on this PR for 3 days, so it is marked stale and will be closed in 4 days. A push or a comment takes the mark off: rebase it onto main if it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.

@github-actions github-actions Bot added the stale No activity for 3 days; closed 4 days later unless something happens label Dec 1, 2026
@Foniass

Foniass commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Triage (#1607) – head 9a69001

No open or merged PR checks desc::image_d3d12 / sampler_d3d12 against the debug layer (#969 covers textured PSOs and static samplers, #1339 changes the MSAA mip count that main already forces to 1). The negative control runs in a child process so the shared backend device is not removed. No problems found in the diff; note that without a debug layer the test only checks that the calls do not fail, as its message says.
Recommendation: keep open.

AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.

@amazedturnip

Copy link
Copy Markdown
Contributor Author

Still merges cleanly onto main (493dbd3) with passing checks; verify desc::image_d3d12 and sampler_d3d12 against D3D12 — waiting on maintainer / post-goal review.

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 stale No activity for 3 days; closed 4 days later unless something happens

Projects

None yet

Development

Successfully merging this pull request may close these issues.