fix(shader): preserve aliased embedded fetch attributes #2480

Closed
Scramblrrrr wants to merge 1 commit from upstream-pr/2480 into main
Scramblrrrr commented 2026-10-09 22:50:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-09T22:50:31Z.


What

An embedded vertex fetch can load a four-dword buffer descriptor into the same scalar registers that hold its attribute-table offset. The scanner clears each destination before reading the source offset's metadata. For s_load_dwordx4 s[0:3], s[20:21], s0, this loses the attribute id and load provenance, then registration fails with prepared vertex fetch has no matching semantic.

Snapshot the source attribute before writing any descriptor words. Every destination retains the same attribute id and the original attribute-table load followed by the descriptor load. No instruction semantics, fallback, resource limits or validation rules change.

Add a synthetic decoded shader regression for wave32 and wave64. It checks offsets held in each overlapping register s0-s3 and in non-overlapping s16, the attribute id, component count, fetch PC, and both prolog-load PCs. The baseline fails for the s0 overlap in both wave sizes; the fixed version passes.

The trigger was a diagnostic run of 007 First Light (PPSA11386), after 523 shader-cache writes. Its captured 944-word vertex program reproduces the error in agc_shader_replay --prepare; with this change it prepares and validates into 80,493 SPIR-V words. No title code, assets, executable, requests or private dumps are included. This does not establish title playability: no first frame has been verified, and the local diagnostic runtime still uses a Share Play debugger bypass.

Tested

Rebased onto upstream a29ef592190d0450eacbde15ec8e228e379ed753; branch head d5a396d92760c40bdbf0b8857e78d18b7e6a00b4. Windows 11, Ryzen 7 7800X3D, RTX 5070 Ti, Release MinGW GCC 15.2, SPIRV-Tools OFF.

The relevant checks (agc_embedded_vertex_fetch_aliasing) pass in a combined validation checkout containing the independently rebased reciprocal, shared-loop-exit, vertex-fetch-aliasing, table-store, SRT-depth, constant-phi and deferred-specialization topics. All 10 selected CTest cases passed in 2.31 seconds, with Vulkan required for the table-store execution regression. Each public branch contains its own topic only; these are combined-checkout results, not seven separate full builds. Conventions and diff checks pass for each branch.

No fresh game run, visible frame or playable gameplay is claimed for these rebased heads. Earlier reduced-regression and local-title observations motivated the original change; title code and captures remain local. Linux and macOS were not rerun locally for this rebase.

Checklist

  • Based on upstream main a29ef592; one topic per branch
  • No new comments in code
  • Unimplemented paths retain explicit errors
  • No investigation files, title data or images in the repository
  • No new third-party code
  • Generic behavior
  • Depends on: none for this correction
  • AI-assisted: yes, prepared with Codex; author is responsible for review

GitHub refuses reopening this existing PR with state cannot be changed. The branch was force-pushed or recreated. The public topic branch above contains the rebased/tested head; this closed PR retains its historical head. No replacement upstream PR was opened because current intake still applies automatically to newly opened PRs.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4806698042 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2480). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-09T22:50:31Z. --- ### What An embedded vertex fetch can load a four-dword buffer descriptor into the same scalar registers that hold its attribute-table offset. The scanner clears each destination before reading the source offset's metadata. For `s_load_dwordx4 s[0:3], s[20:21], s0`, this loses the attribute id and load provenance, then registration fails with `prepared vertex fetch has no matching semantic`. Snapshot the source attribute before writing any descriptor words. Every destination retains the same attribute id and the original attribute-table load followed by the descriptor load. No instruction semantics, fallback, resource limits or validation rules change. Add a synthetic decoded shader regression for wave32 and wave64. It checks offsets held in each overlapping register s0-s3 and in non-overlapping s16, the attribute id, component count, fetch PC, and both prolog-load PCs. The baseline fails for the s0 overlap in both wave sizes; the fixed version passes. The trigger was a diagnostic run of 007 First Light (PPSA11386), after 523 shader-cache writes. Its captured 944-word vertex program reproduces the error in `agc_shader_replay --prepare`; with this change it prepares and validates into 80,493 SPIR-V words. No title code, assets, executable, requests or private dumps are included. This does not establish title playability: no first frame has been verified, and the local diagnostic runtime still uses a Share Play debugger bypass. ### Tested Rebased onto upstream `a29ef592190d0450eacbde15ec8e228e379ed753`; branch head `d5a396d92760c40bdbf0b8857e78d18b7e6a00b4`. Windows 11, Ryzen 7 7800X3D, RTX 5070 Ti, Release MinGW GCC 15.2, SPIRV-Tools OFF. The relevant checks (agc_embedded_vertex_fetch_aliasing) pass in a combined validation checkout containing the independently rebased reciprocal, shared-loop-exit, vertex-fetch-aliasing, table-store, SRT-depth, constant-phi and deferred-specialization topics. All 10 selected CTest cases passed in 2.31 seconds, with Vulkan required for the table-store execution regression. Each public branch contains its own topic only; these are combined-checkout results, not seven separate full builds. Conventions and diff checks pass for each branch. No fresh game run, visible frame or playable gameplay is claimed for these rebased heads. Earlier reduced-regression and local-title observations motivated the original change; title code and captures remain local. Linux and macOS were not rerun locally for this rebase. ### Checklist - [x] Based on upstream main `a29ef592`; one topic per branch - [x] No new comments in code - [x] Unimplemented paths retain explicit errors - [x] No investigation files, title data or images in the repository - [x] No new third-party code - [x] Generic behavior - [x] Depends on: none for this correction - [x] AI-assisted: yes, prepared with Codex; author is responsible for review GitHub refuses reopening this existing PR with `state cannot be changed. The branch was force-pushed or recreated`. The public topic branch above contains the rebased/tested head; this closed PR retains its historical head. No replacement upstream PR was opened because current intake still applies automatically to newly opened PRs.
github-actions[bot] commented 2026-10-09 23:01:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T23:01:49Z.


Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
#2371 core/libs/prx/libSceAgcDriver/CMakeLists.txt L1024
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6090729257 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2480#issuecomment-6090729257). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T23:01:49Z. --- <!-- pr-overlap --> Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in **Depends on**. | Pull request | Conflicting files (lines on `main`) | Same exports | Same new files | |---|---|---|---| | #2371 | `core/libs/prx/libSceAgcDriver/CMakeLists.txt` [L1024](https://github.com/boykopovar/AnyPS5/blob/dc4b7104e5012cb587b51e5c3c73a1dccd89bbf4/core/libs/prx/libSceAgcDriver/CMakeLists.txt#L1024) | | |
github-actions[bot] commented 2026-10-09 23:07:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-09T23:07:16Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6090785234 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2480#issuecomment-6090785234). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-09T23:07:16Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.
Scramblrrrr commented 2026-10-11 13:51:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-11T13:51:09Z.


Confirmed this correction is already upstream through #3258, merge 1ae5b2fe5a, preserving my original commit/authorship. Thank you @oneandonlydean for carrying it. Rebasing d5a396d9 onto current main a11c8f7f leaves no topic changes. Fresh Windows Release build of main and agc_embedded_vertex_fetch_aliasing: PASS. The historical fork branch is preserved; this closed PR is superseded by the merged carry, not an outstanding fix. AI-assisted (Codex).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6109724404 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2480#issuecomment-6109724404). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-11T13:51:09Z. --- Confirmed this correction is already upstream through **#3258**, merge **1ae5b2fe5a2bce8bfd55ece4f3ef2082e952d96e**, preserving my original commit/authorship. Thank you @oneandonlydean for carrying it. Rebasing d5a396d9 onto current main a11c8f7f leaves no topic changes. Fresh Windows Release build of main and `agc_embedded_vertex_fetch_aliasing`: PASS. The historical fork branch is preserved; this closed PR is superseded by the merged carry, not an outstanding fix. AI-assisted (Codex).

Pull request closed

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!2480
No description provided.