Repository navigation
fix(agc): replace with a stencil operation value the pixel shader exports - #6762
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.
|
0361d34 to
c51ee6b
Compare
|
Rebased onto
|
|
AMD run with this head (c51ee6b) merged onto
AI-assisted: yes (Claude Code) |
c51ee6b to
aa0857a
Compare
|
Rebased onto
@johnmaia thanks for the RADV run. |
|
A title result with this head, recorded here so nobody reads more into the earlier run than it showed. On the RTX 5070, which doesn't expose The request decodes to So the throw is correct, and this PR doesn't change it. On devices with the extension the draw goes through |
…orts With DB_SHADER_CONTROL.STENCIL_OP_VAL_EXPORT_ENABLE the pixel shader supplies the value that REPLACE_OP and the add and subtract operations use in place of DB_STENCILREFMASK.STENCILOPVAL. The bit was refused as a whole, which stopped Onimusha: Way of the Sword (PPSA27836) at a DB_SHADER_CONTROL 0x45 draw with DB_STENCIL_CONTROL 0x40040 (REPLACE_OP on depth pass, both faces), write mask 0xff and compare ALWAYS. The export is accepted with the 32_GR and 32_ABGR Z formats. When no reachable operation through a non-zero write mask reads the value, it cannot change the result and is ignored. Without a test value export, a reachable REPLACE_OP becomes REPLACE with the exported value as FragStencilRefEXT (or the bounded replay on devices without the extension), provided both faces compare without the test value and use no ONES or REPLACE_TEST; early tests throw. The add and subtract operations, and REPLACE_OP with a test value export, still throw. The value is read from bits 8-15 of the second MRTZ channel: the title's pixel shader shifts it left by 8 right before exp mrtz (v_lshlrev_b32 v0, 8, v0). That is the only evidence for the layout and it is listed as technical debt. The pixel stage info carries the new flag into the cache key, the draw keys and request serialization version 31. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s optimize the module Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…35 request Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
aa0857a to
02c5470
Compare
|
Rebased onto current The PR logic is unchanged from the version checked: the flag is in the recompile cache key, the draw lookup/register keys and the serializer; add/subtract, |
What
DB_SHADER_CONTROL.STENCIL_OP_VAL_EXPORT_ENABLE(bit 2) lets the pixel shader supply the value thatREPLACE_OPand the add and subtract operations use in place ofDB_STENCILREFMASK.STENCILOPVAL(AMD_stencil_operation_extended, AMD_shader_stencil_value_export). The bit was refused as a whole:depth export, shader coverage or ordered fragment execution is unsupported (register 0x203 = 0x00000045).REPLACE_OP(StencilOperationValueReplaces) becomesVK_STENCIL_OP_REPLACEwith the exported value asFragStencilRefEXT. Devices withoutVK_EXT_shader_stencil_exportuse the existing bounded replay.NEVER,ALWAYSor compare mask 0) and use noONESorREPLACE_TEST, since those would need the register reference. Otherwise it throws.REPLACE_OPtogether with a test value export.emit_ps_mrtz_export), and I found no public source for the operation value. The evidence is the title's pixel shader below: right beforeexp mrtz, it shifts the value left by 8. The debt entry says this is the only evidence.ShaderPixelStageInfo::stencilOperationValueExportflag carries this to the recompiler. It enters the recompile cache key, the draw lookup and register keys, and request serialization version 33 (feat(agc): draw line-strip output of NGG geometry programs as mesh lines #5884 took 31, 7a6cc71 took 32). Replayed reference values use the same byte.The title's case. Onimusha: Way of the Sword draws with:
DB_SHADER_CONTROL0x45 andDB_STENCIL_CONTROL0x40040 (REPLACE_OPon depth pass, both faces);DB_STENCILREFMASK0x00ff0000 (write mask 0xff, test and operation values 0) and compareALWAYS;The pixel shader at 0x2112442100 ends with:
(words
d7710000 0401fe00 000000ff,34000088,f8001883 00000003).Tested
APS5_NO_HOST_IMPORT=1(AGC: VK_ERROR_DEVICE_LOST (read invalid) on the first scene load only with host imports (Onimusha: Way of the Sword, PPSA27836, NVIDIA) #6374). The build wasmain5d9dcc4 + feat(agc): rasterize a multisampled draw into one-sample targets at sample 0's locations #5907 + feat(agc): draw line-strip output of NGG geometry programs as mesh lines #5884 + 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 + this change.sample-preserving guest publication of native multisample depth is not implemented, AGC: compute buffer read of a native 4-sample D32 depth target needs sample-preserving publication (Onimusha: Way of the Sword, PPSA27836) #6570).agc_driver_graphics(stencilRefExportTests) covers 15 stencil-control cases, each underDB_SHADER_CONTROL0x54, 0x56 and 0x45 with Z formats 2 and 9:REPLACEmapping andStencilReferenceUnused;0x2a05export:request_serializerandagc_shader_memoryexpect version 33. A version 32 pixel request reads no flag.ctest -j 8on both GPUs:agc_driver_preparation_scope_settle, which also fails about one run in three on its own on other branches. It has no stencil code.agc_driver_gpu_indirect_arguments_misaligned_writer_ahead(frommain) does not build with WinLibs GCC (test(agc): align the indirect arguments block at run time #6452).python tools/check_conventions.py --base upstream/main: passed.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