Skip to content

feat(agc): clip and cull distances on the mesh path - #5323

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
lubaxe:feat/agc-mesh-clip-cull-distances
Oct 14, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
lubaxe:feat/agc-mesh-clip-cull-distances

Conversation

@lubaxe

@lubaxe lubaxe commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What

#423 added clip and cull distances for vertex shaders on the vertex path. A vertex program that runs on the mesh path (NGG, ShaderPath::Geometry) and exports distances through PA_CL_VS_OUT_CNTL still failed to recompile with unsupported mesh output kind. PPSA06694 (Remnant 2) stops on this 7 s after start.

  • DefineMeshOutputs defines gl_ClipDistance and gl_CullDistance as per-vertex arrays (float[N] per vertex, N the highest distance index used plus one), with a private per-lane copy for each distance like the other mesh outputs.
  • EmitAuxPositionExport stores a distance into that per-lane copy on the mesh path, and EmitMeshEntryPoint writes it to the vertex's element of the built-in array.
  • ShaderValidation accepts the two built-ins and the ClipDistance / CullDistance capabilities in mesh shaders, under the same device feature checks as vertex shaders.

The all-zero-position clip distance that vertex and tessellation evaluation shaders get is not added on the mesh path, as before.

Tested

  • Windows 11 Pro, Ryzen 7 9800X3D, RTX 5090 (driver 617.42), WinLibs GCC 15.2.0 r7, Release.
  • agc_driver_vertex_clip_cull_distances now draws its seven rows (clip planes, cull planes, sparse enables) a second time through an NGG program on the mesh path, and checks every pixel. The program is the one from LayeredVolumeDraw.cpp, with pos1 exporting four components. On main the mesh rows fail with unsupported mesh output kind. The mesh rows are skipped on a device without VK_EXT_mesh_shader.
  • ctest on main 8c772ad with this change: 1076 of 1077 passed. The failure is agc_driver_pixel_lds, which also fails on unmodified main on this GPU. Rebased onto main 61b8742; there agc_driver_graphics, guest_np_auth and agc_driver_vertex_clip_cull_distances pass.
  • PPSA06694 now gets past the start; on main it stops at the first such shader.
  • tools/check_conventions.py --base origin/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA06694 Remnant 2 (PPSA06694) #5320
  • GPUs tested: NVIDIA GeForce RTX 5090, driver 617.42, Windows 11 Pro
  • AI-assisted: yes

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* shader core/shader

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants