fix(agc): read shader user data without tail padding #2063
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2063"
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 MarcZX10 on 2026-10-09T06:24:12Z.
What
Read only the serialized
ShaderUserDatafields throughsharp_resource_count; the in-memory C++ struct has trailing padding that is not present in the guest shader header. Pin the serialized size to 54 bytes and cover a header that ends at that boundary.Overlap audit
The overlap report with #2261 is limited to
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp. This PR tests the serializedShaderUserDataboundary; #2261 tests registered NGG workgroup routing. They do not share production files or behavior, and this PR does not depend on #2261.Tested
Current PR head
62298425is rebased linearly onto upstreammainatcb9734cd8a9921067c84229a529518589010175a. The complete source diff remains limited to two files.libSceAgcDriverandagc_driver_graphics_tests;agc_driver_graphicspassed (1/1, 8.70 s) on this head. The regression pins the serialized boundary withstatic_assert(userDataBytes == 54).python3 tools/check_conventions.py --base upstream/mainandgit diff --check upstream/main...HEADpass.1b5a314bcherry-picked ontomaind70b8998(report).mainf1451396plus dependencies from #2026: with this fix, PPSA99005 got pastDecodeVertexStageInfoand stopped at the next known check (sceAgcCreatePrimState: invalid context register offsets);agc_driver_graphicspassed. This was not tested on currentmain.Checklist
main; no other open PR implements this correction#include <cstddef>is included directly whereoffsetofis usedImported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-09T06:31:28Z.
Checked with the title from #2026. On the same build (
mainf1451396plus the PRs listed there), with this PR in place of my local test change, PPSA99005 gets pastDecodeVertexStageInfoand stops at the next known check,sceAgcCreatePrimState: invalid context register offsets.agc_driver_graphicspasses with the PR, and fails with only the test applied (the driver file atmain), so the new case catches the bug.Two small points:
offsetof(ShaderUserData, sharp_resource_count) + sizeof(...)expression the fix uses, so a mistake there would pass in both places. Astatic_assert(userDataBytes == 54)(or a literal 54 in the test) would tie it to what opengnm writes,RESOURCE_LAYOUT_SIZE 54u.offsetofcomes from<cstddef>, which neitherShaderInputState.cppnortests/Graphics.cppincludes; it builds now through another header.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T06:33:53Z.
Addressed: both files now include
<cstddef>directly, and the regression hasstatic_assert(userDataBytes == 54)so the serialized size is independently pinned to the opengnm layout. Rebuiltagc_driver_graphics_tests;agc_driver_graphicspasses (9.11 s), and conventions plus diff checks pass.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T08:15:00Z.
Rebased the fix and its regression test onto current upstream
main25f10087; pushed headc22c8e9c. The complete diff still covers only the serializedShaderUserDatabound and the literal 54-byte regression. Linuxagc_driver_graphicspasses (1/1, 8.99 s); conventions and diff checks pass. Fork Build 37903776529 is running on this head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T08:26:57Z.
Rebased the reviewed diff onto current upstream
main6cc0503dand pushed head97833579. The updated Linuxagc_driver_graphicsCTest passes (1/1, 8.69 s); conventions and diff checks pass. Fork Build 37904987707 is running on the new head. The description records the previous full-build failure from the missing SPIR-V test include path, addressed by #2093.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T08:38:54Z.
Latest fork Build completed with the same baseline failure on Linux and Windows:
agc_shader_fusion_testscannot includespirv/unified1/spirv.hppfromVulkanTestDevice.hpp. The relinker jobs passed. This matches #2093; I recorded the exact result in the PR description and kept this PR's scope separate.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T11:36:47Z.
Rebased PR #2063 linearly onto current
main(d70b8998). On head1b5a314b,agc_driver_graphics_testsbuilds andagc_driver_graphicspasses (1/1, 9.18 s); conventions and diff checks pass, and GitHub reports the PR mergeable. The previously reported PPSA99005 run remains identified as an older-main validation. Under #2113, could a collaborator with write access run Actions → Build for this PR so the full Linux, Windows and relinker checks are recorded on the current head?Imported from boykopovar/AnyPS5. Originally posted by rmz-24 on 2026-10-09T13:31:03Z.
Windows run: Windows 11 Pro 25H2 (10.0.26200.9457), RTX 5060 Ti (NVIDIA 617.42), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
-DANYPS5_ENABLE_SPIRV_TOOLS=ON, full build pluslibs. 1b5a314b cherry-picked onto currentmaind70b8998(applies cleanly).agc_driver_graphicspasses.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T13:32:28Z.
Thanks for the Windows report: it covers the exact PR head
1b5a314bon currentmain, and the full Windows CTest passes (510/510), includingagc_driver_graphics. That supplies the Windows evidence. The upstream PR still reports only Conventions; under CONTRIBUTING, could an authorized collaborator run the official Build for this head to record Linux and the relinker matrix?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T19:28:28Z.
Rebased the existing PR linearly onto current
main(ae3d5f95) at head36762dcf. The production change and its 54-byte serialized-boundary regression remain intact. Linuxagc_driver_graphics_testsbuilds andagc_driver_graphicspasses (1/1); local and GitHub Conventions pass. I documented that the overlap with #2261 is only the shared test source file: its registered NGG-routing tests and this PR’s serialized-user-data test exercise different behavior, with no production-file overlap or dependency.\n\nCould a collaborator with write access run the required upstream Build and relinker matrix on this exact head under #2113?Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T20:05:59Z.
Updated head and validation
I rebased the existing branch linearly onto upstream
mainat8b393b6eand pushed head37e7963f. The complete diff remains limited toShaderInputState.cppand its 54-byte regression inGraphics.cpp. On the updated source,libSceAgcDriverandagc_driver_graphics_testsbuild, andagc_driver_graphicspasses (1/1); local Conventions andgit diff --checkpass. The Windows full-suite report and title run remain labeled as pre-rebase evidence.The overlap audit still concerns only the shared test source with #2261; that PR tests NGG routing, while this one tests the serialized user-data boundary. There is no shared production change or dependency. Could a collaborator with write access run Actions → Build for PR #2063 on this head? The required upstream Linux/Windows and relinker matrix has not run for it.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-09T22:56:45Z.
Rebase and current-head validation
Rebased the existing branch onto upstream
mainatcb9734cd8a9921067c84229a529518589010175a; the new head is62298425. The reviewed diff remains limited to the serializedShaderUserDataread and its 54-byte boundary regression.On Linux x86-64 with GCC 12.2 in Release mode,
libSceAgcDriverandagc_driver_graphics_testsbuild, andagc_driver_graphicspasses (1/1, 8.70 s). The local Conventions check andgit diff --checkpass. The Windows full-suite report and PPSA99005 run in the description are from earlier bases and are not represented as current-head validation.The official upstream Build and relinker matrix has not run on this head; under #2113 it needs a collaborator with write access to dispatch it.