Repository navigation
test(libSceAgc): check the packet sceAgcDcbSetNumInstances writes - #12377
milescoviello wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
I reviewed the packet layout against the implementation and parser references, then built and ran the new test with the exact-head and ; it passed. The local harness stubbed only (the driver notification), while retaining the real packet allocation and encoding path. Diff check and repository conventions also pass. No correctness issue found in this focused test addition.
|
Correction to my approval summary: I compiled and ran the exact-head |
|
Closing this as a duplicate of my own #11678, which already checks AI-assisted: yes (Claude Code) |
|
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.
|
What
sceAgcDcbSetNumInstances(libSceAgc/DcbDraw/src/Instancing.cpp) writes the PM4NUM_INSTANCESpacket that sets the instance count for the draws after it. No test covers it, and nine of the ten titles here call it: Borderlands 4 (PPSA01494, 7 call sites), Ghost of Tsushima (PPSA02225, 18), Forspoken (PPSA03984, 15), and Metal Gear Solid 4 (PPSA18194), Crimson Desert (PPSA25286), MXGP 26 (PPSA30839), Super Meat Boy 3D (PPSA31162), Call of Duty: Black Ops II (PPSA34502) and Steins;Gate Re:Boot (PPSA36591) with one each. Crimson Desert, Black Ops II and Steins;Gate also callsceAgcDcbSetNumInstancesGetSize. In the three titles with the most call sites, 23 of their 40 calls pass the constant 1, read from the instructions before each call. I didn't trace the other 17.How
New test
agc_num_instances(tests/NumInstances.cpp), registered inlibSceAgc/CMakeLists.txtafteragc_draw_index_multi_instanced, the same way. No code change. It checks:sceAgcDcbSetNumInstancesGetSizereturns 8.0xc0002f00(type 3, one payload dword, opcode0x2F) and the count. Each call returns the packet's start and moves the cursor by two dwords, and nothing is written after the third packet.These are the words the driver's PM4 parser takes: it expects
0x2Fto be 2 dwords long (Pm4.cpp:314) and reads the instance count from the second (Pm4.cpp:1065).Tested
Linux (Ubuntu 26.04.1, GCC 15.2), on
main2227f13661:agc_num_instancespasses 3 of 3 at this head (b7220cf006).Instancing.cppwriting opcode0x2Einstead (local mutanta89f04e956), it fails withinstance count 1 wrote 0xc0002e00 0x00000001, not NUM_INSTANCES with the count.agc_num_instancespasses 3 of 3 at this head.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