fix(shader): support wave32 mesh programs #2137

Merged
Sanjaysrinivas merged 1 commit from upstream-pr/2137 into main 2026-10-10 06:13:11 +00:00
Sanjaysrinivas commented 2026-10-09 09:52:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Sanjaysrinivas on 2026-10-09T09:52:31Z.


What

Wave32 NGG mesh programs currently fail resource analysis with mesh shader translation configuration is not supported, even for a 32-thread workgroup. The mesh entry prologue rejects every wave size except 64 and constructs its wave indices and counts with 64-lane constants.

Use the declared guest wave size for the wave index, per-wave vertex/primitive counts, and the workgroup wave count in s3. Preserve wave64 behavior and rejection of partial waves and workgroups exceeding the four-bit wave-count field.

The register layout follows Mesa's get_wave_id_in_tg, get_tgsize, and get_thread_id_in_tg in gfx10_shader_ngg.c. TechnicalDebt.md records this source, validation, and the remaining console-hardware verification gap.

Tested

Windows, MinGW-w64 GCC 15.2.0, Release, NVIDIA RTX 4070 Laptop GPU. SPIRV-Tools disabled.

  • The synthetic 32-thread mesh regression fails before the fix with the same configuration error. Resource analysis accepts wave32 groups of 32, 64, 128, and 480 threads, and rejects 31 and 512 threads.
  • The GPU mesh fixture changes both wave-ID-to-thread-ID shifts from 6 to 5 for its wave32 variant. Indexed and non-indexed triangle lists with 32, 64, and 128 threads pass pixel readback checks; the existing wave64 rendering cases also pass.
  • Focused validation: all nine focused shader/driver CTest checks plus hardware_oracle passed (10/10, 8.08 s). Shader cache disabled; Vulkan required; no GPU checks skipped. The optional oracle assembly case skips locally because LLVM is not installed. The conventions check passed. Shader and driver sources are unchanged through the final rebase onto main 745b775e2, which includes the upstream oracle CI fix #2151. The oracle suite was rechecked after that rebase.
  • Separately, Silent Hill 2 (PPSA08709) startup was checked locally on main d9484c719 with #1188, #1836, #1893, and this fix applied. A clean driver build passes the mesh-configuration failure and stops later at shader sampler pairs exceed runtime heap capacity. Gameplay and FPS are unverified. The prerequisite startup patches are not included in this PR.

Linux and console hardware were not tested. Full cross-platform PR builds require the repository's manual collaborator 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; silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4798830546 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2137). Originally posted by [Sanjaysrinivas](https://github.com/Sanjaysrinivas) on 2026-10-09T09:52:31Z. --- ### What Wave32 NGG mesh programs currently fail resource analysis with `mesh shader translation configuration is not supported`, even for a 32-thread workgroup. The mesh entry prologue rejects every wave size except 64 and constructs its wave indices and counts with 64-lane constants. Use the declared guest wave size for the wave index, per-wave vertex/primitive counts, and the workgroup wave count in `s3`. Preserve wave64 behavior and rejection of partial waves and workgroups exceeding the four-bit wave-count field. The register layout follows Mesa's `get_wave_id_in_tg`, `get_tgsize`, and `get_thread_id_in_tg` in [gfx10_shader_ngg.c](https://chromium.googlesource.com/chromiumos/third_party/mesa/+/refs/heads/stabilize-13982.70.B-chromeos-amd/src/gallium/drivers/radeonsi/gfx10_shader_ngg.c). `TechnicalDebt.md` records this source, validation, and the remaining console-hardware verification gap. ### Tested Windows, MinGW-w64 GCC 15.2.0, Release, NVIDIA RTX 4070 Laptop GPU. SPIRV-Tools disabled. - The synthetic 32-thread mesh regression fails before the fix with the same configuration error. Resource analysis accepts wave32 groups of 32, 64, 128, and 480 threads, and rejects 31 and 512 threads. - The GPU mesh fixture changes both wave-ID-to-thread-ID shifts from 6 to 5 for its wave32 variant. Indexed and non-indexed triangle lists with 32, 64, and 128 threads pass pixel readback checks; the existing wave64 rendering cases also pass. - Focused validation: all nine focused shader/driver CTest checks plus `hardware_oracle` passed (10/10, 8.08 s). Shader cache disabled; Vulkan required; no GPU checks skipped. The optional oracle assembly case skips locally because LLVM is not installed. The conventions check passed. Shader and driver sources are unchanged through the final rebase onto main `745b775e2`, which includes the upstream oracle CI fix #2151. The oracle suite was rechecked after that rebase. - Separately, Silent Hill 2 (PPSA08709) startup was checked locally on main `d9484c719` with #1188, #1836, #1893, and this fix applied. A clean driver build passes the mesh-configuration failure and stops later at `shader sampler pairs exceed runtime heap capacity`. Gameplay and FPS are unverified. The prerequisite startup patches are not included in this PR. Linux and console hardware were not tested. Full cross-platform PR builds require the repository's manual collaborator 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 - [x] Unimplemented paths throw; silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
adriadam10 commented 2026-10-10 06:13:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-10T06:13:08Z.


Checked on Linux (merged onto current main, RADV): scoped build and ctest green, agc_shader_memory and agc_driver_mesh pass, and both fail with the translator change reverted. The wave32 prologue keeps the wave64 behaviour and the partial-wave / >15-wave rejection; the TechnicalDebt line records the unverified console register values. Merging.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6094540476 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2137#issuecomment-6094540476). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-10T06:13:08Z. --- Checked on Linux (merged onto current main, RADV): scoped build and ctest green, `agc_shader_memory` and `agc_driver_mesh` pass, and both fail with the translator change reverted. The wave32 prologue keeps the wave64 behaviour and the partial-wave / >15-wave rejection; the TechnicalDebt line records the unverified console register values. Merging.
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!2137
No description provided.