feat(agc): implement packet and range predication and the predication sizes #582
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/582"
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 CnRJay on 2026-10-04T23:35:49Z.
What
Five libSceAgc exports threw
NotImplemented.sceAgcSetPacketPredication(packet, predication)sets (1) or clears (0) the PM4 predicate bit (bit 0) of a type-3 packet header and leaves the payload alone. A null packet, a non-type-3 header or a value above 1 throws.sceAgcSetRangePredication(start, end, predication)does the same for every type-3 packet in[start, end). It skips type-2 filler dwords. A range that ends inside a packet or holds another packet type throws.sceAgcDcbSetZPassPredicationEnableGetSize,sceAgcDcbSetPredicationDisableGetSizeandsceAgcDcbSetBoolPredicationEnableGetSizereturn 16 bytes.SET_PREDICATIONoperations, so the size is that of the packetsceAgcDcbSetPredicationwrites.The executor still rejects predicated packets ("PM4 header flags ... are not implemented") and
SET_PREDICATIONitself ("GPU query predication is not implemented"). A title that predicates commands still stops at execution with a clear error, rather than running them unconditionally.Tested
Windows 11, MinGW GCC 15.2.0 r7. New
agc_predication_tests:sceAgcDcbSetPredicationwrites.Full
ctest: 217/218 pass.agc_shader_memoryfails without this change too; #574 fixes it.Checklist
main; no other open PR implements the same functionsNotImplemented_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
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T01:18:26Z.
Thanks. The five NIDs recompute to these names, the predicate bit and the size from the count field are right for a type-3 header, and it matches BryKytyPS5's
AgcSetPacketPredication/AgcSetRangePredication, except that you throw for an invalid value or a reversed range, which is fine. The 16-byte sizes with the TechnicalDebt line look good to me too.One gap in the range walk: the one-dword pad
0xffff1000(a type-3 NOP with count 0x3fff, which the CP treats as a single dword; main'sCommands.cpptest calls it the empty payload marker). Here it's read as a 16385-dword packet. In a short range that throws, but in a range longer than that it silently skips the next 16384 dwords, and those packets keep their old predicate bit. BryKytyPS5 treats(header & 0x3fffff00) == 0x3fff1000as one dword. Could you do the same (or throw on it), with a test row next to the type-2 filler?agc_predication_testspasses here and fails on main's code ("sceAgcDcbSetZPassPredicationEnableGetSize not implemented"). It conflicts with #338, #407, #545 and #550 in TechnicalDebt.md (neighbouring lines), so whichever lands later needs a one-line rebase. PPSA21564 doesn't import any of these functions. The CI run still needs workflow approval.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T01:19:44Z.
Progress report (
7de111f→73a751a)📈 System libraries: 80.85% (+0.15%, +5 implemented functions)
✅ 5 implemented
sceAgcDcbSetBoolPredicationEnableGetSizesceAgcDcbSetPredicationDisableGetSizesceAgcDcbSetZPassPredicationEnableGetSizesceAgcSetPacketPredicationsceAgcSetRangePredicationImported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-05T07:26:37Z.
One more thing for when you push the pad change: #338 and #613 have landed since, and both add lines at the end of "Unknown function info" in
docs/dev/TechnicalDebt.md, where this PR adds its predication sizes line. Could you rebase onto main at the same time, keeping main's lines and adding yours after them?Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-05T23:50:11Z.
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)docs/dev/TechnicalDebt.mdL122Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-06T01:12:48Z.
Thanks for the pad change and the rebase.
d4f7ddasteps over0xffff10xxas one dword, like a type-2 filler, and leaves it unpredicated. The test now puts the pad between two packets and checks that both still get the bit and that the pad is unchanged, which throws on the previous head. That matches the one-dword size #772 uses forsceAgcGetPacketSize.