AGC: a merged program's vertex tables are read eight user words too early; Killzone: Liberation (PPSA11142) stops on null vertex buffer table address; fix branch ready #3622

Closed
opened 2026-10-11 14:21:37 +00:00 by Mouad-Scriptz-0 · 0 comments
Mouad-Scriptz-0 commented 2026-10-11 14:21:37 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Mouad-Scriptz-0 on 2026-10-11T14:21:37Z.


Follow-up to #3534. With #1693, #3428 and #3539 merged locally, Killzone: Liberation (PPSA11142 01.000.004, Linux) starts its PSP game and stops on the first frame:

[videoout] presentation failed: AGC graphics: null vertex buffer table address
  what():  AGC graphics: null vertex buffer table address

Cause. The draw runs on the geometry path ([draw-decode] path 1, main program type 2 at 0xc8, user data at 0x8c, RSRC2 0xfb0010, 8 user SGPRs). DecodeGraphicsPrograms inserts the eight hidden user words of a merged program at the front of userData (initializeMerged, firstUserSgpr 0). The program's AGC header lists PtrVertexBufferTable at register 4 and PtrVertexAttribDescTable at 6, counted from the first user SGPR, but DecodeVertexStageInfo indexes userData with those numbers directly, so it reads inside the hidden words and finds zeros. The title's registers ([vb-table] diagnostic at the throw, 16 words):

userData: 0 0 0 0 0 0 0 31016fac 7efff390 100002 49 4dfac 7effe190 2 810000e8 2

Words 12-13 (7effe190 00000002) are the vertex buffer table and 14-15 (810000e8 00000002) the attribute table: register 4 and 6 plus the eight hidden words. The recompiler already maps those registers correctly (EmbeddedVertexFetchAnalyzer adds kEmbeddedFetchRegisterShift = 8 to reach s12 and s14 for both layouts), which is why only the host-side table reads were wrong. The SET_*_REG_INDIRECT snapshot theory from TechnicalDebt was checked with a diagnostic that re-reads every list at execution: no list changed, so it is not that.

Fix branch ready: Mouad-Scriptz-0:feat/agc-merged-vertex-tables (b63996f1, one commit on main a11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is (#3433 and #3539 carried my earlier commits this way).

  • DecodeVertexStageInfo takes hiddenUserWords (default 0) and adds it to the two table reads and their bounds checks only; fetchBufferReg and fetchAttribReg stay the header's registers.
  • The three callers pass 8 - firstUserSgpr (Draw.cpp, and both static-ABI calls in ShaderRegistry.cpp, where firstUser is already 0 for mesh programs and the plan's user count already includes the eight words).
  • agc_driver_graphics gains a header with tables at registers 4 and 6: a merged layout (eight hidden words, tables at words 12-15) decodes its resource and reports registers 4 and 6, the same layout with no hidden-word offset fails on the null table, and the plain layout still decodes.
  • tools/pr_overlap.py reports #1077 touching the same call lines (it also changes the DecodeVertexStageInfo calls, for an unrelated layered-target feature); the conflict is a one-line argument merge on each.

Result. The title passes the draw decode and the vertex program compiles; it then stops at AGC driver: a pixel shader that reads barycentrics without VK_KHR_fragment_shader_barycentric needs a vertex shader before it (Draw.cpp:255), which is a host limit here: neither Mesa 26.2.3's ANV on this Intel Arc (Meteor Lake) nor lavapipe exposes VK_KHR_fragment_shader_barycentric (checked with vkEnumerateDeviceExtensionProperties), and the barycentric emulation only covers the vertex path. On a GPU with the extension the title should go further; I cannot test that.

Tested on Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, full build with BUILD_TESTING=ON, Intel Arc Meteor Lake iGPU):

  • agc_driver_graphics and agc_driver_pm4 pass.
  • ctest -j4 --timeout 180 without the seven agc_driver_* tests that fail the same way on a clean main build on this iGPU (f64_fma_subnormals, vop1_float_unary, vopc_compare, prepared_shaders, prepared_shaders_indirect, prepared_shaders_uncached, prepared_shaders_debug): 824/825. The one failure, agc_driver_emulated_color_compare, fails identically on a clean main a11c8f7f build here (samples or gathers an sRGB image the device cannot sample, which is not implemented, an ANV format limit), so it is unrelated to this branch.
  • tools/check_conventions.py --base origin/main and git diff --check pass.
  • Not tested on Windows.

AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5801908555 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3622). Originally posted by [Mouad-Scriptz-0](https://github.com/Mouad-Scriptz-0) on 2026-10-11T14:21:37Z. --- Follow-up to #3534. With #1693, #3428 and #3539 merged locally, Killzone: Liberation (PPSA11142 01.000.004, Linux) starts its PSP game and stops on the first frame: ``` [videoout] presentation failed: AGC graphics: null vertex buffer table address what(): AGC graphics: null vertex buffer table address ``` **Cause.** The draw runs on the geometry path (`[draw-decode] path 1`, main program type 2 at `0xc8`, user data at `0x8c`, RSRC2 `0xfb0010`, 8 user SGPRs). `DecodeGraphicsPrograms` inserts the eight hidden user words of a merged program at the front of `userData` (`initializeMerged`, `firstUserSgpr` 0). The program's AGC header lists `PtrVertexBufferTable` at register 4 and `PtrVertexAttribDescTable` at 6, counted from the first user SGPR, but `DecodeVertexStageInfo` indexes `userData` with those numbers directly, so it reads inside the hidden words and finds zeros. The title's registers (`[vb-table]` diagnostic at the throw, 16 words): ``` userData: 0 0 0 0 0 0 0 31016fac 7efff390 100002 49 4dfac 7effe190 2 810000e8 2 ``` Words 12-13 (`7effe190 00000002`) are the vertex buffer table and 14-15 (`810000e8 00000002`) the attribute table: register 4 and 6 plus the eight hidden words. The recompiler already maps those registers correctly (`EmbeddedVertexFetchAnalyzer` adds `kEmbeddedFetchRegisterShift` = 8 to reach s12 and s14 for both layouts), which is why only the host-side table reads were wrong. The `SET_*_REG_INDIRECT` snapshot theory from TechnicalDebt was checked with a diagnostic that re-reads every list at execution: no list changed, so it is not that. **Fix branch ready:** [`Mouad-Scriptz-0:feat/agc-merged-vertex-tables`](https://github.com/Mouad-Scriptz-0/AnyPS5/tree/feat/agc-merged-vertex-tables) (`b63996f1`, one commit on `main` a11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is (#3433 and #3539 carried my earlier commits this way). - `DecodeVertexStageInfo` takes `hiddenUserWords` (default 0) and adds it to the two table reads and their bounds checks only; `fetchBufferReg` and `fetchAttribReg` stay the header's registers. - The three callers pass `8 - firstUserSgpr` (`Draw.cpp`, and both static-ABI calls in `ShaderRegistry.cpp`, where `firstUser` is already 0 for mesh programs and the plan's user count already includes the eight words). - `agc_driver_graphics` gains a header with tables at registers 4 and 6: a merged layout (eight hidden words, tables at words 12-15) decodes its resource and reports registers 4 and 6, the same layout with no hidden-word offset fails on the null table, and the plain layout still decodes. - `tools/pr_overlap.py` reports #1077 touching the same call lines (it also changes the `DecodeVertexStageInfo` calls, for an unrelated layered-target feature); the conflict is a one-line argument merge on each. **Result.** The title passes the draw decode and the vertex program compiles; it then stops at `AGC driver: a pixel shader that reads barycentrics without VK_KHR_fragment_shader_barycentric needs a vertex shader before it` (`Draw.cpp:255`), which is a host limit here: neither Mesa 26.2.3's ANV on this Intel Arc (Meteor Lake) nor lavapipe exposes `VK_KHR_fragment_shader_barycentric` (checked with `vkEnumerateDeviceExtensionProperties`), and the barycentric emulation only covers the vertex path. On a GPU with the extension the title should go further; I cannot test that. **Tested** on Fedora 44 (kernel 7.2.8, GCC 16.2.1, Ninja, Release, full build with `BUILD_TESTING=ON`, Intel Arc Meteor Lake iGPU): - `agc_driver_graphics` and `agc_driver_pm4` pass. - `ctest -j4 --timeout 180` without the seven `agc_driver_*` tests that fail the same way on a clean `main` build on this iGPU (`f64_fma_subnormals`, `vop1_float_unary`, `vopc_compare`, `prepared_shaders`, `prepared_shaders_indirect`, `prepared_shaders_uncached`, `prepared_shaders_debug`): 824/825. The one failure, `agc_driver_emulated_color_compare`, fails identically on a clean `main` a11c8f7f build here (`samples or gathers an sRGB image the device cannot sample, which is not implemented`, an ANV format limit), so it is unrelated to this branch. - `tools/check_conventions.py --base origin/main` and `git diff --check` pass. - Not tested on Windows. AI-assisted: yes (Claude Code).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#3622
No description provided.