feat(agc): accept UINT16_ABGR color exports into unsigned integer targets #1073
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1073"
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 alfalfa-star on 2026-10-07T08:38:36Z.
What
SPI_SHADER_COL_FORMAT7 (UINT16_ABGR) is accepted when the target'sCB_COLOR_INFOnumber type is UINT.DecodeStaterejected it although the recompiler already handles it: an MRT output under mode 7 is auvec4(SpirvEmitterHelpers), and a compressed export's 16-bit halves are taken withOpBitFieldUExtract(ExportVector).ColorTarget::uintExport). Shader validation then requires au32x4output at its location instead off32x4.SINT16_ABGR(8), whose halves would need sign extension.R8_UINT) is undefined in Vulkan and the console's behaviour is not confirmed.Tested
Linux 7.2.9 (Arch), Mesa 26.2.4 RADV, RX 9070 XT.
R8_UINTtarget with export format 7. About 290 draws per 3 minutes were dropped; they now record.agc_driver_pixel_uint16_exportdraws compressed MRT0 exports under mode 7 into a linear 16_16_16_16 UINT target, one row per pair of packed words (0x0000ffff/0xffff0000,0x00010002/0xffffffff, the two swapped, and four distinct halves), and reads every 16-bit component back under the identity, STD_REV (0x1b) and ALT_REV (0x93) export mappings. A sixth row stays untouched. It fails if the halves are swapped or the mapping is ignored.agc_driver_graphicscovers the decode, theuintExportflag and the blend refusal.ctest: 464 of 464 pass on currentmain.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-07T08:54:55Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL556core/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppL556core/libs/prx/libSceAgcDriver/Graphics/include/State.hppL56core/libs/prx/libSceAgcDriver/Graphics/include/State.hppL56core/libs/prx/libSceAgcDriver/Graphics/src/State.cppL595-596core/libs/prx/libSceAgcDriver/tests/Graphics.cppL1092, L2846Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-07T13:02:04Z.
I've had this PR in our Ghost of Yotei (PPSA26344 v1.008) integration tree for two long runs, and it removes the only UINT16_ABGR skips the game hit. Without it,
DRAW_INDEX_AUTOdraws with export format 7 were skipped about 0.2 times per present from the menus on, 75 times in a 1,500 s run. Most of them went into four colour targets (0x201b871200 and three neighbours, about 15 each), plus 14 others once each.With this PR at 74870921d on main
0d3c1eec8, a 2,700 s run has nocolor export format 7 is unsupportedlines at all, and those targets don't show up in any other error either. A second 2,700 s run that got past the New Game settings had none too. Neither run had a FATAL or a device lost, on Windows 11 with an RTX 3080 Laptop GPU. The branch still merges cleanly onto current main (68010dfbf).One thing this doesn't tell you: our log names a target only when a draw is skipped, so I can't see which integer format those targets have or what values reached them. The clamp-or-truncate question in your TechnicalDebt line stays open as far as Yotei goes.
Details
Builds:
yotei/integration5c55633a3 = main0d3c1eec8(#934 merge, 2026-10-07) + our open PRs + #375 at cc1ed88c9 + #1073 at 74870921d + env-gated local probes;yotei/integrationc26df5aac (older main, without #1073).The skip, from
stderrof the run without the PR:The log has 75 such lines, all
DRAW_INDEX_AUTOwith format 7 (the per-phase counts cover the presents' windows, 74). By target: 0x201c296300 16, 0x201b871200 15, 0x201bbd2d00 15, 0x201ccbb400 15, and 0x201b750900, 0x201bab2400, 0x201be13f00, 0x201bf34800, 0x201c175a00, 0x201c4d7500, 0x201c5f7e00, 0x201c839000, 0x201c959900, 0x201cb9ab00, 0x201cefc600, 0x201d01cf00, 0x201d25e100 and 0x201d37ea00 once each.With the PR: 0 lines in the cold 2,700 s run (1,115 presents) and 0 in the warm one, and none of the four main targets appears anywhere in the cold run's 526 MB
stdoutor itsstderr.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-08T05:59:20Z.
Review: CHANGES_REQUESTED
Thanks, the decode/validation side looks right: the NUMBER_TYPE check matches the recompiler's existing mode 7 handling, blending is refused, and the TechnicalDebt line is in the right section. ctest passes locally (416/416) and CI is green.
One thing to fix:
tests/PixelUint16Export.cpp:15-26: the test counts SPIR-V opcodes (OpBitFieldUExtract, half unpacks), so it pins the IR shape, not the result. A different but correct lowering would fail it, and a wrong extraction (swapped halves, wrong shift) with four extracts would pass. Please run the shader and compare values, as the other execution tests do: export packed words with edge rows (0x0000ffff,0xffff0000,0x00010002,0xffffffff) and check each 16-bit half arrives as the expecteduvec4component, including thetargetExportMappingswizzle. Keep the mode 4 case for contrast if you like.Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-08T16:53:57Z.
@adriadam10 Done in
45541350, rebased onto currentmain. The opcode-count test is gone.agc_driver_pixel_uint16_exportis an execution test now: it draws compressed mode 7 exports into a linear 16_16_16_16 UINT target and reads every 16-bit component back. Each scissored row exports one pair of packed words: the edge rows you listed (0x0000ffff/0xffff0000,0x00010002/0xffffffff, and the same pairs swapped), plus one row with four distinct halves, so any component swap shows. It runs under the identity, STD_REV (0x1b) and ALT_REV (0x93)targetExportMappings. I checked that it catches both failure modes: with the halves swapped inExportVectorit fails on row 0, and with the mapping shuffle skipped it fails under STD_REV. I left out the mode 4 case.ctest: 464/464 on RADV (RX 9070 XT).Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-10-09T11:55:20Z.
Uncharted: Legacy of Thieves Collection (PPSA05684) stops at this on
main:I made the same change independently (format 7 into UINT targets only,
uvec4outputs, no blending) while bringing the title up to its main menu, so I'm not opening a competing PR. I have not run this branch itself with the title.Imported from boykopovar/AnyPS5. Originally posted by alfalfa-star on 2026-10-09T19:58:27Z.
@adriadam10 Could you take another look? The opcode-count test is replaced by the execution test you asked for (
45541350, details above). CI is green and it still merges cleanly ontomain.@XairRrR Thanks for the Uncharted report.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-09T22:13:20Z.
Review: APPROVED
Checked the decode/validation change against the recompiler's mode 7 handling, ran the new
agc_driver_pixel_uint16_exportexecution test (all three export mappings) plusagc_driver_graphics, full ctest green on top of currentmain; the test does not build without the change. Merging.Nit for later: the new TechnicalDebt line lacks a final period.