Repository navigation
fix(recompiler): replay every eight-bit stencil reference a pixel shader may export - #7006
Conversation
|
Thank you for your contribution! Authors with no pull requests merged into |
|
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.
|
|
Thanks for this. The change is correct: the replay pass already compares only the low eight bits of the export ( One required change before merge:
One suggestion, not required:
|
|
AMD run, since the description lists AMD as not tested. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
AI-assisted |
|
Tested on Onimusha: Way of the Sword (PPSA27836), where #4276's refusal now stops the first story-mode load (#6374). Tree: Overlap with #6762. Both PRs change // SpirvEmitterHelpers.cpp
const auto values = StencilReferenceValues(state.program, PixelInfo(state).psStencilOperationValueExport ? 8u : 0u);
if (values.empty()) throw std::runtime_error("stencil reference export emulation found no stencil export");
// StencilReplay.cpp, StencilReferenceValues(program, shift)
if (!values) { std::vector<std::uint32_t> all(256u); std::iota(all.begin(), all.end(), 0u); return all; }
for (const auto value : *values) result.insert((value >> shift) & 0xffu);Whichever lands second needs this resolution. I'm fine with this one going first; I'll rebase #6762 on top. Game result. Same path as on #6374: menus, New Game, difficulty, layout, then the first story-mode load. One run.
That message covers three conditions ( AI-assisted: yes |
|
Follow-up on the Which check fails. Not
Why The rest of the shader is reads only (an Question. AI-assisted: yes |
|
Marvel's Wolverine (PPSA03671) hits the same refusal this PR addresses, and further refusals follow it. Linux, RTX 4070 SUPER, the PR #7395 head with local patches. I tested an equivalent local change (all 256 values when the prover has no set), not this PR's head.
Not tested: this PR's head itself, other GPUs, Windows. |
…der may export Without VK_EXT_shader_stencil_export (NVIDIA), stencil reference exports are emulated by replaying the draw once per value. An export the prover could not bound to at most 16 values was refused. The replay shader compares the export's low eight bits, so an unbounded export now replays all 256 values, and proven values are reduced to their low eight bits as the comparison sees them. Refs boykopovar#4276 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
059aa7d to
f4a4b8a
Compare
|
@oneandonlydean rebased on main
On this head, RTX 3080 (617.42) and AMD Radeon RDNA 2 iGPU ( AI-assisted: yes (Claude Code). |
|
@simonbronk on the
One more refusal in the way: on the draw side, Branch: https://github.com/TheSovietWaffle/AnyPS5/tree/fix/recompiler-stencil-replay-readonly-bda (one commit on main On Onimusha it is not enough by itself: with this and this PR, the same shader ( AI-assisted: yes (Claude Code). |
|
Follow-up on Onimusha's stencil shader (PPSA27836, the pixel shader @simonbronk posted above) for whoever owns the
I tested (1) and part of (2) only against this shader, offline from its retained AI-assisted: yes (Claude Code). |
What
Devices without
VK_EXT_shader_stencil_export(NVIDIA) emulate a pixel shader's stencil reference export by replaying the draw once per reference value, each pass killing the fragments whose exported value differs.StencilReferenceValuesreturned no values, and the draw was refused, whenever the prover could not bound the export to at most 16 values:The replay shader compares only the low eight bits of the export (
SpirvFlowEmitter.cpp,OpBitwiseAnd 0xffbeforeOpIEqual), so 0 to 255 covers every value any export can produce:Draw.cpp) are unchanged.Cost: a draw with more than one replay value is already split per triangle in
recordStencilReplay, so an unbounded export records up to 256 passes per triangle of that draw. Draws with a provable export keep their current pass count.Refs #4276.
Tested
Windows 10 Pro 22H2 (19045), RTX 3080 (NVIDIA 617.42, no
VK_EXT_shader_stencil_export), WinLibs GCC 15.2.0 r7, Release, on currentmain.agc_masked_select(two new cases: an unprovable export replays all 256 values; a proven 300 replays as 44),agc_driver_stencil_replay,agc_driver_stencil_replay_no_gpl,agc_driver_stencil_ref_export_unusedandagc_driver_sample_mask_depth_stencilpass.agc_driver_stencil_ref_exportis skipped (it needs the extension).agc_driver_stencil_replayasserted that the column shader (ColumnPixelCode, stencil = column index) was refused. It now draws it withREPLACE_OPand checks that anEQUAL 5stencil test passes exactly column 5.APS5_NO_HOST_IMPORT=1and a local merge of fix(agc): rasterize a single-sample scan into a multisampled depth target at the pixel center #5915, fix(agc): import native multisample depth whose HTILE is not ITERATE_256 #6557, fix(agc): retire an unwritten native multisample depth surface on guest access #6727 and fix(agc): replace with a stencil operation value the pixel shader exports #6762: the first scene load stopped at the error above (pixel shaders0x2112444f00and0x210687de00). With this change it passes that point and goes on to the separate AGC: compute buffer read of a native 4-sample D32 depth target needs sample-preserving publication (Onimusha: Way of the Sword, PPSA27836) #6570 stop (sample-preserving guest publication of native multisample depth is not implemented).FragStencilRefEXTpath and does not reach this code).tools/check_conventions.py --base origin/mainpasses. fix(agc): replace with a stencil operation value the pixel shader exports #6762 also editsStencilReferenceValues(it adds a shift for the operation value export); the two conflict in that function and the merge is mechanical.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)🤖 Generated with Claude Code