Repository navigation
fix(recompiler): replay stencil exports of pixel shaders that only read through BDA - #8145
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
…ad through BDA StencilReplaySafe refused every program with usesDma, including pixel shaders whose only BDA accesses are reads (Onimusha: Way of the Sword, PPSA27836: one global load, then image and buffer reads). Replaying such a shader per reference value is idempotent: its only side effect is the first-fault record, a compare-exchange that keeps the first fault; a fault is never retried but thrown by CheckFault, and replayed draws with a BDA table already wait and check faults before publishing. Written-page tracking exists only in programs with bdaWrites, which stay refused. Compiled shaders now carry bdaWrites, and ShadersWriteMemory counts a BDA page table as a memory write only for a program that writes through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1b03461 to
9b84f9d
Compare
|
Rebased on main On this head, RTX 3080 (617.42) and Radeon RDNA 2 iGPU ( AI-assisted: yes (Claude Code). |
|
Tested on an RTX 5070 Ti (NVIDIA 617.42, no The branch no longer merges cleanly onto current
Not run: the validation layer, a title, and a disk cache written before this change. The cache directory is keyed by the hash in AI-assisted: yes (Claude Code); results above were run on this machine. |
|
Ran this with Monster Hunter Wilds (PPSA24191, #7972) on Linux: RTX 5090 (NVIDIA 595.99.02, no
Separately, the replayed draw also hit AI-assisted: yes (Claude Code). I ran the builds and the title on my machine. |
|
Boundary datapoint for this PR — a shader it does not unblock, from a real title. Shader: PPSA20397 (Assassin's Creed Shadows), hash Result: The draw is also 4×MSAA with all-REPLACE/ALWAYS stencil ops ( So the |
|
Checked the diff against main: |
What
On devices without
VK_EXT_shader_stencil_export,StencilReplaySaferefused every program withusesDma, including pixel shaders whose only BDA accesses are reads (Onimusha: Way of the Sword, PPSA27836: one global load, then image and buffer reads; @simonbronk's question on #7006). The draw side refused them too:ShadersWriteMemorycounted anyBdaPagetablebinding as a memory write.Replaying such a shader once per reference value is idempotent:
record_bda_fault, a compare-exchange from empty, so every pass that faults records the same first fault or nothing.BdaResources::CheckFaultthrows for every reason except the loop guard, andStencilReplaySafealready refuses loops. Replayed draws whose resources have a BDA table already take theChecksFaults()path inDraw.cpp(not recordable), so they wait and check faults before publishing, like guarded SRT reads.get_bda_write_pointer,note_bda_write) exists only in programs withbdaWrites, which stay refused.Changes:
StencilReplaySafeno longer refusesusesDmaalone.bdaWrites(artifact field and disk cache entry), andShadersWriteMemorycounts the BDA page table as a write only for a program withbdaWrites.docs/dev/debt/libSceAgcDriver.mdnames read-only BDA reads next to guarded SRT reads.Tested
Windows 10 Pro 22H2 (19045), WinLibs GCC 15.2.0 r7, Release, on main
3aa35dc01.agc_masked_selectcase: read-only BDA is replayable and BDA writes are not; it fails without the change.agc_shader_disk_cacheround-trips the new flag.agc_masked_select,agc_shader_disk_cache,agc_driver_stencil_replay,agc_driver_stencil_replay_no_gpl,agc_driver_stencil_ref_export,agc_driver_stencil_ref_export_unused,agc_driver_sample_mask_depth_stencilandagc_driver_stencil_null_feedbackpass on both GPUs below, exceptagc_driver_stencil_ref_exportskipped on the RTX 3080 (noVK_EXT_shader_stencil_export) andagc_driver_stencil_replayskipped on the Radeon (has it).usesDmaand is then refused byMaskReplaySafety(it branches on EXEC), so this does not unblock the title by itself.tools/check_conventions.py --base origin/main: 0 errors; it warns that the stencil reference export replay debt entry is over 1,000 characters, which it already was on main.tools/pr_overlap.pywas not run (noghon this host); fix(recompiler): replay every eight-bit stencil reference a pixel shader may export #7006 edits the same debt entry, so whichever lands second needs a one-line merge there.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)1002:164e), 32.0.21045.5002, Windows 10 22H2🤖 Generated with Claude Code