fix(agc): accept geometry programs with fewer GS and ES input VGPRs #5604
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5604"
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 babyhuey on 2026-10-14T00:54:00Z.
What
DecodeShaderStagesrejected a geometry program (non-NGGVGT_SHADER_STAGES_ENpath) unless its GS and ES input VGPR counts were both 3:SPI_SHADER_PGM_RSRC1_GSbits 29-30 andSPI_SHADER_PGM_RSRC2_GSbits 16-17. A smaller count throwsunsupported geometry VGPR allocation. This PR removes that check.The counts only say how many of the hardware's input VGPRs the program reads. In the merged ES/GS layout the inputs sit at fixed registers: the GS inputs in v0-v4 (vertex offsets, primitive ID, instance ID) and the ES inputs from v5. The mesh translation in
InstructionTranslator.cppalways initializes v0-v8 at those positions, whatever the counts are. So a program that asks for fewer inputs reads a subset of what is already there.Graphics.cppgains a decode check with the registers XPSemu's probe sets,SPI_SHADER_PGM_RSRC1_GS= 0x222c0007 (GS count 1) andSPI_SHADER_PGM_RSRC2_GS= 0x00c00010 (ES count 0). The state now decodes to the same geometry configuration as with 3/3, wheremainthrows.Tested
On the PR head
f5359183(rebased ontomaina5f493f9, which added a fast-launch exemption to the same check; the line is still removed whole), Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release:agc_driver_graphicspasses 5/5 (--repeat until-fail:5) on both. It fails onmain.State.cpporGraphics.cpp.XPSemu (PPSA97358, an xemu port), Windows 11, RTX 3080: its stop is #5437. With #5061, #5187 and #4958 merged locally and relinked with
--windows-fixed-base 0x400000, its GPU feature probe (render_geom_shader_trianglesin xemu'sgpuprops.c) draws with this shader. On that stack without this change, the draw fails withunsupported geometry VGPR allocation(shown with #5177), the probe's submission never completes, and xemu asserts after 10 s (VK_ERROR_DEVICE_LOST). With this change (forktest/verify-xps-gs, the same one-line change), the submission completes, the probe passes, and xemu runs its UI loop at about 72 fps. It then needs the user's own Xbox BIOS files. On Linux (llvmpipe) the draw goes through too; llvmpipe's own LLVM then fails to compile a later shader (Cannot emit physreg copy instruction).check_conventions.pypasses.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)--windows-fixed-base/--linux-fixed-base) is onmain, so XPSemu reaches this check onmain.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T00:57:00Z.
Review: APPROVED
Reviewed the current head and the relevant translation path.
DecodeShaderStagesdoes not use the input-allocation counts to buildMeshConfiguration; the mesh prologue initializes the fixed v0-v8 layout that the translated shader consumes. The regression exercises XPSemu’s GS=1/ES=0 registers, and the reported graphics tests plus RTX 3080 probe give direct coverage of the rejected path. I found no blocker in this diff. The open stack dependencies are documented and should remain prerequisites to merging.Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T03:23:14Z.
Windows test of #5604: Windows 10 (19045), MinGW-w64 GCC 15.2, Release,
ninja -j 4, ctest called directly; ctest ran without-V, so the logs of the passing runs do not show which GPU, if any, the tests used (not verified). Tree:main34355eeea+ merge of PR head74c043e81b0f803804c5969d357834e635851d70(local mergeba45bea27, no conflict). Logs:rtx5604_*_N.log,rtx5604_result.txt.1 ctest targets, 3 runs each, exit code 0 in 3 of 3 runs:
agc_driver_graphics.Not tested: that the new or changed tests fail without the change (no baseline run), other ctest targets, the AMD GPU unless named above, Linux, a title run.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-14T03:25:24Z.
Rebased onto
maina5f493f9(nowf5359183).mainhad added afastLaunchexemption to the samevalidateline. This PR still removes the whole line, since the mesh prologue fills v0-v8 for fast-launch programs too.agc_driver_graphicspasses 5/5 again on Linux and Windows, with no warnings inState.cpporGraphics.cpp.Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T21:03:20Z.
A Linux run on NVIDIA, for the hardware-driver case: Ubuntu 24.04, RTX 4070 Ti, driver 595.99.02, GCC 13.3, Release,
maine6ef803cewith this PR'sState.cpphunk applied (the same one-line removal), relinked with--linux-fixed-base 0x400000.main, XPSemu (PPSA97358) aborts at 12 s.APS5_CAPTURE_TRACEshows the probe's draw failing withVGT_SHADER_STAGES_EN=0x12030: unsupported geometry VGPR allocation. The title'sxemu.logends withradv/ps5: the GPU has not reached submission 2 (at 1) in 10 s,vk_result = -4, then therender_geom_shader_trianglesassertion atgpuprops.c:456.Vulkan UI: 5400 frames, and a dumped frame shows its grid background. It then waits for the user's own BIOS files, as on Windows.agc_driver_graphics_testspasses with the change. A decode check with the same two register values fails withunsupported geometry VGPR allocationagainstmain'sState.cpp.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:26:47Z.
Checked: the VGPR-count check removed in
State.cppis not used to buildMeshConfiguration(the mesh prologue fills v0-v8 at fixed positions),agc_driver_graphicspasses on the merged tree and fails without the change, and the new decode case pins the GS=1/ES=0 registers. Also fixed the "Depends on" line of the body so Conventions parses it; merging.