feat(libSceAgc): implement sceAgcUpdateInterpolantMapping_0100 #4826
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4826"
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 winstrex on 2026-10-12T23:03:34Z.
What
sceAgcUpdateInterpolantMapping_0100(k0E7vkgqAuE) was a throwing stub inMisc/src/ShaderFusion.cpp. It now sits next to the other interpolant mapping exports inShader/src/InterpolantMapping.cpp:It writes one
SPI_PS_INPUT_CNTL_0 + iregister per pixel shader input (input_semantics, +0x30; count, +0x50). Each input is matched to the first vertex shader output (output_semantics, +0x38; count, +0x56) with the same semantic byte. There is no identity tail, so a pixel shader without inputs writes nothing and does not read the vertex shader. It returns 0. The technical debt entry that marked its behaviour as unknown is removed.Sources:
libSceAgc.sprxfound in thefakelib/folder of an ANIMAL WELL 01.000.011 dump (not part of the game's package; firmware version unknown). The implementation was written from a text specification of that behaviour.It matches
CreateInterpolantValueformula by formula, the per-input valuesceAgcCreateInterpolantMapping_0100already uses (InterpolantMapping.cpp L22):An
is_f16input ((p & 0x00300000) != 0) takes bits 24–25 fromp << 4. Unmatched, it gets0x00180020. Matched, bits 5, 19 and 20 come fromp & s. Bits 21–22 holddefault_value_hi. This isCreateInterpolantF16Value(ShaderUtils.cpp L111).A 32-bit input sets bit 5 for
is_customor no match. This isCreateInterpolantNonF16Value(L126).Then, in both cases:
hardware_mapping, or 0;is_flat_shadedoris_custom;default_value.This is
CreateInterpolantMappingValue/CreateInterpolantDefaultValue(L134, L144).The match is the first output whose semantic byte equals the input's, which is
FindOutputSemantic(L150).The offset template 0x191 is
SPI_PS_INPUT_CNTL_0.How it differs from
vieBRwlh1Lw(which this PR leaves untouched; L135).vieBRwlh1LwusesUpdateInterpolantValue, which differs in two ways:CreateInterpolantValueSplitF16, which buildsis_f162 (high-half-only) inputs another way (CreateInterpolantF16HiValue). The specification uses the same F16 path for everyis_f16value; for example, the first input of the test gives0x02680527here and0x02680707fromvieBRwlh1Lw.is_f161 or 3 input whosedefault_valueanddefault_value_hidiffer. The specification says both are applied separately (low to bits 8–9, high to bits 21–22) and such an input is not rejected.The two remaining deviations from the specification are on invalid input, where the original faults or writes past the hardware's 32 registers: a null
regsorps, a nullvswith pixel shader inputs, or more than 32 inputs throw (CreateInterpolantMapping's existing checks).Tests in
agc_interpolant_mapping:sceAgcCreateInterpolantMapping_0100over the written registers;Without this change the test does not link (
undefined reference to sceAgcUpdateInterpolantMapping_0100). WithUpdateInterpolantValue(thevieBRwlh1Lwtransform) in place ofCreateInterpolantValueit fails with "matched high f16 half is not mapped as an f16 input".Tested
Windows 11, WinLibs GCC 15.2.0, Release:
agc_interpolant_mappingand the other 13agc_interpolant_mapping|guest_shader|agc_shadertests pass, andlibsbuilds. CI on the fork: Linux, Windows and the relinker, register-context and write-watch jobs pass.Not tested with a title. The Pathless (PPSA01825) and Balatro (PPSA21402) import
k0E7vkgqAuE; no run has reached it.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T23:03:58Z.
Progress report (
90c6839→c4c6068)📈 System libraries: 87.89% (+0.02%, +1 implemented functions)
✅ 1 implemented
sceAgcUpdateInterpolantMapping_0100Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T18:59:12Z.
Tested on Linux x86-64 (Release build, CTest), with
c4c606818merged into main9d0a41d5a:agc_interpolant_mappingpasses.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:32:47Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed