D3D12.X: stand-in pixel shaders write both dual-source colours #666
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!666
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-666"
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?
@Ahmet-Dedeler on GitHub · 2026-11-24 03:08 UTC · original
Ahmet-Dedeler:pr/standin-dual-source→main· +30 −3 · 1 files · 1 commits · draftThe stand-in pixel shaders (what a pipeline gets while its console shaders have no translation yet, or when the driver refuses them) write
SV_Target0only, but the stand-in pipeline keeps the title's blend state. When that blend state uses SRC1 factors on render target 0 (dual-source blending), Apple's D3DMetal refuses the pair: it builds the pixel stage for the blend state, logs "Failed to compile fragment function" and marks the pipeline a no-op. This PR makes both stand-ins writeSV_Target0andSV_Target1. Part of #258.This is the shared path: the stand-in shader changes on every host. Nothing is drawn with it either way (its vertex / mesh shader makes no pixels), and without dual-source blending a second output is ignored. It still needs a Windows regression pair, which I cannot make (see Not tested).
What is in it
crates/xcl/src/hle/d3d12x/real.rs: one source string,STANDIN_PS, for the DXBC stand-in ofdummy(ps_5_0) and the DXIL stand-in ofdummy_mesh(ps_6_0). It writesSV_Target0 = (1, 0, 1, 1)as before andSV_Target1 = 0.standin_pixel_shaders_write_both_dual_source_colours: reads the output signature of both blobs and expectsSV_Target0 and 1. Skips the DXIL half withno DXCwhen DXC is missing.Tested
MacBook Pro, Apple M5 Max, 64 GB, macOS 27.3. CrossOver 26.3 (Wine) with D3DMetal as the D3D12, Rosetta 2. The adapter reports itself as
AMD Compatibility Mode(32-lane waves). Rust 1.100.0, targetx86_64-pc-windows-gnu(mingw-w64 14.0.0), DXC 1.9.2609.5. Debug build for the tests, release for the title.The new test on
4574f2e, under Wine: 1 passed. WithSTANDIN_PSset back to the one-colour shader it fails:the DXBC stand-in: left [0], right [0, 1].cargo test --workspace -- --test-threads=4: not run yet on this host, neither onmainnor on this branch. Only the new test was run. I'll add the counts for both, and the SKIPPED GPU tests on this adapter, before marking this ready.D3DMetal itself, with a probe that creates one pipeline per call from the two shader sources and a blend state (no XCL, no game), 1 render target:
SV_Target0only (before)SV_Target0only (before)SRC_ALPHA/INV_SRC_ALPHASV_Target0only (before)ONE/INV_SRC1_COLORSV_Target0only (before)SRC1_ALPHA/INV_SRC1_ALPHACreateGraphicsPipelineState/CreatePipelineStatereturnS_OKin every row; the failure is only in D3DMetal's log.The newer retail game from the README table, in earlier sessions of the Mac port of #258 on this machine (not this branch, and not runs made for this PR:
maindoes not reach a frame on this host): one session without this change logged the message 2,815 times; a later run with it through the title's menus logged it 0 times.Regression run
Windows, made by @Kalmarv (NVIDIA GeForce RTX 5070 Ti 16 GB, driver 610.74, Ryzen 9 9950X, Windows 11 Pro 26200, release builds, no uncommitted changes,
scripts/smoke.ps1, the same retail title for 60 s each,mainfirst). 487 / 473 frames (103 %), peak commit 15101 / 14770 MB (102 %), no device removal, no crash:main:
PR:
Also from this Mac,
scripts/smoke.ps1unchanged under PowerShell 7.7.0, with a wrapper as-Xclthat startsxcl.exeunder Wine. Both runs start from the same copy of the shader caches. On this hostmainshows no frame (the title stops about 3 s in, before it creates its device), so neither run reaches a stand-in pipeline. This pair shows that the build starts and ends asmaindoes, nothing more.main:
PR:
(
peak commitis 0 because Wine reports no commit charge.)Not tested
xcl-smokepair is above (thanks @Kalmarv). @DavidM1911 rancargo test -p xcl --libon an RTX 3060 Ti with this branch merged intomain: all passed, ~26 ignored.AI use
@us3r40456 on GitHub · 2026-11-24 03:16 UTC · original
Tested
4574f2e(this PR's head) on a second Apple Silicon Mac, compared test by test with its basemain508a0c7(with #553 on top, so the 7 draw tests do not hang there). Same script for both runs.Tested
XCL_DXC_DIR).x86_64-pc-windows-msvcwith no new warning.--test-threads=4); a group that hangs or crashes is rerun one test per process. 603 passed (1 of themSKIPPED: no wave64), 26 failed, 8 hung, 3 crashed, 21 ignored. The only difference frommainis the 7 draw tests hanging (#553 is not in this branch). The failures, hangs and crashes are the same tests as onmain(FP64, thehle::d3d12xones listed in #258).standin_pixel_shaders_write_both_dual_source_colourspasses, DXIL half included (DXC present).--test-threads=1): the same results asmain.mainfails here.Not tested
AI use
@CryingLaughing on GitHub · 2026-11-24 03:32 UTC · original
Tested
4574f2e04c8f480436e4183121e8f251b264c992and its parent508a0c74d7c0625d6d2de8d24494e69dc2e1926fwith the same scratch-only native probe inreal.rs. NVIDIA GeForce RTX 4080, driver 621.01, Intel Core i5-13600K, Windows 11 25H2 build 26200.9974, Rust 1.100.0 MSVC x64, Windows SDK DXC 1.8.2502.11, debug.XCL_ADAPTER=4080,XCL_REQUIRE_GPU=mesh, allXCL_SAMPLE_*variables unset.cargo test -p xcl --lib --locked -j 4 --no-run --message-format=json. Rannative_standin_dual_source_pixels standin_pixel_shaders_write_both_dual_source_colours --test-threads=1 --nocaptureon the PR head, 2/2 passed. Ran onlynative_standin_dual_source_pixelswith the same test options on the parent, 1/1 passed. Neither run skipped.ONE / INV_SRC1_COLORfor color andSRC1_ALPHA / INV_SRC1_ALPHAfor alpha, both shaders on the PR head matched all 256 expected pixels. A covered pixel was[1, 0.25, 1, 0.5]and the untouched clear pixel was[0, 0.25, 0, 0.5]. Disabling blending drew[1, 0, 1, 1]where covered, and an otherwise matching syntheticSV_Target1=1control gave the same image as the blend-disabled draw.S_OKwith the dual-source blend state for the complete stock DXBC graphic and DXIL mesh stand-ins on both revisions. The stock DXBC stand-in's degenerate VS left the target clear on the defined paths tested. On the parent, the triangle probe recorded only PSO creation for the one-output PS with dual-source blending. Its ordinary draw and the independentSRC1=1control both passed.Not tested
AI use
@JoaoPauluu on GitHub · 2026-11-24 04:18 UTC · original
Test report: #666 under Wine (Linux, NVIDIA): GTA VI regression pair on vkd3d-proton
The description asks for a regression pair it couldn't make. This one isn't Windows, but it's a host where the two-output stand-in goes through a different compiler (DXC → DXIL → vkd3d-proton's dxil-spirv → NVIDIA's Vulkan driver). It is this PR's head
4574f2eagainst its basemain508a0c7, on GTA VI. No regression either way.Setup
experimental-11.0-20261112(wine-11.0), vkd3d-proton v3.1 (4522cc1a) + the patch from #257, DXVK from Proton, DXC 1.9.2609,DXVK_CONFIG="dxgi.hideNvidiaGpu = False"x86_64-pc-windows-gnu(mingw-w64-gcc 16.2.0), release buildsscripts/linux/smoke.shfrom #257,XCL_NETWORK=0, alternating base / PR / PR / base508a0c74574f2epipelines whose shaders are not compiled yet get a stand-in and are built in the background. Neither logsno stand-in pipeline (…)orstand-in mesh shaders: …, and Wine's stderr has noerr:lines on any of the four runs.console shaders in the PSO without a translation: … – refusedlines on both builds (mesh pipelines, unrelated to this PR).(The first pair.
peak commit: 0 MBis XCL reading 0 MB committed under Wine, see #257.)Not tested
AI use: Claude Code (Claude Opus 5.5) built both commits, ran every run above on the machine above and wrote this report. The blocks and log lines 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.
@Ahmet-Dedeler on GitHub · 2026-11-24 13:48 UTC · original
Thanks for the three runs. That covers a second Mac (@us3r40456), the stand-in on a Windows NVIDIA card with the probe (@CryingLaughing) and a GTA VI pair under Wine on Linux (@JoaoPauluu), none with a regression.
What's still missing for the merge rules is the
scripts/smoke.ps1pair on Windows (main508a0c7and head4574f2e, same title, same time), since this changes the shared stand-in shader. I can't make that one. @Kalmarv you offered Windows pairs for the Mac lane PRs in #258, could this one go on the list? I'll keep it a draft until that pair is here and won't push to the branch in the meantime, so the head stays4574f2e.@Ahmet-Dedeler on GitHub · 2026-11-24 19:14 UTC · original
@Kalmarv one reminder and then I will leave it: this is still waiting on a Windows
scripts/smoke.ps1pair (main508a0c7against head4574f2e). No rush, and if it is easier for you on a newermain, say so and I will rebase it and ask the earlier testers to rerun.@Kalmarv on GitHub · 2026-11-24 19:43 UTC · original
@Ahmet-Dedeler, here is the pair you asked for:
main508a0c7(this PR's base) against this PR's head4574f2e. Both runs pass: no device removal, no crash, 487 / 473 frames (103 %), peak commit 15101 / 14770 MB (102 %).Tested
scripts/smoke.ps1, the same retail title for 60 s each,mainfirst, then this PR, one after the other.main508a0c7:this PR,
4574f2e:Both sides run at about 13 presents per 2 s here, against about 1 250 frames per 60 s on today's
mainc160d86on this machine, so508a0c7itself is slow on this title; the two sides match. A rebase ontoc160d86and a new pair there would show the PR on currentmain, if you'd rather have that.Not tested
AI use: Claude Code (Claude Opus 5.5) ran the pair and wrote this comment.
@DavidM1911 on GitHub · 2026-11-25 12:21 UTC · original
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!
@Ahmet-Dedeler on GitHub · 2026-11-26 02:49 UTC · original
@Kalmarv thanks for the pair. Both blocks are in the description now under Regression run. The base is old, I know. I will rebase onto current
maintogether with the full suite counts from the Mac, and ask for a fresh pair then rather than now.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.