D3D12.X: a stage the PC cannot run goes to the fallback without the driver #745
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/750"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-24T04:35:36Z.
A graphics pipeline whose shaders XCL does not translate is handed to the driver as it came; the stand-in shaders are used when the driver refuses it. Windows drivers refuse a stage that is neither DXIL nor SM5 byte code, but Apple's D3DMetal (macOS under CrossOver) dereferences null parsing a container it does not know, and the process dies. Part of #258.
What is in it
gpu/shader.rs:runs_on_pc(blob), from the existingclassify: DXIL or DXBC with SM5 byte code; a unit test for it.hle/d3d12x/real.rs:graphics_psoskips the driver call when a stage failsruns_on_pcand goes to the fallback withE_INVALIDARG, the result a Windows driver gives. On Windows the outcome is the same pipeline (the stand-ins), one driver call fewer.Tested
xcl.execross-built with mingw-w64 (GCC 16.2.0), Rust 1.100.0, debug. DXC 1.9.2609.D3D12CreateDevice+CreateGraphicsPipelineState) on the same host getsS_OKfor a vs_5_0 / ps_5_0 pipeline and dies (write to 0 inntdll, after a read at null+0x18 in D3DMetal) for the same pipeline with a 56-byte DXBC container holding only anXBOXpart, which is what the test title'sconsole_container()builds.cargo test -p xcl --lib gpu::shader:::only_pc_shaders_run_on_pcfails before the change (stub) and passes after.readable_answers_from_the_working_set_without_touching_pagesfails on this host, onmain(91f9a5e) as well.cargo test --test e2e(the test title): onmainthe title dies in "shaders captured; console shader gets a fallback PSO" (31 PASS before it). With this commit that check and the retail-format one pass (32 PASS); the title then dies later inrender_triangle, calling past the end of a D3DMetal vtable. That is what @Ahmet-Dedeler'smac-on-main-wiphandles: his branch (db065d8) alone dies at the same fallback PSO check; with this commit on top, the title runs to its end, 47 PASS, 3 FAIL (no GPU timestamp; window not cloaked; XMA2GetStatectx=0).6569928, rebased ontomain64b3f35: the unit test and the e2e counts above are the same.64b3f35(on the PR): @juliptree, native Windows, RTX 5060 Ti, MSVC:gpu::shader::4 passed on base, 5 on the PR; both e2e tests pass on each (50/50 title checks, the fallback PSO and the triangle readback included). @us3r40456 (M5 Pro, cargo-xwin MSVC) and @shortside (M5 Pro, clang-cl / xwin): on base the title dies at the console shader, on the head both fallback pipelines are made and it dies later at the D3DMetal vtable crash, as above.hle::d3d12xunit tests stop at the first test that creates a device on this host, onmainand with this commit alike.Regression run
Run by @Anon64 on a retail title, 60 s each,
scripts/smoke.ps1, release, clean tree at each commit (NVIDIA GeForce RTX 3060 12 GB, driver 581.80, Windows 11 25H2), pasted unedited from https://github.com/ivall/xcl/pull/750#issuecomment-7124835219:main:
this PR:
Not tested
cargo test --workspace) on this head.cargo test --workspaceas a whole on this host (it does not finish under CrossOver, as reported in #258).AI use
claude-opus-5-5): found the cause, wrote the change, the test and the probe, ran the tests above.Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-24T04:44:38Z.
@Kalmarv if your offer on #258 covers this one too: it touches the shared PSO path, so it needs a Windows pair. Head
6569928onmain64b3f35. I have no retail title here. Thanks!AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by juliptree on 2026-11-24T06:31:09Z.
Independent native Windows validation of base
64b3f355and PR head6569928cusing Rust 1.100.0 MSVC. XCL’s runtime logs confirmed the RTX 5060 Ti on NVIDIA driver 616.92 as the D3D12 adapter for both runs.Synthetic fixtures only. No retail smoke run. AI-assisted validation and write-up by Codex.
Imported from ivall/xcl. Originally posted by Anon64 on 2026-11-24T07:17:53Z.
Regression runs for this PR's head
6569928and for its basemain64b3f35, on a retail title (same title, 60 s each), made withscripts/smoke.ps1(release, clean tree at each commit) and pasted unedited, for Regression run.main:
this PR:
Tested
Not tested
Report written with Claude Code (Claude Opus 5.5) from runs on this machine.
Imported from ivall/xcl. Originally posted by us3r40456 on 2026-11-24T11:47:13Z.
Tested on an Apple Silicon Mac. I compared the head
6569928with its base64b3f35, both onmain(no Mac port branch).Tested
XCL_DXC_DIR). Builds with no new warning.tests/e2e.rs,test_title_runs_and_game_folder_is_untouched:[PASS]. It then dies right after capturing its console pixel shader (the[XBOX]container), on a write to address 0: the D3DMetal null dereference described in #258.[PASS], among themD3D12.X: shaders captured; console shader gets a fallback PSOandD3D12.X: retail-format console shader (XDAT/XBCH/FSSM) captured + fallback PSO. It then dies further on, executing at0x1b84800000af0, right after the title-texture setup (ID3D12Resource2 – 17 PC methods …).pr/native-host-vtables(ddf3be7) merged on top locally, it gets 32[PASS]and dies inside D3DMetal, inD3D12GraphicsCommandList::IASetIndexBuffer(+0x129, a read at 0xa8).main, the test title needs more of the Mac port to reach its end.pls dir S:\,create S:/Users/xcl/games) failed on the base run and passed on the PR run. The e2e test reuses its data folder between runs, so I don't count that difference.gpu::shader::: 3 passed and 1 failed on the base, 4 passed and 1 failed with this PR. The new test passes. The failure on both isreadable_answers_from_the_working_set_without_touching_pages.hle::d3d12x::real::: 18 passed on both.Not tested
mac-on-main-wip.AI use
Imported from ivall/xcl. Originally posted by shortside on 2026-11-24T11:57:03Z.
Test report from a second Mac, head
6569928against its merge base64b3f35.Tested
x86_64-pc-windows-msvcwith clang-cl / lld-link 23.1.6 and an xwin SDK 10.0.26100, Rust 1.100.0, debug. The lib test binary run under Wine, one test per process (--exact --nocapture, 60 s cap).gpu::shader::lib tests: base 3 passed, 1 failed; head 4 passed (only_pc_shaders_run_on_pcis new), 1 failed. The failure isreadable_answers_from_the_working_set_without_touching_pageson both, as your description says.tests/e2e.rs, fresh data folder): on base it dies right after "D3D12.X: queue + fence signal on the GPU", 2 of 2 runs (31 PASS before it). On head, 1 run:xcl.logshows both fallback pipelines made ("graphics PSO rejected by the driver (0x80070057) – fallback shaders used" #1 and #2), and the title dies later with a page fault on execute access, which matches the D3DMetal vtable crash your description names. Wine's debugger then held the process past my 400 s cap, so I have no PASS count for the head run.Not tested
mac-on-main-wipstack as one tree in this run (I ran that stack earlier today for #996: the title reaches its end there).AI use
Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-24T12:37:59Z.
@Anon64 @juliptree @us3r40456 @shortside thanks for the runs. The smoke pair is now under Regression run in the description (
scripts/pr_check.py --localon it: "description ok"), and the other reports are summarised under Tested.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ivall/xcl. Originally posted by JJAutoCompare on 2026-11-25T06:03:05Z.
Empirical test report (
6569928c)Tested xcl-dev/xcl PR #750 at
6569928c24d157bc0c03a8a6de655e2a94378c81in a clean checkout.Hardware / environment
10.0.26200.0. CPU reported asAMD64 Family 23 Model 113 Stepping 0, AuthenticAMD. The focused fixture used no GPU.rustc 1.100.0 (0ef1bc386 2026-11-09)(x86_64-pc-windows-msvc). DXC reporteddxcompiler.dll: 1.9(5512-01b62ad4)(1.9.2609.5) - 1.9.2609.5 (01b62ad47).Commands and results
cargo test --workspace --no-runexited 0 and built the workspace test executables. Cargo emitted a deprecation warning forAtomicU32::fetch_updateinhle/xgameruntime/mod.rs.cargo test -p xcl --lib gpu::shader::tests::only_pc_shaders_run_on_pc -- --exactexited 0 withXCL_ADAPTER=NONE_CPU_ONLYandRUST_TEST_NOCAPTURE=1. It ran outside the Arc runner.SKIPPEDmarkers.Observed behavior
The CPU-only fixture confirmed that
runs_on_pcaccepted synthetic DXIL and SM5 (SHEX) containers. It rejected a DXBC container carrying anXBOXpart with RDNA2 code, the raw RDNA2 bytes, and an ELF-prefixed blob. The assertions passed in a single library test.Not tested
The full GPU workspace suite and game smoke runs were omitted. This run did not create a D3D12 graphics pipeline or verify that the runtime bypassed the driver and created a fallback pipeline. CrossOver and D3DMetal were outside this Windows test run.
AI use
Verified with T3 Code / Codex (gpt-6.2-sol, reasoningEffort: high). Coordinator #2 (T3 Code / Antigravity, gemini-4-neon) verified counts against
pr750-focused.logand published.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T11:28:49Z.
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!
Imported from ivall/xcl. Originally posted by vakaobr on 2026-11-25T16:09:44Z.
Tested
6569928on a Mac: it fixes the e2e test title's crash there.Tested (MacBook Pro M5 Pro, macOS 27.2.1, CrossOver 26.3.0, D3DMetal 3.0, Rust 1.100.0
x86_64-pc-windows-gnu, debug, DXC 1.9.2609). Cherry-picked cleanly onto the Mac branch from #258 (mac7+ the open Mac fixes,vakaobr/xclmac/integration, now at7458fc6), not ontomain.e2e::test_title_runs_and_game_folder_is_untoucheddied 0.84 s in on 3 trees I tried (5 of 6 runs; the sixth hung until its 300 s limit).XCL_TRACE_EXCEPTIONS=1shows the order: a read at0x18in D3DMetal's code underCreateGraphicsPipelineState(the PC VS + the 56-byteXBOXPS), then 23 nested faults atntdll.dll+0x38d55(inRtlVirtualUnwind2) while Wine tries to unwind through D3DMetal's frames.graphics PSO rejected by the driver (0x80070057) – fallback shaders usedtwice. Both D3D12.X fallback checks pass (console shader gets a fallback PSO,retail-format console shader … captured + fallback PSO). The test still fails on checks unrelated to this:user32 … not cloaked(Wine),XAudio2 … Opus GetState: ctx=0x0and, in 1 of the 2 runs, theS:storage checks.gpu::shader::tests, each in its own process: 4 passed (only_pc_shaders_run_on_pcamong them), 1 SKIPPED (readable_answers_from_the_working_set_without_touching_pages: this host reports no working set).Not tested: Windows,
mainitself, a retail title.AI use: Claude Code with Claude Opus 5.5 ran the tests and wrote this report.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:43:44Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Lucasyudi on 2026-11-29T15:50:31Z.
Still waiting for a maintainer review. It still fixes the crash on D3DMetal when a pipeline's stage is not DXIL / DXBC (the e2e title test; confirmed on a Mac by @vakaobr, and it is in his
mac/integration), and it merges cleanly intomain.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:03:54Z.
Triage (#1607) – head
6569928No other open PR (including the other #258 macOS / D3DMetal PRs) skips the driver call for non-PC stages in
graphics_pso.shader::runs_on_pcis new, and main still hands an untranslated desc to the driver first.One behaviour change on Windows:
runs_on_pcis false forKind::XboxNative(DXIL + XDAT), so an untranslated console DXIL stage now always gets the stand-ins instead of going to the driver first. Per the description and the smoke run, the outcome on Windows is the same.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.