fix(shader): lower hulls with one input or one output control point #5457
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5457"
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 EagleBearerYS on 2026-10-13T20:09:03Z.
What
Resident Evil Village (PPSA01556, content 01.210.000) tessellates quad patches with one input and one output control point. While it creates its PSO cache, its hull programs stop in tessellation lowering, first with
and, once that is fixed, with
#5234 reports the first message for Resident Evil 2 (PPSA04288) too, after integer partitioning, with the same
VGT_TF_PARAM0x40042 (quad domain, integer). I haven't run that title.This builds on Celegans12's #4201 and #4222; #4172, the first PR of that chain, has merged. Only the last two commits are this pull request:
e25d561b7).derive()learned the LS-to-HS stride from the control-point term of hull LDS reads, or from the patch term of reads at a computed control-point index. A hull with one input control point reads it at constant offsets, so neither applies. Every hull read already has a patch term of exactlyinputControlPoints * localStride, which the check after it requires, so the stride is now also taken from the patch term of reads without a control-point term.1243f067b). Such a hull writes its control point at the patch record offset alone, so the write has no control-point term and was taken for a patch constant with no control stride. With one output control point, a write that fits in one record (its offset is at least 0 and its end within the patch term) is now the control point, and the control stride comes from its patch term. That is the rule #4222 applies to control-point reads in domain programs. Patch-constant records lie outside that range: below the top of the off-chip block, or above every control point. With one invocation per patch, per-patch outputs also need no control-point-0 guard inrequireFirstInvocation.Tested
agc_driver_tessellation, with the newRequireSingleControlPointHulls.HullSingleInputreads the one input control point of its patch. Without the first commit it fails with the title's message (... the local stride is unknown).HullSingleOutputhas one output control point and patch outputs without a guard. With only the first commit it fails with the title's second message (... outside its control points and patch constants).agc_driver_tessellationandagc_driver_graphicspass.maindacd78525(https://github.com/EagleBearerYS/AnyPS5/actions/runs/38455894201): Windows 1097 of 1097 pass, withagc_driver_tessellationskipped because the runner has no Vulkan device. Linux 1079 of 1079 pass, withagc_driver_tessellationrun on lavapipe.agc_shader_control_flow_tests, built on #4222's head.lowerOwnLaneBitsfix requested in #4172's review (now inmainwith #4172), 19 compile. The other 2 stop at #4114's patch bound only because the dumped requests carry noNUM_PATCHES; with 128 or 170 patches per group, all 21 compile.python3 tools/check_conventions.py --base pr/4222: 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)Imported from boykopovar/AnyPS5. Originally posted by tibzejoker on 2026-10-14T01:17:25Z.
Intel run for this PR: Intel UHD Graphics 770 (Raptor Lake iGPU of an i9-13900K), driver 32.0.101.6129, Windows 11, MinGW-w64 GCC 15.2.0 Release, device picked with
ANYPS5_GPU=Intel, at head391f1b32b.agc_driver_tessellation,agc_shader_memoryandagc_driver_graphicspass.ctest -R "agc_driver|agc_masked|agc_shader" -j4: no failures out of 377 (349 pass, 28 skipped). These are the same 28 skips asmainhas on this GPU (f64, 64-bit and float atomics, fp16 interpolation and dot, mesh, shader clock and the like, which it does not support), and no new ones.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T04:43:15Z.
Title evidence for this PR: PPSA02530 (PRAGMATA v01.200.000) reaches the same first error as the Resident Evil Village one in the description.
Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, all
libs/*.prxrebuilt from the tree. PPSA02530 converted withrelinker --windows --registry --trace-imports, 90 s runs:maine33258a64+ #4237 (needed so that the title gets past its start-up allocator, see #3043) + a local log stub that makessceConvertKeycodeGetCharacterreturn an error (it throws onmain; the stub is not a proposal): the run ends with(
run_063225.err, line 115).The same tree + this PR's head
1243f067b(merge into the tree above;git merge-treeof this head againstmaine33258a64reports a content conflict incore/libs/prx/libSceAgcDriver/tests/Graphics.cpp, which I resolved with-X theirsfor this run only, the test file does not affect the title): that message does not appear any more, the title continues, and the run ends later with(
run_063830.err, line 209; stage 5 is a different shader and a different error).Not tested: this PR's own tests (conflict in the test file as above), Linux, a console; I did not check whether the second error is covered by another open pull request.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T04:49:03Z.
Thanks for running PRAGMATA on it. That's a second title past the same hull error.
Your next stop,
GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@...(GetBufferResource(..., looks like the case #5188 handles: an image descriptor read from a constant buffer at a uniform offset. If you have time, it would be worth trying #5188 on top as well.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T04:51:25Z.
Correction to my comment above: I named this PR's head as
1243f067b. The run was made on head391f1b32b(the head that was fetched for the test); I added the current head to the text without having tested it. The result described (the hull-shader message no longer appears, the title continues to theGetImageResource dword 0error at stage 5) is for391f1b32b. I will re-run on the current head and report if the result differs. Also, the.prxand relinker file dates of those runs were overwritten by later builds, so I can only give the log times of the 126-library builds (trace_vrr5,trace_vrr6), not the file dates.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T05:07:32Z.
Tested on head
1243f067b(the current head of this pull request on GitHub, same SHA; the first comment of mine was for the earlier head391f1b32b, and this run supersedes it).PPSA02530 (PRAGMATA v01.200.000), Windows 10 (19045), MinGW-w64 GCC 15.2.0, Release, 90 s run (
PPSA02530_rO/run_070451.err, logtrace_vrr8_PPSA02530.txt).Result: with this head the hull-shader stop
tessellation lowering: the hull shader reads no LDS per control point ...does not appear (0 matches in the run log; it did appear on the tree without this pull request,run_063225.errline 115). The run goes on and ends later with(line 209; a different shader and a different error). I did not check whether another open pull request covers that error.
Test conditions
main75690a117+ #4237 headbf6b6c0a1+ this head1243f067b(merge into the tree,-X theirsbecausecore/libs/prx/libSceAgcDriver/tests/Graphics.cppconflicts withmain; the test file does not affect the title run). Merged tree HEADbecd064af. A local log stub makessceConvertKeycodeGetCharacterreturn an error (it throws onmain); not a proposal.ninja -C build -j4 relinkerplus all 126core/libs/libs/*.prxtargets from that tree, finished at 07:03:36 local time: 128.prxfiles incore/libs/libs, oldest 2026-10-13 05:53:26 (a library without changes in this tree, not rebuilt), newest 2026-10-14 07:03:36;libSceAgcDriver.prx07:03:35,libkernel.prx06:47:15 (ninja found it up to date, so it was not rebuilt).relinker.exe2026-10-14 06:55:28 (ninja found it up to date for this tree).relink_title_trace.ps1 -Id PPSA02530 -ElfDir I:\AnyPS5\Games\PPSA02530_elf -Suffix O -Repo K:\AnyPS5\wt-sockets=relinker.exe --windows --registry --trace-imports in\eboot.elf app.exe; no-ModuleDir, no--windows-fixed-base. Run:run_title.ps1 -Seconds 90,APS5_TRACE_CALLS=all.Not tested: this pull request's own tests (conflict in the test file), Linux, a console.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-14T05:11:18Z.
I ran this against Ghost of Yōtei's hull and domain programs to check it doesn't change anything for a title that uses 3 and 4 control points, and it doesn't: every request gives the same result and byte-identical SPIR-V with and without your two commits. Yōtei's terrain hull (0x80002fc700, quads, 4 in / 4 out) still lowers to the same 386,580-word module, and the 14 triangle hull requests (3 in / 3 out) produce the same modules too. None of them has a single control point, so the new paths in
derive()never change the outcome. The constant-offset stride rule isn't limited to one input control point, so it does run on these hulls, but there it just agrees with the stride the other reads already give.agc_driver_tessellation(with your newRequireSingleControlPointHulls),agc_shader_memoryandagc_driver_graphicspass on Windows with an RTX 3080 Laptop GPU.One heads-up: after #5234 landed, I rebased the chain onto
mainf265cd5593. The new heads are #4172866ed445b9, #42012eda9f893cand #4222c1e4a0ba8b, and they're pushed now. Your two commits cherry-pick cleanly ontoc1e4a0ba8bwith an identical diff, and the results above are the same there. So you may want to rebase onto them. I'm happy to re-run this on the rebased branch.Details
Heads tested (Windows 11, WinLibs GCC 15.2.0, Release, NVIDIA driver 610.62):
f33872bec35589f924efmainf265cd5593c1e4a0ba8bc1e4a0ba8b+f8c06b748b+5589f924efctest -R '^(agc_driver_tessellation|agc_shader_memory|agc_driver_graphics)$'withANYPS5_REQUIRE_VULKAN=1: 3/3 pass on both PR builds (nothing skipped).I replayed the requests with
agc_shader_replay --spvand checked each module withspirv-val --target-env vulkan1.3. There were 35 captured requests: the terrain hull (three captures of the same program), 14 triangle hulls, 10 domain programs and 8 LS programs. Same results on all four builds:ResourceTracker(GetImageResource dword 0 is not a valid runtime value) after tessellation loweringThe domain programs (including the terrain domain
shader_c7_domain) get past tessellation lowering and then stop in resource tracking, because the old captures lack some SRT memory. For those 10, theAPS5_DUMP_IR=alldump after thesrtpass is byte-identical with and without the PR.The captures predate request version 24: they're v16, v18 and v19 written by our game branch, whose local fields differ from upstream's. So I re-serialized them to upstream v24 with a small script. It parses each capture to the last byte, keeps every captured field and adds defaults for the fields upstream gained since. The terrain hull uses its relative patch index as data. Older captures don't record
GE_CNTL.PRIM_GRP_SIZE, so I set it to the patches per group (63, which matches the newer capture). I also setBREAK_WAVE_AT_EOI. Without those it stops at #4201's checks, identically on all builds. Every build got the same inputs.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-14T05:15:58Z.
Thanks for running it against Yōtei's hulls. Good to know the 3- and 4-point hulls come out byte-identical.
#5457 is already rebased onto
c1e4a0ba8(head1243f067b), with the same two commits as your cherry-pick, so your results there apply to the PR as it is.