feat(agc): draw PS4 ES-GS-VS geometry shaders through a Vulkan geometry stage #22439
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22439"
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 B-Howell on 2026-11-17T15:55:44Z.
What
A PS4 (GCN) title draws geometry shaders with
VGT_SHADER_STAGES_EN0xb0, whichDecodeShaderStagesrefused (unsupported geometry routing, fast launch or wave-ID state). This PR draws that routing through a Vulkan vertex stage (the ES) and a Vulkan geometry stage (the GS). The VS slot holds the copy shader, which is read but not compiled.Register decode. Mesa
gfx7.json(mesa-25.2.8):VGT_SHADER_STAGES_ENfieldsLS_EN[0,1],HS_EN[2,2],ES_EN[3,4],GS_EN[5,5],VS_EN[6,7]. WithES_STAGE_REAL= 2,GS_STAGE_ON= 1 andVS_STAGE_COPY_SHADER= 2, 0xb0 is ES real, GS on, and the copy shader on the VS stage.VGT_GS_MODE:MODE[0,2] (GS_SCENARIO_G= 3),CUT_MODE[4,5],ES_PASSTHRU[13],COMPUTE_MODE[14],FAST_COMPUTE_MODE[15],ELEMENT_INFO_EN[16],SUPPRESS_CUTS[18],ONCHIP[21,22]. The other four bits are accepted because they only tune VGT scheduling and ring write combining, not what the stages compute:GS_C_PACK_EN[11],PARTIAL_THD_AT_EOI[17],ES_WRITE_OPTIMIZE[19] andGS_WRITE_OPTIMIZE[20]. Mesa'sac_vgt_gs_modesetsES_WRITE_OPTIMIZE(GFX8 and older) andGS_WRITE_OPTIMIZEon every legacy GS draw.VGT_GS_OUT_PRIM_TYPEOUTPRIM_TYPE[0,5]:POINTLIST0,LINESTRIP1,TRISTRIP2.VGT_GS_INSTANCE_CNT:ENABLE[0],CNT[2,8].VGT_GS_MAX_VERT_OUT[0,10].VGT_ESGS_RING_ITEMSIZE,VGT_GSVS_RING_ITEMSIZEandVGT_GS_VERT_ITEMSIZEare each [0,14].SPI_SHADER_PGM_RSRC2_VS:USER_SGPR[1,5],SO_EN[12].shadPS4
143b58aa48decodes this routing the same way.regs_vertex.hhasEsGs = 0xB0u.vk_pipeline_cache.cppbindsHwStage::ExportasSwStage::VertexandHwStage::GeometryasSwStage::Geometry, and skips the draw onregs.vgt_gs_mode.onchip || regs.vgt_strmout_config.raw.Decode (
State.cpp). For a GCN guest, 0xb0 decodes asShaderStages::legacyGeometrywhenVGT_GS_MODEisGS_SCENARIO_G, off chip, with no ES pass-through, compute mode, element info or suppressed cuts. It reads the input vertex count from the primitive type, plus the output topology,VGT_GS_MAX_VERT_OUT, the instance count, and the ESGS and per-vertex GSVS item sizes. These throw by name: stream-out, streams 1-3 (VGT_GS_VERT_ITEMSIZE_1-3), point output, adjacency, rect, quad and patch input, a GSVS ring item smaller than the vertex size times the maximum, and viewport depth remapping through a geometry shader.DrawDecode.cppreads the ES, GS and copy VS from their own program and user-data registers (0xc8,0x88and0x48).ES. The ES is compiled as a Vulkan vertex shader. Its ESGS ring stores (
soffsetthe ES2GS offset SGPR) become its output record ofVGT_ESGS_RING_ITEMSIZEdwords.GS. The GS is compiled as a Vulkan geometry shader with
Invocations= instance count andOutputVertices=VGT_GS_MAX_VERT_OUT. Its input VGPRs carry the ES vertex offsets. An ESGS ring read becomes a read of that input vertex's record: component = (soffset+ offset) / 256, as in shadPS4'sRingAccessElimination(bucket = soffset.U32() / 256u). GSVS ring stores (soffsetthe GS2VS offset SGPR) go to a per-invocation array ofVGT_GS_VERT_ITEMSIZExVGT_GS_MAX_VERT_OUTdwords.s_sendmsgGS emit and cut becomeEmitVertexandEndPrimitive. This follows the way #22251 lowers the tessellation rings (TessellationLowering,TessellationBaseandGet/SetTessellationAttribute).Copy VS defines the outputs.
ParseGeometryCopyProgramreads each export of the copy VS. Each enabled component is either a GSVS ring dword, read atsoffset+ offset = slot xVGT_GS_MAX_VERT_OUTx 64 bytes and addressed by the incomingv0x 4, or a constant. The GS stores slot k of vertex v at byte (k xVGT_GS_MAX_VERT_OUT+ v) x 4, and the copy reads slot k at 16 times that slot base, because the GSVS write descriptor is swizzled with 16-lane groups. Mesa does the same:ac_nir_lower_legacy_gs.cstores atbase = offset * vertices_out(offset 4 per component) plus vertex x 4, andac_nir_create_gs_copy_shader.cloads atoffset * vertices_out * 16; shadPS4'sRingAccessEliminationmaps a store offset to the copy read offset with* 16u. Every emit copies those dwords of the emitted vertex out of the array to the same export targets. shadPS4'sParseCopyShaderderives the same layout (output_vertices = comp_stride / 64) and foldss_movk,s_addk,s_lshlands_bfmscalar offsets. Here, scalar moves, adds, shifts, masks and multiplies with known sources are folded.Copy VS control flow. A PS4 copy VS selects its stream block with
s_lshr_b32 s10, s2, 24,s_cmpk_eq_u32 s10, 0ands_cbranch_scc0to the end.s2is the stream-out configuration SGPR, which follows the user SGPRs whenSO_ENis set. Its stream ID (bits 24-25, as in radeonsi's GS copy shader) is 0, and its buffer bits are 0, because only stream 0 without stream-out is drawn. That SGPR is therefore read as 0. Scalar compares then give a known SCC, and forwards_branchands_cbranch_scc0/1on a known SCC are followed. These throw: any other branch, a backward branch, a write to EXEC, an export of a computed value, and a GSVS read whose address is not the incomingv0x 4.Bounds. A GSVS store at a constant address past the item throws. A store at a computed address past it goes to a spare dword that no output reads.
Configuration in caches and requests. The geometry configuration is in the shader key, the pipeline journal (format 23) and serialized requests (version 67). This PR stacks on #22328, which uses 66 (and #22251, which uses 65). Main ends at request version 64 and journal format 20 (#28218's early-Z byte). Journal format 21 was written only by earlier heads of this PR, without that byte, and is refused; 22 is left for #22251 and #22328, whose tessellation byte also used 20. Shader validation accepts the copied geometry stage's execution modes, clip and cull distances, and its
PrimitiveId/InvocationIdinputs.The gaps are recorded in
docs/dev/debt/changes/claude-gcn-es-gs-copy-vs.md. Nothing is keyed to a title, a shader or a value.Tested
Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, RTX 4080 SUPER, driver 621.14.
tests/execution/GcnGeometry.cpp(agc_driver_gcn_geometry) is new and uses hand-assembled gfx7 programs:s_addk_i32,s_lshl_b32ands_bfm_b32are folded. A stream-select block is followed when the stream-out configuration SGPR is given, and throws when it is not. A takens_cbranch_scc0skips the export it jumps over, and an SCC overwritten bys_add_u32after the compare is not trusted.s_cbranch_execz, an EXEC write, and a movedv0.RequestSerializerTests.cpp: a version 67 geometry round trip; version 66 and older requests still read.tests/ShaderMemory.cppexpects version 65. Windows Defender quarantinesagc_shader_memory_tests.exehere, so it ran on Linux (WSL, GCC 11.4) at8b64e1c900b:agc_shader_memory,agc_shader_memory_coherent_atomic_loadsandrequest_serializer, 3/3 pass. Later commits do not touch the serializer or that test.ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation,VK_ADD_LAYER_PATHset to the 1.4.363.1 SDK,VK_LOADER_DEBUG=layer, andctest -Vonrequest_serializer,agc_driver_gcn_geometry,agc_driver_gcn_tessellation,agc_driver_tessellation_geometry,agc_driver_pipeline_journal,agc_pipeline_journal,agc_driver_register_key,agc_graphics_profile_drawandagc_driver_prepared_graphics.8e00caff807;c89e3c5819eonly adds tests, andagc_driver_gcn_geometrywas rerun on it): 9/9 pass, 25Insert instance layer "VK_LAYER_KHRONOS_validation"lines, nowas not found but was requested by env var VK_INSTANCE_LAYERS, noVUID-.main(c8542bb73d5): 7/7 pass, 23 layer inserts, noVUID-.agc_driver_gcn_geometryandagc_driver_gcn_tessellationdo not exist onmain; the new test cannot build there, becausemainhas no GCN geometry decode.c89e3c5819e):PipelineJournal.cpp's Linux x86_64 libstdc++static_asserts still saidState1008 andShaderStages164, so the Linux build failed.258b5932450sets them to 1064 and 224, read from a WSL Ubuntu GCC 11.4 build of this head, and adds guards forGeometryConfiguration(48) andGeometryCopyExport(32). The recipe codec andCanonicalPipelineStatealready carriedlegacyGeometry. On WSL the old file fails with both assertions and the new head buildsagc_driver_gcn_geometry_tests,agc_driver_gcn_tessellation_testsandagc_driver_graphics_tests;agc_pipeline_journalpasses, and the two GCN tests skip there because WSL has no Vulkan loader. The guards are compiled out on Windows, so the Windows binaries and the validation results above are unchanged.61c3102e80dmerges the #22328 heada589520069d; it changes no AGC or shader file.258b5932450, Khronos validation 1.4.363,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1):agc_driver_gcn_geometryandagc_driver_gcn_tessellationpass on RX Vega 56 (RADV gfx900, GCN5), a Ryzen 7000 iGPU (RADV gfx1036, RDNA2), RX 7900 GRE (RADV gfx1100, RDNA3) and lavapipe, with noVUID-.258b5932450merged onto main1adc0e2f4b, Khronos validation 1.4.363.1,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1): the Linux build succeeds, andrequest_serializer,agc_driver_gcn_geometry,agc_driver_gcn_tessellation,agc_driver_tessellation_geometry, the journal, register-key, profile, prepared-graphics, shader-memory andagc_driver_graphicstests pass 12/12 on an RTX 4090 (620.70.06) against 10/10 on main, with noVUID-on either and no missing-layer line.VGT_SHADER_STAGES_EN=0xb0. With the first version of this PR, it stopped on the game's copy VS (control flow in a copy program at pc 0x1c): the stream-select branch above, now handled. Now the 0xb0 draws pass and the game loads toward the world, reaching the item-tip loading screen. It stops about 16 s later, at about 69 s, on an unrelatedEVENT_WRITE event type 56 is not implemented(PIXEL_PIPE_STAT_CONTROL). Gameplay is not reached yet, so these draws' pixels were not checked in the game.check_conventionspasses.pr_overlaplists only PRs that share lines in the same files (the serializer and journal version lines,ShaderMemory.cppL8918,State.hpp,DrawDecode.cpp); none implements GCN geometry shaders. A search of open PRs for geometry shader, copy shader, ESGS and GSVS found none.v0was still taken as the vertex index. Fixed, with a test.8e00caff807: GO. It asked for tests of a taken branch and of an SCC overwritten between the compare and the branch; both were added inc89e3c5819e, andagc_driver_gcn_geometrypasses again with the layer loaded and noVUID-.358fbde4846: merged the updated #22328 branch (current mainc8f72e905cc). The geometry configuration moves to request serialization version 66, still before main's #21938 barycentrics flag. The positionalGraphicsCompileContextinitializers inDrawCapture.cpp,ShaderRegistry.cppandGcnGeometry.cppgain main's barycentrics flag beforetessellationConstantsandgeometry, and main's barycentrics test drops the geometry byte before reading a request as version 62.358fbde4846gives the geometry program-decode fixture aCB_COLOR0_INFOformat for #21747. Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER, driver 621.14, withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):agc_driver_gcn_geometryplus the 10 tests listed on #22251 pass 11/11 in 3 of 3 runs;mainpasses its 9. The layer loads in every log, nowas not foundline, noVUID-on either side. WSL Ubuntu, GCC 11.4: theagc_shader_memory_testsctests andrequest_serializerpass 36/36, andPipelineJournal.cppcompiles with its Linux layout guards.debt_fold.py --checkandcheck_conventionspass.0ffacd193bc: merged the updated #22328 branchbb91cb8b2c5(with main56d4f9fe7e0). The only conflict wasRequestSerializerTests.cpp: main's single-sample dithered alpha-to-coverage test now expects this branch's version 66 and treats 67 as the unsupported version. Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):request_serializer,agc_driver_gcn_geometry,agc_driver_gcn_tessellation,agc_driver_tessellation,agc_driver_tessellation_depth_range_remap,agc_driver_tessellation_geometry,agc_driver_graphics,agc_tessellation_loweringandagc_tessellation_factor_ring9/9;main56d4f9fe7e04/4 on the tessellation and serializer tests. Both logs load the layer, neither haswas not found, 0VUID-in each.check_conventionsanddebt_fold.py --checkpass.8eba1cbb53e: merged the updated #22328 branch86ed1185e95(with main1d1587ced3b), no conflicts. Redwindowson the previous head was main's, not this branch's:guest_freetype_ot_glyph_mutation(_patched)(#18482, reverted in #25141),audio_out2_port_layouts(#25046, reverted in #25143). Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1): the #22328 eight plusagc_driver_gcn_geometry9/9;main786bc3afa1c4/4 on the tessellation and serializer tests. Both logs load the layer, neither haswas not found, 0VUID-in each.check_conventionspasses.73f688b955a: @oneandonlydean's restart finding fixed.restartFinishedDrawnow reads a geometry program'sPA_CL_VS_OUT_CNTLexport layout from the copy program, like the two other decode sites; all three use the newPositionExportProgram, whichGcnGeometry.cppchecks (GS takes the copy program, ES and copy take their own, a GS with no copy program after it takes its own). Merged main1bc92752d23; the only conflict was thecore/shader/recompiler/CMakeLists.txtsymbol list (keptParseGeometryCopyProgramand main's NaN-speculation symbols). Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):agc_driver_gcn_geometrypasses 3/3 andagc_driver_draw_recapture_on_changepasses; the layer loads in every log, nowas not found, 0VUID-. A restarted ES-GS-VS draw with clip distances was not run (no fixture drives the recapture path through a geometry draw).check_conventionspasses.9519fe4d288: CodeRabbit fixesc2ea4d4c0deplus a merge of main6653a47801b. The fixes: restarted draws reread changed copy-program exports; draw keys cover the geometry configuration and every register the GCN geometry decode reads; GCN indirect user-data words use the hidden word count; MSG_GS_DONE keeps emit and cut; a geometry s_barrier emits no Workgroup barrier; the copy parser accepts a load into its own address register; ring address terms refuse on overflow; polygon mode follows the geometry output primitive. Main's split state took request serialization version 64, so this stack's fields move to 65-67 (the conflicts wereRequestSerializer.cpp,RequestSerializerTests.cppandShaderMemory.cpp). New checks are inGcnGeometry.cpp, including SPIR-V emit, cut and barrier counts. Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):request_serializer,agc_driver_gcn_geometry,agc_driver_gcn_tessellation, the fouragc_driver_draw_recapture_on_change*,agc_graphics_profile_draw,agc_driver_stencil_ref_export_push_budget,agc_driver_push_constant_assemblyandagc_command_batch_fence_failurepass 10/10; onmain6653a47801bthe 8 that exist there pass 8/8. Both logs load the layer, neither haswas not found, 0VUID-in each.agc_shader_memory_tests(its version fixtures changed in the merge) is not built on Windows, and Linux was not run locally.check_conventionsanddebt_fold.py --checkpass.75aef74e924: merged #2232858c5304937a(with mainea49f32e898; versions stay 65/66/67);6bbf38cc2b0collapses a zero-width viewport for GCN geometry only when it outputs triangle strips (GcnGeometry.cppchecks; the line-strip check fails without the fix). Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):request_serializer,agc_driver_register_key,agc_driver_gcn_tessellation,agc_driver_gcn_geometry,agc_driver_draw_recapture_on_change_inline,agc_driver_draw_recapture_on_change_finisher,agc_driver_tessellation,agc_driver_tessellation_geometry,agc_driver_graphics,agc_tessellation_lowering10/10. Every log loads the layer, nowas not found, 0VUID-.check_conventionsanddebt_fold.py --checkpass.d4c1ba3a31c: CodeRabbit's copy-program note fixed inbbafa86a109:ParseGeometryCopyProgramnow throws on any buffer, typed buffer, flat, LDS or image access other than the GSVS ring read, where it used to drop it (a copy-program store parsed without error and never ran).GcnGeometry.cppadds a copy program ending inbuffer_store_dword; without the fixagc_driver_gcn_geometryfails witha copy program was accepted. Merged mainc2787d822ad; the only conflict was theUserDataWordsrole line inDrawDecode.cpp(kept this branch'sLinkedOnlyRole, main'shiddenUserWordsterm was already here). Main still ends at request serialization version 64 and has not changed the serializer or journal since the last merge, so 65/66/67 do not collide. Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):agc_driver_gcn_geometry,agc_driver_gcn_indirect_draw_location,agc_driver_gcn_tessellation,agc_driver_tessellation_geometry,agc_driver_draw_recapture_on_change_inlineand_finisher6/6 on the merged head;mainc2787d822ad4/4 on the four that exist there. Every log loads the layer, nowas not found, 0VUID-.check_conventionsanddebt_fold.py --checkpass.dbb26e7a016: following akimfomin's note,2ffa22b8311makes the pixel check catch a duplicated primitive or a twisted strip. Each quad is blended at a quarter of its colour over the clear colour, and five points per quad are sampled. Two temporary controls fail it: drawing twice (red 144, expected 80) and swapping two GS vertex x stores (a sample near an edge keeps the clear colour). Merged #223288dd935bb29f(tessellation constants read with the draw's memory), clean, no version change. Same setup as above:agc_driver_gcn_geometry,agc_driver_gcn_indirect_draw_location,agc_driver_gcn_tessellation,agc_driver_tessellation_geometry,agc_driver_draw_recapture_on_change_inlineand_finisher6/6, 10 layer inserts, nowas not found, 0VUID-;mainc2787d822ad4/4, 0VUID-. #22328's newShaderMemory.cppcheck is inagc_shader_memory_tests, which is not built on Windows here; CI runs it.check_conventionsanddebt_fold.py --checkpass.1e7436042b4: CodeRabbit's three notes. (1)Evaluateremembers solved terms and stops at the first operand it cannot solve, so a sharedISub32(a, a)chain is no longer 2^n calls; the newagc_geometry_loweringtest (31 shared steps) passes in 0.07 s and times out at 10 s without the fix. (2) The copy parser refuses GSVS reads through two descriptors, or after the descriptor SGPRs are rewritten; whether the one descriptor is really the GSVS ring is not checked (recorded in debt). (3) It refuses a GSVS read with the LDS modifier. EachGcnGeometry.cpprefusal fails with its fix reverted. Same Windows setup withANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer:agc_geometry_lowering,agc_driver_gcn_geometry,agc_driver_gcn_indirect_draw_location,agc_driver_gcn_tessellation,agc_driver_tessellation_geometryand the twoagc_driver_draw_recapture_on_changetests 7/7, 10 layer inserts, nowas not found, 0VUID-;mainc2787d822ad(the main in this head) 4/4, 0VUID-.check_conventions,debt_fold.py --checkandcheck_test_registrationpass.84c6ee2d4bd: MarcZX10's overflow point.GeometryRingDwordscomputes GSVS ring sizes in 64 bits and refuses rings that do not fit 32-bit addresses; the copy parser, lowering and SPIR-V ring use it.agc_geometry_loweringcovers the largest accepted ring (1024 vertices x 32767 dwords) and a wrappingVGT_GS_MAX_VERT_OUT, and fails with the check disabled. Windows RTX 4080 SUPER, LunarG 1.4.363.1 validation: 6/6 focused tests, 0VUID-; main1d9818437fd3/3, 0VUID-.681916a0952: merged mainfb41bd71986. The only conflict was the pipeline journal format line: main's #28218 took format 20 for its early-Z byte. This head writes format 23 (main's byte plus this stack's fields); 21 was written only by earlier heads of this PR without the early-Z byte, and 22 is left for #22251 and #22328, whose tessellation byte also used 20. Request serialization is unchanged (main still ends at 64; this PR writes 67). New check intests/execution/PipelineJournal.cpp: the journal is written as 23, and the same file stamped 19, 20, 21, 22 or 24 is not replayed while 23 is. Windows 11, WinLibs GCC 15.2.0 r7, RTX 4080 SUPER,ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer(LunarG 1.4.363.1):request_serializer,agc_driver_pipeline_journal(with the new check),agc_driver_pipeline_journal_undecodable_module, the sixagc_pipeline_journal*tests,agc_driver_gcn_geometry,agc_driver_gcn_tessellation,agc_driver_tessellation_geometryandagc_geometry_lowering13/13, 34 layer inserts, nowas not found, 0VUID-;mainfb41bd7198610/10 on the ten that exist there, 25 layer inserts, 0VUID-. Linux layout guards:PipelineJournal.cppcompiles under WSL Ubuntu GCC 11.4 (-fsyntax-onlywith the build's flags), soStateis still 1064 there; with the guard changed to 1063 it fails.check_conventionsanddebt_fold.py --checkpass.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)Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T18:28:34Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: the GSVS store bound and the copy shader's slot stride do not describe the same ring, so outputs past the first slot of a real geometry shader are refused or lost.
What I ran
258b59324504f290c4ba614e2ab47af902bee4a1, basemain. Read the run folder'sdescription.md,commits.md,manifest.jsonanddiff.patch(all 3530 lines), plus the house-rule sections.Command and result
Three matching lines, at 35, 61 and 95.
diff.patch. Three are excluded fromfiles/for size (ShaderResources.cpp,tests/Graphics.cpp,tests/ShaderMemory.cpp). The full text of the other 51 was not opened.Results
diff.patchFindings
Blocking
core/shader/recompiler/Optimization/src/GeometryLowering.cpp:207: the store-side GSVS bound admits only ring bytes belowVGT_GS_VERT_ITEMSIZE×VGT_GS_MAX_VERT_OUT× 4. The copy-side reader accepts slot k <VGT_GS_VERT_ITEMSIZEat k ×VGT_GS_MAX_VERT_OUT× 64 bytes (GeometryLowering.cpp:363forslotBytes,:418for the check).VGT_GS_MAX_VERT_OUT4 andVGT_GS_VERT_ITEMSIZE5, a constant-offset store past byte 80 is refused as "GSVS ring store outside …", and a computed one goes to the spare dword. A real GS that writes its second output at the copy's 256-byte stride therefore loses that output. The emitted read at slot × maxVertices + count (GeometryLowering.cpp:256) then reads dwords the GS never wrote.tests/execution/GcnGeometry.cppstores component c at byte 16c, whileGcnCopyreads slot c at 256c. They match only because the emitted index comes from the slot number, never from the byte address.Non-blocking
core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cpp:125:firstUserSgprbecomes 0 for every GCN guest graphics program, not only the new ES, GS and copy programs. Before, only the VS at 0x04c and the PS used 0. LS (0x14c), HS (0x10c) and GS (0x08c) now change, which moves the hidden-word offset used inUserDataWords(DrawDecode.cpp:95). The description does not mention this, and the new tests only check the new programs. Please confirm that the existing GCN LS and HS paths keep their mapping.core/libs/prx/libSceAgcDriver/Graphics/src/State.cpp:1328: theVGT_GS_MODEmask0x001a0837also lets bits 11, 17, 19 and 20 through. The description refuses bits 13–16, 18 and 21–22 and does not say what the others are. Name them or refuse them.Not verified
gfx7.json: not checked.static_asserts): not built.To get this to a good state
agc_driver_gcn_geometry,agc_driver_gcn_tessellationandrequest_serializeron the new head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T18:46:53Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: the geometry ring address lowering needs a bounds-safe fix; the broader review is incomplete because three changed files were excluded and many included files were not read.
What I ran
Reviewed head
358fbde48467ce92d9d78e357c1a598003d14426usingrepo_read.pyto inspect the prepared description, commits, manifest, diff, changed-file listing, and targeted repository ranges. No tests were run.Results
Findings
Blocking
None verified. The bounds concern below requires confirmation against the intended GSVS layout and surrounding implementation before it can be called a concrete defect.
Non-blocking
GeometryRingElementclamps an index tovertexDwords * maxVertices, while the ring array is allocated with that count plus one. Since the lowering intentionally sends computed out-of-range stores to a spare dword, verify that the corresponding read/write addressing and invocation layout agree; the inspected code does not establish that the spare slot is isolated from emitted output (core/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cpp:1129,core/shader/recompiler/Optimization/src/GeometryLowering.cpp:209).Not verified
ShaderResources.cpp,Graphics.cpp, andShaderMemory.cppwere excluded from the review bundle. The other included changed files were not all read. Tests and CI were not run; the results in the PR description are author-reported. No hardware or console behavior was verified.To get this to a good state
Nothing is required for merge based on the verified evidence. Optional: confirm the spare-dword behavior with a focused test that checks the final emitted output and computed out-of-range stores.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T04:37:59Z.
Review: COMMENTED
Reviewed — no blocking findings
The changed stage decoding, ring lowering, copy-program parsing, and cache and pipeline configuration support the described legacy GCN geometry and tessellation paths; the reported tests are author-reported and were not run here.
What I ran
Reviewed head
8eba1cbb53e60e1b1e627a1ab97160f4201b3c67using the prepared diff andrepo_read.pyfor targeted source reads. No build or tests were run.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Full text for
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, andcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded as too large; only the changed hunks in those files were read. The remaining changed files were listed in the prepared manifest but not individually read. No local validation or test run was performed, so approval is not justified by this partial review.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T16:52:43Z.
Review: COMMENTED
Actionable comments posted: 10
fff8344c-6174-4ba4-91f3-70341bd519c4Reviewing files that changed from the base of the PR and between
1bc92752d2and73f688b955.core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hppcore/libs/prx/libSceAgcDriver/Execution/include/Driver/Shaders/ShaderRegistry.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawCapture.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawProgramTrace.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRegisterKey.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawRelocate.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderDiagnostics.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/Pipeline.cppcore/libs/prx/libSceAgcDriver/Graphics/src/PipelineJournal.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/Graphics.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/execution/GcnGeometry.cppcore/libs/prx/libSceAgcDriver/tests/execution/GcnTessellation.cppcore/shader/recompiler/CMakeLists.txtcore/shader/recompiler/CacheKey.hppcore/shader/recompiler/ControlFlow/include/ControlFlow/RequestSerializer.hppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Deserialize.cppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/ShaderStage.hppcore/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrMetadata/StageIO.hppcore/shader/recompiler/IntermediateRepresentation/src/IrOpcode.cppcore/shader/recompiler/IntermediateRepresentation/src/IrProgram.cppcore/shader/recompiler/Optimization/include/Optimization/GeometryLowering.hppcore/shader/recompiler/Optimization/include/Optimization/ShaderStageInputInfo.hppcore/shader/recompiler/Optimization/include/Optimization/TessellationLowering.hppcore/shader/recompiler/Optimization/src/GeometryLowering.cppcore/shader/recompiler/Optimization/src/ShaderInfoCollector.cppcore/shader/recompiler/Optimization/src/TessellationLowering.cppcore/shader/recompiler/Recompiler.cppcore/shader/recompiler/Recompiler.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterHelpers.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterInstructions.hppcore/shader/recompiler/SpirvBackend/include/SpirvBackend/SpirvEmitterState.hppcore/shader/recompiler/SpirvBackend/src/SpirvAlu/SpirvAluEmitterMath.cppcore/shader/recompiler/SpirvBackend/src/SpirvEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvEmitterHelpers.cppcore/shader/recompiler/SpirvBackend/src/SpirvMemory/SpirvModuleSetup.cppcore/shader/recompiler/SpirvBackend/src/SpirvModuleEmitter.cppcore/shader/recompiler/Translation/include/Translation/InstructionTranslator.hppcore/shader/recompiler/Translation/include/Translation/ShaderInputInfoBuilder.hppcore/shader/recompiler/Translation/src/ControlFlowInstructions.cppcore/shader/recompiler/Translation/src/InstructionTranslator.cppcore/shader/recompiler/Translation/src/ShaderInputInfoBuilder.cppcore/shader/recompiler/tests/RequestSerializerTests.cppdocs/dev/debt/changes/claude-gcn-es-gs-copy-vs.mddocs/dev/debt/changes/claude-gcn-ls-hs-vs-tessellation.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T16:58:57Z.
Review: COMMENTED
Reviewed — comments
The code inspected shows no verified blocking defect, but this review is incomplete and does not establish that the full change is ready to merge.
What I ran
Inspected prepared PR materials and selected source ranges at head
73f688b955aa91988d1a0799cd720750c541db85using the review reader. No build or tests were run; no merged-preview check was performed.Results
Findings
Blocking
None verified in the inspected code.
Non-blocking
None.
Sources
Inspected
DrawDecode.cpp,Draw.cpp,GcnGeometry.cpp, andGeometryLowering.cppat the pinned head, along with the prepared diff and PR description.Not verified
Only 7 of the 57 changed files were inspected, and only selected ranges of those files. The remaining changed files and uninspected ranges were not reviewed. The manifest lists
ShaderResources.cpp,Graphics.cpp, andShaderMemory.cppas excluded from the review folder; they were not read through the repository reader. Build, test, and console behavior were not independently verified. The description reports author-run checks, which were not run in this review.To get this to a good state
Nothing is required. Optional: complete review of the remaining changed files and run relevant checks before approval.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T18:51:08Z.
Review: COMMENTED
Actionable comments posted: 1
c78e755f-d574-48c0-8632-663c4da194f4Reviewing files that changed from the base of the PR and between
73f688b955and9519fe4d28.core/libs/prx/libSceAgcDriver/Execution/include/Driver/Draw/DrawCache.hppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawLookup.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderValidation.cppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/execution/GcnGeometry.cppcore/shader/recompiler/ControlFlow/src/RequestSerializer.cppcore/shader/recompiler/Optimization/src/GeometryLowering.cppcore/shader/recompiler/SpirvBackend/src/SpirvFlowEmitter.cppcore/shader/recompiler/Translation/src/ControlFlowInstructions.cppcore/shader/recompiler/tests/RequestSerializerTests.cppIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T19:08:36Z.
Review: COMMENTED
Reviewed — comments
The latest changes address the stated geometry and tessellation paths, but I could not read every changed file or run checks on this head, so approval is not justified.
What I ran
Reviewed head
9519fe4d2887f6cbfc0d8cd0022de9334be24d5a. No commands or tests were run; the test results in the PR description are author reported.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The full text of
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, andcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppwas excluded as too large for the review folder and was not read through the repository reader. Other changed files not individually inspected in full were also not verified. I read the prepared description, commits, manifest, patch, and targeted ranges from the geometry lowering, graphics state, shader input builder, SPIR-V emitter, and related translation and pipeline code. The description’s reported Windows/Linux tests and GPU results were not independently reproduced.To get this to a good state
Nothing is required. Optional: run the relevant checks on this exact head and review the three excluded files before making a formal approval decision.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-27T23:10:15Z.
Review: COMMENTED
Actionable comments posted: 4
ba897324-a162-444c-b04c-1749c03ca772Reviewing files that changed from the base of the PR and between
9519fe4d28and75aef74e92.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Shaders/ShaderRegistry.cppcore/libs/prx/libSceAgcDriver/Graphics/include/State.hppcore/libs/prx/libSceAgcDriver/Graphics/src/State.cppcore/libs/prx/libSceAgcDriver/tests/RegisterKey.cppcore/libs/prx/libSceAgcDriver/tests/TessellationLowering.cppcore/libs/prx/libSceAgcDriver/tests/execution/GcnGeometry.cppcore/libs/prx/libSceAgcDriver/tests/execution/GcnTessellation.cppcore/shader/recompiler/Optimization/src/TessellationLowering.cppcore/shader/recompiler/tests/RequestSerializerTests.cppdocs/dev/debt/changes/claude-gcn-ls-hs-vs-tessellation.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T01:33:37Z.
Review: COMMENTED
Actionable comments posted: 3
32cc532c-8263-49d9-b8dd-4162f433dc71Reviewing files that changed from the base of the PR and between
75aef74e92andd4c1ba3a31.core/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/Draw.cppcore/libs/prx/libSceAgcDriver/Execution/src/Driver/Draw/DrawDecode.cppcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cppcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppcore/libs/prx/libSceAgcDriver/tests/execution/GcnGeometry.cppcore/shader/recompiler/Optimization/src/GeometryLowering.cppdocs/dev/debt/changes/claude-gcn-es-gs-copy-vs.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T06:47:21Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected code and supplied test reports support the change; material parts of this large diff were not read, so this is not a complete approval review.
What I ran
dbb26e7a0162cfacb1e8f59b3fd5ea017d82331a; base recorded asmain.Results
Findings
Blocking
None identified in the inspected sections.
Non-blocking
None.
Not verified
The manifest lists 59 changed files, all marked included except
ShaderResources.cpp,Graphics.cpp, andShaderMemory.cpp, which were excluded because they were too large. I did not read any changed file’s full text; I inspected only selected sections of the diff and description. The supplied test results were not independently run or confirmed. The description reports Bloodborne reaching a later, unrelated event-write failure, so in-game rendering and gameplay remain unverified.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T07:31:57Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: make the geometry-ring address calculations overflow-safe before using them as vector sizes, indexes, or offsets.
What I ran
1e7436042b4dda8ee1c19143cf09642bc8d9ead9against the prepared diff; no merged-preview check was run.ShaderResources.cpp,Graphics.cpp, andShaderMemory.cppat the pinned head throughrepo_read.py.Results
Findings
Blocking
core/shader/recompiler/Optimization/src/GeometryLowering.cpp:2947multiplies guest-controlledmaxVerticesby 64 in 32-bit arithmetic to formslotBytes. The input validator allows up to 1024 vertices, so this multiplication can wrap for larger values. The parser then uses that wrapped stride in modulo and division atcore/shader/recompiler/Optimization/src/GeometryLowering.cpp:3009, potentially accepting a copy-shader read with an invalid slot offset and mapping it to the wrong GSVS dword. The related lowering and SPIR-V code also multiplies ring dimensions in 32-bit arithmetic (GeometryLowering.cpp:228,SpirvModuleEmitter.cpp:1156, and:1303). Compute and validate these sizes in a sufficiently wide type before using them in allocations or address calculations.Non-blocking
None.
Not verified
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, andcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp. Other changed files were not all read in full; review focused on the changed hunks and their targeted context.To get this to a good state
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T09:02:05Z.
Review: COMMENTED
Reviewed — comments
The review is incomplete, so a formal merge decision is not justified.
What I ran
84c6ee2d4bdcb72d6ef782045218b396779117f3using the review reader.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
None.
Not verified
I read
core/shader/recompiler/Optimization/src/GeometryLowering.cppand inspected portions ofreview/diff.patch,review/manifest.json, andreview/commits.md. I did not read every file listed for review or inspect all diff hunks. In particular, the full text ofcore/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/Graphics.cpp, andcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cppis excluded from the review folder; I did not read those files through the repository reader. No tests, builds, hardware behavior, or CI results were independently verified.To get this to a good state
Nothing is required. Optional: complete the review of the remaining changed files and run the relevant checks before making a formal decision.
Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T22:13:20Z.
Review: COMMENTED
The request format collides with two other open branches at version 67. I compiled the exact-head serializers for this PR, #23811, and #23553. They read their own captures. This PR rejected the #23553 capture as truncated and the #23811 capture with an emulated-barycentrics flag error. Both other readers also rejected this PR’s capture. Please reconcile the version assignment as these branches land so a saved request always identifies a single layout.
The trial merge onto
a1b75b0947was clean. The format checks were native standalone tests. Paired Vulkan execution is pending.AI-assisted: yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-12-04T02:06:44Z.
Review: COMMENTED
Reviewed — comments
Nothing blocks this; the points below are optional.
What I ran
Reviewed head
681916a0952f1b52bf9e24b9a78758cb808aac8d. I inspected the prepared description, commits, manifest and diff, the fullGeometryLowering.cpptext, and targeted diff/source excerpts forState.cpp,DrawDecode.cppandTessellationLowering.cpp. No tests or builds were run here; test results in the description are author-reported.Results
Negative control
Not run; no tests were executed in this review.
Findings
Blocking
None identified in the inspected excerpts. This is not a full-file review.
Non-blocking
The change spans 61 files. Complete review of the remaining files before treating this as a merge recommendation.
Sources
Not verified
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp,core/libs/prx/libSceAgcDriver/tests/Graphics.cppandcore/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp.To get this to a good state
Nothing is required. Optional: complete the remaining source review before making a formal merge decision.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.