fix(agc): zero-fill a vertex fetch past the record count #2573
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2573"
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-10-10T06:49:06Z.
Carrying @danzaio's fix for #2241 while PR intake is paused. The change is theirs (from
danzaio/AnyPS5:fix/2241-oob-vertex-fetch, fd3ac4e9), with its three commits squashed and rebased onto currentmain.What
A strided vertex fetch at or past the descriptor's
num_recordsnow reads(0, 0, 0, 0)forOOB_SELECT0 and 1 instead of throwing.VertexBufferReadSizespans the whole fetch. The staging copy reads the record bytes and zero-fills fromnum_records * strideonward. Each such fetch gets its own copy, outside the shared copies of its sibling attributes, the host-import in-place path and the draw-snapshot cache.OOB_SELECT2 and 3 still throw pastnum_records, since each needs its own rule. Zero-stride descriptors keep their existing checks (#1769 and the laterOOB_SELECTrules for them).Rebase note: since the branch's base,
mainadded in-place vertex reads from host imports and a zero buffer for out-of-range zero-stride fetches. The past-records fetches go alongside these, are excluded from the in-place path, and get the same per-attribute handle and offset mapping. The zero-stride byte check keepsZeroStrideAvailableBytes.Why
Fixes #2241. Astro's Playroom (PPSA01325) draws its post-process and composite passes as a 4-vertex triangle strip over a 3-record vertex buffer, and aborts:
simonbbby measured the hardware result on RDNA2 (gfx1036) with
tools/hw-oraclein the issue. WithOOB_SELECT0 or 1, indices past the records return 0 in all four components, W included, unlike Vulkan'srobustBufferAccess(0, 0, 0, 1).OOB_SELECT2 and 3 follow other rules, measured in the same thread.Tested
VertexBufferReadSizeforOOB_SELECT0 to 3,vertexZeroFillTestscovers the zero-padded copy, andvertexZeroFillMergeTestscovers the split from shared copies. simonbbby'sagc_driver_vertex_fetch_past_recordsexecution test (on their branch) also passes on the author's branch, on an RTX 4050 on Windows. It covers an in-range draw that follows a past-records draw at the same address.main092e133e: the branch merges cleanly andtools/check_conventions.pypasses. CI runs the build and tests.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T08:01:12Z.
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.mdL420Imported from boykopovar/AnyPS5. Originally posted by danzaio on 2026-10-10T08:08:37Z.
Validated the carried branch on real hardware: RTX 4050 laptop, Windows, MinGW 15.2 build of
5e3268969, ANYPS5_GPU=4050. agc_driver_graphics passes in about 14s, including the vertexZeroFillTests and vertexZeroFillMergeTests. AI-assisted: yes.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T08:13:02Z.
Checked on current main: build + ctest for libSceAgcDriver (
agc_driver_graphics,agc_driver_prepared_graphicspass), the new tests fail to build without the change,OOB_SELECT2/3 and zero-stride paths unchanged, the TechnicalDebt entry records the HW measurement from #2241. Merging.Note: this conflicts with #1426 (
Draw.cpp) and #1940 (TechnicalDebt.md), so whichever lands second needs a rebase.