Repository navigation
feat(libSceAgc): support back-half constants in shader fusion - #19061
Conversation
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Windows/AMD validation: the extended fusion case passes on a desktop device.
The PR's run is on a Qualcomm Adreno X1-85; this adds an AMD one. |
|
Windows check of head
AI-assisted: yes. |
|
NVIDIA Linux run with the Khronos validation layer of the current head Setup: Arch Linux (kernel 7.3.4), GCC 16.2.1, Release, NVIDIA GeForce RTX 4090 (vendor
Negative control: this PR's test with No new AI-assisted: yes (Claude Code) |
What
Allow geometry shader fusion when the back half has an embedded constant buffer. Previously both the size query and fusion threw before constructing this otherwise supported program. The back program is already copied in full, so its instructions and embedded data receive the same address translation and retain their PC-relative relationship. Front constants continue to move after that complete back span. Remove the rejection and the corresponding debt limitation; the rebuilt-program topology and the remaining front-PC restrictions stay documented.
The regression uses independently authored shader halves with back-only and simultaneous front/back constants. It checks first/last words, full back-byte preservation, unchanged input buffers, caller scratch bounds, header metadata, reuse of identical programs, different cached programs after constant changes, and operation after the source allocations are destroyed. Eight Vulkan compute dispatches of the fused scalar instruction streams check the output values and output canaries. This tests relocation and actual GPU readback, not geometry-stage rasterization.
Evidence: the user's local PPSA02530 PRAGMATA 01.300.000 libSceAgc.sprx, unwrapped SHA-256 124a637bb17080d4e754d07d73f3320531d3b5c6e384ae2a81c364c44d17abbd. sceAgcFuseShaderHalves_0200 (fd5Bp5tGTgo, VA 0xfd40) copies the back header and patches its register list without inspecting either program or the embedded constant count; sceAgcGetFusedShaderSize_0080 (dolOmWH+huQ, VA 0xf690) only checks the half types and reports the back SH-list bytes with alignment 4. PRAGMATA calls size/fuse at 0x492863/0x492899 and 0x49295e/0x49299a. These sites establish use of the function, not that a currently loaded game shader has back constants or that this change fixes its observed pipeline failure.
A local SDK probe executed the original export instructions: 720 synthetic cases / 1,440 API calls, zero mismatches. Front/back constant counts were 0, 1, 2, 17, 128 and UINT32_MAX, over GS/HS pairs, scratch and in-place register operation, mapped/unreadable/null code pointers, and invalid half/stage pairs. Full output headers, registers, scratch canaries, source preservation and size/alignment were checked. The harness supplied a memcpy import at GOT 0x28a58 and seven synthetic register-selector globals (0x459d8=0x8a, 0x459f0=0x8b, 0x45ca0=0xc8, 0x45f28=0x100, 0x459e0=0x10a, 0x459f8=0x10b, 0x45cd0=0x148). This is conditional local library verification, not console measurement or module-initialization verification. No dump, captured game shader, binary, or key is included.
Tested
Windows 11 ARM64 build 26200.9168; x64 Release binaries built with WinLibs GCC 15.2.0 r7. The implementation is shared code with no ARM-specific production path. GPU: Qualcomm Adreno X1-85, native Qualcomm Vulkan ICD
qcvkarm64xum.dllfile version 31.0.152.1. Khronos validation layer 1.4.363 from SDK 1.4.363.1, newer than the required 1.4.335 minimum.Base:
1ddbd1550631c3ee73e41fdb5b1377b40c9e439b. Contribution:631cfd1132db440331bc39e34f8eb5edaf0de3b6.git range-diffconfirms the implementation patch is unchanged by the rebase.agc_shader_fusiontest passes on the pinned main baseline. The new fixture against unchanged production code fails at the explicit back-constant rejection. With this contribution,agc_shader_fusionpasses, including eight compute dispatches, 512 output-value comparisons and output canaries.sdk-fusion-constants calls=1440 mismatches=0 memcpy-calls=216. This is 720 synthetic cases / 1,440 export calls; the supplied selector globals and memcpy hook are described above. It is not a console measurement or full module-initialization validation.libsandagc_shader_fusion_testsbuilds succeeded. Pre-test SHA-256 manifests verify test-sidelibc.prx,libkernel.prx,libSceAgc.prxandlibSceAgcDriver.prxmatch their build outputs. Public-header, conventions and whitespace checks pass.The same
agc_shader_fusiontest ran verbosely on main and the change, on the same machine/GPU, withANYPS5_REQUIRE_VULKAN=1,ANYPS5_NO_SHADER_CACHE=1,VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_LOADER_DEBUG=layerand the same SDKVK_LAYER_PATH. Both full logs containInsert instance layer "VK_LAYER_KHRONOS_validation", neither reports a missing requested layer, and both contain zeroVUID-errors. CTest JUnit XML reports the outcomes. This checks relocation and GPU compute readback, not geometry-stage rasterization.Current manual overlap review against main
bc84729655062c68fa58d41c19fadaa869cb7f2cinspected the original merge-base diffs of all four peers reported by the overlap bot. None changes the embedded-constant debt entry or implements back-half constant support. There is no dependency or required merge order; no author agreement is claimed.1c3c2f0f90e2d2d5c5e03adf9f5fd2bc7a17d9ca6d5410a5eb130d030d1b2a8f67abe8867467335d3e06266b31c84b5c0deca07a3c9c812480f9aba48ce683e07d56fb87094bbb4d24f52b7dcda91d61No Linux/macOS, console, title-boot, gameplay or performance result is claimed. Proprietary modules, captured title data and private reference harness artifacts are excluded from the PR. The local GPU results remain pinned to the baseline and contribution commits listed above; this is not geometry-stage rasterization validation.
Full build/test logs, JUnit XML, binary hashes and exact-head review data are retained locally. The debt change uses
docs/dev/debt/changes/codex-agc-fusion-back-constants.md, as current contribution rules require. The fragment validator passes, folding it reproduces the previous PR debt text exactly, and it applies to current main without colliding with a pending fragment. Allcore/implementation and test blobs are unchanged from the GPU-tested head631cfd1132db440331bc39e34f8eb5edaf0de3b6; the documentation-only follow-up does not claim another GPU run. Current-main conventions and whitespace checks pass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)