fix(libSceAgc): link flat pixel inputs as pass-through, as the console does #27327
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27327"
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 aKazm1 on 2026-11-25T20:55:52Z.
What
sceAgcLinkShadersnow maps a flat pixel input as pass-through (SPI_PS_INPUT_CNTLFLAT_SHADEwithOFFSETbit 5), with the same mapping assceAgcCreateInterpolantMapping. Before, it used the_0100mapping, which leaves bit 5 clear.That gap is why ps5-opengl titles stop on
v_interp_mov p10 of a flat input ... is not measured(#1413). They link their shaders withsceAgcLinkShadersand read flat inputs throughv_interp_movP10, which ACO emits forload_input_vertex. On the console those inputs are pass-through, so P10 holds a vertex's value. Here they arrived as 0x402, the non-pass-through case the recompiler refuses.Console measurement. A homebrew payload on a retail PS5 (firmware 13.00) called the console's own
libSceAgcwith a Wave32 NGG vertex shader and a pixel shader whose input semantic I changed:sceAgcLinkShaderssceAgcCreateInterpolantMappingThe same console drew triangles with each value forced into
SPI_PS_INPUT_CNTL_0. 0x420 returns the three vertices in P0/P10/P20. 0x400 returns the provoking vertex in P0 and 0 in P10/P20, as on gfx1010 and gfx1036 (#1413). The details are in #1413.Still open (in the debt entry):
VGT_SHADER_STAGES_EN/VGT_GS_OUT_PRIM_TYPEafter them. This implementation writes those two first. That only matters to a caller that reads the array by position, so it is not changed here.Tested
guest_shader_link,agc_interpolant_mapping,agc_shader_helpers,agc_create_shaderandagc_shader_fusionpass.guest_shader_linknow expects 0x425 for a flat input linked to slot 5.check_conventions.py,debt_fold.py --checkandpr_overlap.pypass. #23397 changes the argument checks of the same function and merges with this branch without conflicts.main1afab89d42with #26653 (which it needs for PCSX2's fastmem fault handler):v_interp_mov p10 of a flat input with the first provoking vertex is not measured;SPI_PS_INPUT_CNTL0x402, read only through P10;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)AI-assisted: Yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T21:07:52Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the behavior change is covered by a focused regression assertion, and the mapping helper applies flat-default handling to the interpolant mapping.
What I ran
ccc235e2baf0696628c5928df251e4cacd2aa54d.repo_read.py.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The changed files read were
core/libs/prx/libSceAgc/Shader/src/LinkShaders.cpp,core/libs/tests/GuestShaderLink.cpp, anddocs/dev/debt/changes/fix-agc-link-flat-passthrough.md; all three files listed in the manifest were read.files.jsonwas unavailable. Tests, build results, and the reported console and emulator behavior were not independently verified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by Jazeupoi on 2026-11-26T09:29:02Z.
Review: COMMENTED
Tested on a second GPU: an RTX 2060 on Windows. On this machine PS5SX2 used to stop on the P10 message as soon as the BIOS started (my comment in #1413). With this change it gets past it.
Windows 11 (10.0.26300), NVIDIA GeForce RTX 2060 (driver 621.40), WinLibs GCC 15.2, Release, on
main87f0e47be5with this PR (ccc235e2ba), #26653 (14999dce09, for PCSX2's fastmem faults) and #26600 (a88ecab648, mine, NGG vertex line lists) merged locally. The title was relinked against that build. PS5SX2 ran with itsnoautoprofflag file, which avoids a SIGPROF stop that is not part of this change.guest_shader_link,agc_interpolant_mapping,agc_shader_helpers,agc_create_shader,agc_shader_fusion,guest_siginfo_faultv_interp_mov p10 ... is not measuredand no other error in the logNot run on Linux or macOS, and not with the Vulkan validation layer.
AI-assisted: yes (Claude Code)