Skip to content

AGC: registering a compute shader header without specials throws (ps5-opengl, PPSA99005) #2580

Closed

Description

@AlxcBTW

PPSA99005 (ps5-opengl showcase) stops at AGC driver: shader metadata is outside the registered header when it registers its compute shaders.

Cause

A registered compute shader takes its wave size from its header's specials (dispatch_modifier), and PrepareRegistered reads them without a null check. ps5-opengl registers compute headers without specials, because it only writes the specials pointer at +40 for linked graphics stages. It passes the wave size in the dispatch initiator instead: sceAgcCbDispatch(..., m->compute_wave_size == 32 ? 0x8000 : 0) in src/platform/ps5_agc_runtime_backend.c. The specials pointer is 0, so registration throws.

Fix

AlxcBTW:fix/agc-compute-without-specials-v2 (d5655a45, on main d5c8e42). It now uses main's deferred preparation (52b77c2) instead of its own dispatch path. In PrepareRegistered, a compute header without specials calls defer("its header has no specials to give its wave size"), so the shader is prepared at its first dispatch with the wave size from the initiator's CS_W32_EN. The change is 4 lines plus a test. In full CI, Linux and macOS pass. The only Windows failure is agc_driver_prepared_shaders_deferred_undecodable, which currently fails on every main run (#2606). I can't open it as a PR while intake is limited, so it's here if a collaborator wants to cherry-pick it.

Tested

Windows 11, WinLibs GCC 15.2.0 r7.

AI-assisted: yes (Claude Code).

Activity

  1. LeandroLP23 commented on Oct 10, 2026

    @LeandroLP23
    Contributor

    Windows/AMD data point: this is ps5-opengl's (PPSA99005 v1.0.1) next stop on Windows once its missing imports are present. On main 89a1fb4 it stops at _umtx_op; with #1482 (_umtx_op), the #2106 rebase (pthread_sigmask) and #1872 (pthread_set_name_np) merged on top, it loads, opens video out ([ps5-agc] present-open handle=00000001 ... buffers=2) and stops with:

    terminate called after throwing an instance of 'std::runtime_error'
      what():  AGC driver: shader metadata is outside the registered header
    

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

    81a5a1a doesn't apply to current main any more: ShaderRegistry.cpp has been reworked since (background preparation in #2583, deferred undecodable shaders, the null pixel program prepared at use), and the conflict is in the same function the fix changes (PreparedAtDispatch against main's PreparedAtUse). I didn't rebase it, since it needs to be redone on the new code rather than merged.

  2. AlxcBTW commented on Oct 10, 2026

    @AlxcBTW
    ContributorAuthor

    @LeandroLP23 thanks for the AMD run. 81a5a1a was the first version. The fix linked in the issue is the redone one, d5655a45 (AlxcBTW/AnyPS5#10): it uses main's deferred preparation (defer("its header has no specials to give its wave size")) instead of its own dispatch path. Dean carries it in #2627. If you can run the showcase with #2627 on top, that would show whether it gets past registration on AMD too.

  3. LeandroLP23 commented on Oct 10, 2026

    @LeandroLP23
    Contributor

    @AlxcBTW thanks, I had picked up the first version. With #2627 (f752ef4f) it gets past registration on AMD too. ps5-opengl (PPSA99005 v1.0.1) on main c5d77d6 with #2627, #1482 (_umtx_op), the #2106 rebase (pthread_sigmask), #1872 (pthread_set_name_np) and your #2577/#2578 fixes on top (both merged since, as #2625 and #2626):

    • the compute headers without specials are deferred: Shader 0x21f3d9000 could not be prepared at registration (its header has no specials to give its wave size); preparing it when it is used
    • Mesa comes up: [ps5-gl46-showcase] ready GL=4.6 (Core Profile) Mesa 26.2.0 GLSL=4.60 size=3840x2160 particles=262144 instances=8192
    • it then stops at its first draw's shader, on a recompiler gap rather than anything in this fix: v_fma_mixlo/mixhi_f16 at pc 884 in FLOAT_MODE 204 (f16 denormals not kept or rounding not to nearest even) is not implemented

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions