fix(agc): reject primitive restart only for indexed draws #60
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/60"
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 oneandonlydean on 2026-09-28T03:49:52Z.
What
DecodeStateand theDrawRejectionprecheck rejected every draw whileGE_MULTI_PRIM_IB_RESET_EN(user-config register0x24b) was set. Primitive restart only applies to index buffers, so non-indexed draws (DRAW_INDEX_AUTO) were skipped for a setting that can't affect them. A retail title leaves restart enabled around its auto-indexed draws.How
DecodeStatestill reads0x24b(so it stays in the recorded draw-key registers) but no longer rejects on it.DrawRejectiontakes anindexedflag, and reports restart only for indexed draws.Testing
tests/Graphics.cpp: with restart enabled on the reference state,DecodeStatesucceeds,DrawRejection(queue, false)is empty andDrawRejection(queue, true)namesGE_MULTI_PRIM_IB_RESET_EN.agc_driver_graphics_testsisn't registered with CTest and doesn't link onmain(unresolvedRecorder/ReadDrawArgumentssymbols). To run it, I linked its objects against the driver's objects by hand. The restart checks pass, and the run then stops at a later check that fails the same way onmain(missing register in context bank at DWORD 0x325). All registered CTest tests pass exceptagc_driverandagc_driver_pm4, which fail onmaintoo.Imported from boykopovar/AnyPS5. Originally posted by SamG-Coder on 2026-09-28T06:52:33Z.
Independently reproduced the regression and validated this fix with a small PS5 SDK demo converted to a Windows executable.
The demo draws two triangles and explicitly writes
GE_MULTI_PRIM_IB_RESET_EN(0x24b) throughsceAgcDcbSetUcRegistersIndirect. It selects eitherDRAW_INDEX_AUTOorDRAW_INDEXand tests restart off/on.Baseline:
SamG-Coder/AnyPS5@fa787cf(upstreamc368817plus the BGRA fix in #65). Patched runtime: the same baseline with this PR's0479a5fapplied without conflicts, producing local test commit830f8ec. The baseline relinker was used for both variants, and the exact same PS5 ELF inputs were reused; only the linked runtime directory changed.Each combination was tested with the draw precheck enabled and with
APS5_NO_DRAW_PRECHECK=1: 16 runs total, 140 completed flips per run, with both final framebuffers checked.The useful regression signal is that the baseline non-indexed/restart-on case completes every flip but renders no triangles. The independent pixel checker rejects that blank output. With this PR, it passes both with and without the precheck.
Validation details:
(192,235)–(1087,485), maximum sampled channel error1/255.GE_MULTI_PRIM_IB_RESET_ENrejection diagnostic and an exactly uniform background; successful flip completion alone is not counted as rendering success.This provides converted-host regression coverage for the intended fix, including the precheck-disabled path. It does not test physical PS5 execution, implement indexed primitive restart, or establish full-game compatibility. The demo and evidence remain outside the library repository.