Repository navigation
D3D12.X: stand-in pixel shaders write both dual-source colours - #666
Ahmet-Dedeler wants to merge 1 commit into
Conversation
A stand-in pipeline keeps the title's blend state, and a title's blend state can use SRC1 factors on render target 0 (dual-source blending). The stand-in pixel shaders wrote SV_Target0 only. Apple's D3DMetal builds the pixel stage for the blend state and refuses such a pair: "Failed to compile fragment function", logged 2,815 times in one session of a retail game, and the pipeline is marked a no-op. Both stand-ins (the DXBC one of `dummy`, the DXIL one of `dummy_mesh`) now write SV_Target0 and SV_Target1 from one source string. Nothing is drawn with them, and without dual-source blending a second output is ignored. Test: standin_pixel_shaders_write_both_dual_source_colours reads the output signature of both blobs. Part of xcl-dev#258. Co-Authored-By: Claude Mythos 5.2 <noreply@anthropic.com>
|
Tested 4574f2e (this PR's head) on a second Apple Silicon Mac, compared test by test with its base Tested
Not tested
AI use
|
|
Tested
Not tested
AI use
|
Test report: #666 under Wine (Linux, NVIDIA): GTA VI regression pair on vkd3d-protonThe 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 Setup
(The first pair. 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. |
|
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 |
|
@Ahmet-Dedeler, here is the pair you asked for: Tested
this PR, Both sides run at about 13 presents per 2 s here, against about 1 250 frames per 60 s on today's Not tested
AI use: Claude Code (Claude Opus 5.5) ran the pair and wrote this comment. |
The 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 macOS (Apple Silicon, CrossOver + D3DMetal): the newer retail game reaches its first-run menus at 30 fps #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
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 and no run of the suite there. This change touches the shared path and needs one: could someone with a Windows PC post the pair for4574f2e?AI use