feat(shader): read hull patch constants in domain programs #4175
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4175"
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 boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-12T00:41:44Z.
What
Stacked on #4114 (which is stacked on #4082). Only the last commit,
feat(shader): read hull patch constants in domain programs, is new here; the two commits below it are #4082 and #4114 as they are.With #4082 and #4114, GTA V (PPSA04264) gets past its hull program and stops on its domain program:
The domain program reads the patch constants that its hull wrote at
0x8000 - stride * (rel + 1). TessellationLowering refused every domain read of the off-chip ring whose relative patch coefficient is not a whole patch of control points.What changes:
TessellationAttribute::PatchInput). This requires that the domain program also reads a control point, because the patch interface location comes from the control point record size. It also requires that the address lies past the patch's control points and that the records do not overlap the neighbouring patches' records. Unproven shapes still throw.The limit is listed in TechnicalDebt.md. A domain read of another patch's constants that is a whole number of strides away from its own record reads its own record, because neither stage knows where the other's records begin.
Tested
Windows 11, RTX 4090, WinLibs GCC 15.2.
agc_driver_tessellation: new casedomain program reading its patch constants. The existing triangle hull (patch constants at0x8000 - 16 * (rel + 1)) is drawn with a domain program that takes two control point x coordinates from those patch constants instead of the control points. The case also checks each drawn patch's shape at mid-height. This shape check was added to everyRequirePatchescase.tessellation lowering: domain shader reads of patch constants or other patches are unsupported at pc 0x38.Tessellation tests passed.patch 0 is not the triangle of its control points at mid-height, so the check sees wrong values.DomainPatchReadrefusal case is replaced byDomainNeighbourRead(a read of the next patch's control point), which is still refused on both #4114 and this branch.ctest -R "agc_driver|agc_masked|agc_shader|agc_vector|tess" -j8: 336/337 pass on #4114 and the same set passes on this branch.agc_driver_prepared_shaders_registered_workgroup_syncfails on both.agc_driversometimes exits with 0xc0000374 under -j8 on both and passes when run alone.python tools/check_conventions.py --base upstream/main: passed.GTA V result: on
main325e0a8bdwith #4082, #4114 and this commit (plus the other PRs GTA needs that are unrelated to tessellation: #425, #290, #637, #448, #423, #4021), the domain program that stopped at pc 0x9c compiles and Story mode runs past it; the log of a 150 s prologue run has no tessellation error.Checklist
main; no other open PR implements the same functions (stacked on #4114, which is 11 commits behind main)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV
🤖 Generated with Claude Code
https://claude.ai/code/session_01V1W4jdNSKTV7xwuS6xQPJV
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-12T01:06:22Z.
Thanks for stacking this on #4082 and #4114, good to see GTA V hitting the same stop. Heads-up so we don't make double work for the reviewers: #4163 (opened about 20 minutes before this one, on the same base) reads the hull's patch constants in domain programs too, from Yōtei's terrain domain, which reads its hull's records at
0x8000 - 208 * (rel + 1).The two take slightly different routes to agreeing on the record layout between the stages, so it would be useful to know whether either one covers both games. If you get a chance, could you try GTA V's domain at pc 0x9c on #4163's head? I'll check Yōtei's on this one in return, and then we can suggest one of them to the maintainers.
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-12T01:07:21Z.
Thanks, I missed #4163 when I checked for duplicates. I will run GTA V's domain on #4163's head and report here. If it covers GTA, I will close this one in favour of yours.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-12T01:17:22Z.
Closing in favour of #4163, which covers GTA V's domain program as well (tested on its head, details there). Thanks @Celegans12.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T01:17:57Z.
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.
main)core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1628, L1633core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL737, L765core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1628, L1633core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL737, L765core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1628, L1633core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL737, L765core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1628, L1633core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL737, L765core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppL3, L29core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppL87core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL22, L703core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL727core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL549-550, L552-553core/libs/prx/libSceAgcDriver/tests/Graphics.cppL533-534, L538-539, L542-543core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1493, L1628, L1633core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cppL109, L114, L126, L134, L152, L166, L169, L196, L213, L227, L264, L328, L331core/shader/recompiler/CacheKey.hppL6, L108core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL1, L508, L511, L517, L720, L737, L765core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppL114core/shader/recompiler/Optimization/src/TessellationLowering.cppL21, L486-487, L489core/shader/recompiler/Recompiler.hppL275core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppL4, L181, L187core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1628, L1633core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL737, L765core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cppL66, L95-100, L109, L114, L126, L134, L152, L166, L169, L196, L213, L227, L244, L247-250, L254, L261, L264, L326, L328, L331core/shader/recompiler/Optimization/src/TessellationLowering.cppL19, L21, L354, L385, L451-454, L486-487, L489, L494, L610core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppL478, L486, L494-495, L498, L501-504, L516, L519, L531-533, L539-547, L562, L567-569, L586, L588, L596, L603, L605, L1181, L1184, L1186, L1188, L1190docs/dev/TechnicalDebt.mdL580core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cppL66, L95-100, L109, L114, L126, L134, L152, L166, L169, L196, L213, L227, L244, L247-250, L254, L261, L264, L325-326, L328, L331core/shader/recompiler/Optimization/src/TessellationLowering.cppL19, L21, L354, L385, L451-454, L486-487, L489, L494, L610core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppL478, L486, L494-495, L498, L501-504, L516, L519, L531-533, L539-547, L562, L567-569, L586, L588, L596, L603, L605, L1181, L1184, L1186, L1188, L1190docs/dev/TechnicalDebt.mdL580core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppL3, L29core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppL87core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cppL22, L703core/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppL727core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL549-550, L552-553core/libs/prx/libSceAgcDriver/tests/Graphics.cppL533-534, L538-539, L542-543, L550core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppL1493, L1628, L1633core/libs/prx/libSceAgcDriver/tests/execution/Tessellation.cppL66, L95-100, L109, L114, L126, L134, L152, L166, L169, L196, L213, L227, L244, L247-250, L254, L261, L264, L325-326, L328, L331core/shader/recompiler/CacheKey.hppL6, L108core/shader/recompiler/ControlFlow/src/RequestSerializer.cppL1, L508, L511, L517, L720, L737, L765core/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppL114core/shader/recompiler/Optimization/src/TessellationLowering.cppL19, L21, L354, L385, L451-454, L486-487, L489, L494, L610core/shader/recompiler/Recompiler.hppL275core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppL478, L486, L494-495, L498, L501-504, L516, L519, L531-533, L539-547, L562, L567-569, L586, L588, L596, L603, L605, L1181, L1184, L1186, L1188, L1190core/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppL4, L181, L187docs/dev/TechnicalDebt.mdL580Pull request closed