Recompiler: read VS / PS spill slots from their shadows in direct DXIL #3793
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3793"
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 raylitebull on 2026-12-03T15:07:14Z.
The direct DXIL translator refused any VS / PS in which a
v_readlanereads av_writelanespill slot from its scalar shadow (upper_lanes::Read::Shadow), withgraphics v_writelane spill needs the HLSL path(dxil/kernel.rs). Those shaders took the HLSL + DXC path. This change gives direct DXIL the HLSL emitter's spill shadows (Em::upper:xcl_sh<v>_<l>,xcl_present). Wave32 VS / PS and the 64-lane form of wave64 VS / PS with spill slots now stay on direct DXIL. The 32-lane form of a wave64 VS / PS (pso::graphics_wave32, true on any adapter whose wave range starts at 32) still refuses reads of lanes 32–63; #3795, stacked on this one, handles them.What is in it
dxil/kernel.rs: VS / PS keep theupper_lanesresult instead of refusingRead::Shadow.Lw::setup_gfx_lanesruns after the entry setup, when there is a shadowed slot.dxil/lower_gfx.rs:GfxLanes. Each shadowed slot (VGPR, lane) is an SSA temporary that starts at 0 (static uint xcl_sh = 0u). For a slot ≥ 32 it also keeps the lanes launched at entry:ballot(true), or in a PSballot_px(true), which counts whole live quads (xcl_present).dxil/lower_valu.rs:v_writelanealso writes the slot's shadow. Av_readlanethatupper_lanesresolves toShadowreads the shadow. For a slot ≥ 32 it reads the lane itself where the present mask has that lane. Every other read is unchanged.dxil::core_tests::graphics_spill_slots_read_their_shadows: wave32 and wave64 VS and PS, plus a slot written on both sides of a branch. Each one validates, and its disassembly is checked: a slot < 32 has no lane read; a slot ≥ 32 has onewaveReadLaneAtof lane 36 selected by the present bit (in a PS, quad ops build the present mask); the branch case has a phi.recomp::testswave32_graphics_spill_shadows_and_direct_fallbackandwave64_graphics_spill_shadows_cover_native_partial_wavesasserted the refusal. They now expect the direct translation (the second one still expects the 32-lane form to refuse).gpu_wave64_ps_spill_slots,gpu_wave64_vs_spill_slots_and_identityandgpu_wave32_ps_and_vs_spill_slots_in_partial_wavesnow also draw with the direct VS / PS and check the same values. They usedraw_console_direct, anddraw_passthrough_psis split out ofdraw_console_views.Tested
cargo check --workspace --all-targets --target x86_64-pc-windows-gnubuilds, with the same warnings asmaina815de93(39 lib, 20 lib test) and none in the changed files.git diff --checkis clean.x86_64-pc-windows-gnu, debug) and run under Wine 9.0 with DXC 1.10.2611'sdxcompiler.dll/dxil.dll(GitHub release,XCL_DXC_DIR). SoIDxcValidatorand the disassembler did run on the direct-DXIL tests. There is no GPU, so every GPU test printedSKIPPED(no GPU) and none counts as coverage. Each module ran in its own process with 2 threads; theuma_drivergroup was left out (address space under Wine).02f9cbf1): 2547 passed, 75 failed, 35 ignored;hle::netoff::teststimed out (Wine sockets).maina815de93, same setup: 2545 passed, 76 failed, 35 ignored;hle::netoff::teststimed out.hle::d3d12x::frame::tests::origin_events_issue_tokens_and_flips_have_statistics, which failed on themainrun (timing under Wine). The other failures are the same set (hle::d3d12xdevice / sparse / list tests andgpu::dxil::round_tests::directed_reference_basicsunder Wine).Regression run
Pending:
scripts/smoke.ps1frommainand from this head, on Windows with an RX 9070 XT, still to be run.Not tested
IDxcValidatorwas not run on Windows.scripts/smoke.ps1and the whole suite on a GPU (pending, RX 9070 XT).xcl shaders --direct): no game data here.AI use
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.