Repository navigation
feat(agc): read hull patch constants in tessellation domain programs - #4163
Conversation
|
GTA V (PPSA04264) on this PR's head (b3d525e), Windows 11, RTX 4090, on AI-assisted (Claude Code). |
|
Rebase handoff — rebased onto the freshly rebased #4114 (so the chain stays stackable), which itself sits on current Verified on Linux (CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release,
To pick it up (note: this builds on the rebased #4114, so pull that first if you take both): Heads: |
b3d525e to
f4aa18d
Compare
|
One behaviour change here after Pipodi's review on #4201. The hull's own check for patch-constant writes used to accept anything above one patch's control points. The domain's check, added in this PR, wants everything above the control points of all NUM_PATCHES patches. The hull now uses the domain's bound too, so a hull whose records would reach into another patch's control points is refused instead of lowered. That moved one test from #4114: the hull with descending records now draws at 128 patches per group and is refused at 129, which is where its lowest record first overlaps the last patch's control points. Replayed offline, Yōtei's terrain hull passes the new bound and recompiles completely. I couldn't check its two domains the same way: offline they stop earlier, at their known image-table lookups. @tibzejoker, GTA V's domain already passed the same bound, so I expect its hull to pass as well. If you have a moment to recheck Story mode on this head, I'd be glad to hear either way. Details
|
|
GTA V (PPSA04264) on this PR's head f4aa18d. On the open question: GTA's hull passes the new bound. Windows Server 2025, RTX 3060, MinGW-w64 GCC 15.2.0. Base. An integration branch on Conflicts. Against current
Tests. GTA V.
The next stop is not tessellation.
|
f4aa18d to
85e874b
Compare
TessellationLowering proved ring and LDS addresses affine over a relative patch index of up to 256. A hull that lays its patch-constant records out downwards, at 0x8000 - 208 * (rel + 1) like the quad particle hull in Ghost of Yotei, then reached a negative address for the last slot and aborted as "not affine". The relative patch index of hull and domain programs stays below VGT_LS_HS_CONFIG.NUM_PATCHES (bits 7:0, patches per threadgroup), which is 63 for that draw. DecodeShaderStages now carries NUM_PATCHES as patchesPerGroup in the tessellation configuration (draw keys, hull and domain cache keys, recompile request version 22) and refuses zero, and the lowering bounds the relative patch index by it. Configurations without it keep 256.
TessellationLowering refused every domain-program read of the off-chip ring outside its patch's control points, so domain programs that read the hull's patch constants, like the quad terrain domain in Ghost of Yotei at 0x8000 - 208 * (rel + 1), aborted. Such reads now lower to a new PatchInput kind and become Patch inputs. Hull outputs and domain inputs place a constant by its off-chip address modulo the record stride, in a record-sized array at location ceil(hsStride / 16); each program derives both on its own, so the two interfaces match although they compile separately. Domain reads at an address that does not move with the relative patch, across more than one record or inside the control-point region still throw, as does a domain program that reads patch constants but no control point. Hull patch-constant writes now take the same bound: above the control points of all NUM_PATCHES patches, not just one patch's.
85e874b to
247162d
Compare
|
Checked on this PR merged onto current |
What
Stacked on #4114; please review the last commit only.
Tessellation lowering refuses domain programs that read the hull's patch constants ("domain shader reads of patch constants or other patches are unsupported"), so a domain stage that consumes per-patch data from its hull cannot be drawn.
PatchInputkind, read throughPatch-decorated inputs that match the hull'sPatchoutputs.tessPatchBaseis gone.A domain read of a field the hull never writes cannot be detected, because the stages compile separately;
debt/shader.mdrecords that.PPSA26344's first terrain domain program reads its patch's constants at
0x8000 - 208 * (rel + 1)plus offsets 96-192, all of which its hull writes.Tested
Based on
main4bb2c7f plus #4082 and #4114. Windows 11 (MinGW-w64 GCC 15.2.0) and Linux: configure -DBUILD_TESTING=ON, full build, --target libs, ctest. Measured on #4222's head, which contains this PR:log_macrosfails here on every branch and onmain, andpatched_librariescannot loadmain'slibkernel_sys.prx(error 127), which this chain does not touchmain8299b2f: 1033/1034 pass;agc_driver_depth_compare_copyalso fails onmainIn
agc_driver_tessellation,DomainPatchReadis now a rendering check (the domain colours each patch from a constant its hull wrote at a wrapping record offset), and three refusals are new: a neighbour's record, a fixed-address patch read, and a neighbour's control point. The descending-record hull from #4114 now renders at 128 patches per group and is refused at 129, where its lowest record would overlap the last patch's control points. They fail on #4114's head with the old refusal or bound.Not tested: console behaviour.
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)