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
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 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:
Cause. The draw runs on the geometry path (
[draw-decode] path 1, main program type 2 at0xc8, user data at0x8c, RSRC20xfb0010, 8 user SGPRs).DecodeGraphicsProgramsinserts the eight hidden user words of a merged program at the front ofuserData(initializeMerged,firstUserSgpr0). The program's AGC header listsPtrVertexBufferTableat register 4 andPtrVertexAttribDescTableat 6, counted from the first user SGPR, butDecodeVertexStageInfoindexesuserDatawith 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):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 (EmbeddedVertexFetchAnalyzeraddskEmbeddedFetchRegisterShift= 8 to reach s12 and s14 for both layouts), which is why only the host-side table reads were wrong. TheSET_*_REG_INDIRECTsnapshot 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 onmaina11c8f7f). 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).DecodeVertexStageInfotakeshiddenUserWords(default 0) and adds it to the two table reads and their bounds checks only;fetchBufferRegandfetchAttribRegstay the header's registers.8 - firstUserSgpr(Draw.cpp, and both static-ABI calls inShaderRegistry.cpp, wherefirstUseris already 0 for mesh programs and the plan's user count already includes the eight words).agc_driver_graphicsgains 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.pyreports #1077 touching the same call lines (it also changes theDecodeVertexStageInfocalls, 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 exposesVK_KHR_fragment_shader_barycentric(checked withvkEnumerateDeviceExtensionProperties), 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_graphicsandagc_driver_pm4pass.ctest -j4 --timeout 180without the sevenagc_driver_*tests that fail the same way on a cleanmainbuild 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 cleanmaina11c8f7fbuild 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/mainandgit diff --checkpass.AI-assisted: yes (Claude Code).