fix(recompiler): give vertex-path shaders the NGG group info #5081

Merged
LeandroLP23 merged 1 commit from upstream-pr/5081 into main 2026-10-14 06:05:32 +00:00
LeandroLP23 commented 2026-10-13 11:01:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T11:01:31Z.


What

The vertex-path entry prologue sets the NGG merged wave info in s3, but leaves s2 at 0. On the NGG path s2 holds GS_TG_INFO: the subgroup's vertex count is in bits 12-20 and its primitive count in bits 22-30. Shaders compiled with LLPC (amdllpc) read their vertex count from it and build EXEC from it. The EVO engine's ui_screen_2d GS starts with:

s_bfe_u32 s1, s2, 0x9000c      ; vertex count from GS_TG_INFO
...
v_cmp_gt_u32 vcc, s1, v3       ; thread id < vertex count
s_and_saveexec_b32 s2, vcc

With s2 = 0 no vertex is exported, so every draw executes, retires and rasterizes nothing. EVO Player, Jelly5 and Emby5 present only the backdrop colour their CPU writes into the scanout each frame (#4997).

This sets s2 next to s3 in the same prologue. It uses the same lane count as both the vertex and the primitive count, and ordered wave ID 0. That is a whole one-wave subgroup, consistent with what s3 already says.

The test adds a second vertex program to agc_driver_ngg_vertex_wave_info. This one builds EXEC from s2 the way the LLPC shaders do, and the test checks every pixel for wave64 and wave32. Without the fix it fails: pixel 0 channel 0 is 64, expected 255 (EXEC built from the group info must cover every vertex).

Tested

Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release.

  • ctest -R '^agc_' -j 1 with an empty test shader cache: 464/464. ctest -E '^agc_' -j 4: 587/587.
  • agc_driver_ngg_vertex_wave_info fails with the InstructionTranslator.cpp change reverted, and passes with it.
  • Catalog releases relinked with --windows, 60 s each. On main every frame is the clear colour ff100d0d, and the title's own agc scanout dump reports changed=0. With this PR:
Title FPS Frames sampled every 400 presents
EVO Player (PPSA99039) 26.7 75 distinct colours in each, full UI
Jelly5 (PPSA99505) 25.3 92, server connection screen
Emby5 (PPSA99515) 35.8 90, server connection screen

EVO Player
Jelly5
Emby5

Fork CI: run 38383945000. Linux 1033/1034, Windows 1050/1051, relinker 144/145 on each OS. The one failure everywhere is conventions_ci_gate, which fails on any fork run because the fork uses the pre-gate workflow.

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: PPSA99039, PPSA99505, PPSA99515 (no bring-up discussion; #4997)
  • AI-assisted: yes (Claude Code)

Fixes #4997

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4842217731 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5081). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T11:01:31Z. --- ### What The vertex-path entry prologue sets the NGG merged wave info in `s3`, but leaves `s2` at 0. On the NGG path `s2` holds GS_TG_INFO: the subgroup's vertex count is in bits 12-20 and its primitive count in bits 22-30. Shaders compiled with LLPC (`amdllpc`) read their vertex count from it and build EXEC from it. The EVO engine's `ui_screen_2d` GS starts with: ``` s_bfe_u32 s1, s2, 0x9000c ; vertex count from GS_TG_INFO ... v_cmp_gt_u32 vcc, s1, v3 ; thread id < vertex count s_and_saveexec_b32 s2, vcc ``` With `s2` = 0 no vertex is exported, so every draw executes, retires and rasterizes nothing. EVO Player, Jelly5 and Emby5 present only the backdrop colour their CPU writes into the scanout each frame (#4997). This sets `s2` next to `s3` in the same prologue. It uses the same lane count as both the vertex and the primitive count, and ordered wave ID 0. That is a whole one-wave subgroup, consistent with what `s3` already says. The test adds a second vertex program to `agc_driver_ngg_vertex_wave_info`. This one builds EXEC from `s2` the way the LLPC shaders do, and the test checks every pixel for wave64 and wave32. Without the fix it fails: `pixel 0 channel 0 is 64, expected 255 (EXEC built from the group info must cover every vertex)`. ### Tested Windows 11 (26300), Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), WinLibs GCC 15.2.0, Release. - `ctest -R '^agc_' -j 1` with an empty test shader cache: 464/464. `ctest -E '^agc_' -j 4`: 587/587. - `agc_driver_ngg_vertex_wave_info` fails with the `InstructionTranslator.cpp` change reverted, and passes with it. - Catalog releases relinked with `--windows`, 60 s each. On `main` every frame is the clear colour `ff100d0d`, and the title's own `agc scanout dump` reports `changed=0`. With this PR: | Title | FPS | Frames sampled every 400 presents | |---|---|---| | EVO Player (PPSA99039) | 26.7 | 75 distinct colours in each, full UI | | Jelly5 (PPSA99505) | 25.3 | 92, server connection screen | | Emby5 (PPSA99515) | 35.8 | 90, server connection screen | ![EVO Player](https://raw.githubusercontent.com/LeandroLP23/AnyPS5/preview-4997/ppsa99039-1080p.png) ![Jelly5](https://raw.githubusercontent.com/LeandroLP23/AnyPS5/preview-4997/ppsa99505-1080p.png) ![Emby5](https://raw.githubusercontent.com/LeandroLP23/AnyPS5/preview-4997/ppsa99515-1080p.png) Fork CI: [run 38383945000](https://github.com/LeandroLP23/AnyPS5/actions/runs/38383945000). Linux 1033/1034, Windows 1050/1051, relinker 144/145 on each OS. The one failure everywhere is `conventions_ci_gate`, which fails on any fork run because the fork uses the pre-gate workflow. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99039, PPSA99505, PPSA99515 (no bring-up discussion; #4997) - [x] AI-assisted: yes (Claude Code) Fixes #4997
KauaSantos702 commented 2026-10-14 01:19:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by KauaSantos702 on 2026-10-14T01:19:46Z.


On NVIDIA this fixes #4997 for Jelly5: before, it presented only its clear colour; at this head it draws its UI.

Setup

  • NVIDIA GeForce RTX 5070 (Blackwell), driver 32.0.16.1714
  • Windows 11, Intel Core i3-10100
  • WinLibs GCC 15.2.0 r7, Release
  • Jelly5 0.6.1 (PPSA99505), the release zip from 02dnot/Jelly5. eboot.bin and sce_module/libc.prx were unwrapped from their fSELF containers and relinked with --windows and default flags.
  • Each build was run for 60 s with APS5_DUMP_FRAMES=60.
Build Presented frames Dumped frames
main d1670009f presents=600, tex_fail=0, timeouts=0 all 60 one colour, #100d0d
this PR, a1d19f00e presents=600, tex_fail=0, timeouts=0 frame 0 has 438 sampled colours; frames 10–59 show the "Connect to Jellyfin or Emby" screen (title, server address field, Resume button, Jelly5 logo)

The title's own boot-time readback (agc scanout dump ... changed=0) appears in both runs, because the title takes it at frame 0 before it draws anything, so it doesn't tell the two builds apart. The dumped frames do.

Frame 59 at main (left) and at this PR (right):

agc_driver_ngg_vertex_wave_info passes 3/3 at this head on the same card. That makes this PR's results NVIDIA (here) and RDNA 3.5 (the PR body). I did not run EVO Player or Emby5.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6158730503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5081#issuecomment-6158730503). Originally posted by [KauaSantos702](https://github.com/KauaSantos702) on 2026-10-14T01:19:46Z. --- On NVIDIA this fixes #4997 for Jelly5: before, it presented only its clear colour; at this head it draws its UI. **Setup** - NVIDIA GeForce RTX 5070 (Blackwell), driver 32.0.16.1714 - Windows 11, Intel Core i3-10100 - WinLibs GCC 15.2.0 r7, Release - Jelly5 0.6.1 (PPSA99505), the release zip from 02dnot/Jelly5. `eboot.bin` and `sce_module/libc.prx` were unwrapped from their fSELF containers and relinked with `--windows` and default flags. - Each build was run for 60 s with `APS5_DUMP_FRAMES=60`. | Build | Presented frames | Dumped frames | |---|---|---| | `main` d1670009f | `presents=600`, `tex_fail=0`, `timeouts=0` | all 60 one colour, `#100d0d` | | this PR, a1d19f00e | `presents=600`, `tex_fail=0`, `timeouts=0` | frame 0 has 438 sampled colours; frames 10–59 show the "Connect to Jellyfin or Emby" screen (title, server address field, Resume button, Jelly5 logo) | The title's own boot-time readback (`agc scanout dump ... changed=0`) appears in both runs, because the title takes it at frame 0 before it draws anything, so it doesn't tell the two builds apart. The dumped frames do. Frame 59 at `main` (left) and at this PR (right): <!-- drag jelly5_run-main_frame059.png and jelly5_run-pr5081_frame059.png here --> `agc_driver_ngg_vertex_wave_info` passes 3/3 at this head on the same card. That makes this PR's results NVIDIA (here) and RDNA 3.5 (the PR body). I did not run EVO Player or Emby5.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!5081
No description provided.