fix(shader): preserve pixel export mappings in replay #869

Merged
ahir061 merged 1 commit from upstream-pr/869 into main 2026-10-07 08:16:54 +00:00
ahir061 commented 2026-10-06 11:27:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ahir061 on 2026-10-06T11:27:21Z.


What

Preserve ShaderPixelStageInfo::targetExportMapping when serializing and replaying shader recompile requests.

targetExportMapping already affects pixel export generation and shader cache identity, but request serialization previously omitted it. As a result, replayed pixel shaders received zeroed export mappings instead of the mappings captured from the original request.

This change:

  • bumps the request serialization format from version 7 to version 8
  • serializes all eight targetExportMapping bytes
  • restores those bytes when reading version 8 requests
  • preserves the existing zero-mapping behavior for legacy version 1–7 captures, where the original mapping cannot be recovered
  • adds regression coverage for round-trip preservation, legacy compatibility, request alignment, truncation handling, shader identity, cache reuse, and non-identity MRT export mappings

Tested

  • Native regression harness on macOS ARM64: 11 test groups passed
  • Verified the new regression fails against the original serializer
  • Verified disabling pixel export mapping causes the replay regression to fail
  • Syntax checks passed
  • git diff --check passed
  • Full supported CMake/CTest build was not run on this ARM macOS host
  • GPU execution and SPIRV-Tools-enabled execution were not run

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); no silent stubs were added
  • No notes, investigation .md files or images added to the repository
  • No new third-party code
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4758033380 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/869). Originally posted by [ahir061](https://github.com/ahir061) on 2026-10-06T11:27:21Z. --- ### What Preserve `ShaderPixelStageInfo::targetExportMapping` when serializing and replaying shader recompile requests. `targetExportMapping` already affects pixel export generation and shader cache identity, but request serialization previously omitted it. As a result, replayed pixel shaders received zeroed export mappings instead of the mappings captured from the original request. This change: - bumps the request serialization format from version 7 to version 8 - serializes all eight `targetExportMapping` bytes - restores those bytes when reading version 8 requests - preserves the existing zero-mapping behavior for legacy version 1–7 captures, where the original mapping cannot be recovered - adds regression coverage for round-trip preservation, legacy compatibility, request alignment, truncation handling, shader identity, cache reuse, and non-identity MRT export mappings ### Tested - Native regression harness on macOS ARM64: 11 test groups passed - Verified the new regression fails against the original serializer - Verified disabling pixel export mapping causes the replay regression to fail - Syntax checks passed - `git diff --check` passed - Full supported CMake/CTest build was not run on this ARM macOS host - GPU execution and SPIRV-Tools-enabled execution were not run ### 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 (`NotImplemented_nid_no_patch`); no silent stubs were added - [x] No notes, investigation `.md` files or images added to the repository - [x] No new third-party code - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-06 20:13:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-06T20:13:20Z.


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
#448 core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp L310, L343, L690, L714
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6024598500 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/869#issuecomment-6024598500). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-06T20:13:20Z. --- <!-- 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 | |---|---|---|---| | #448 | `core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp` [L310](https://github.com/boykopovar/AnyPS5/blob/cffaab57eef97f417457a95b18092e80b6c790f5/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L310), [L343](https://github.com/boykopovar/AnyPS5/blob/cffaab57eef97f417457a95b18092e80b6c790f5/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L343), [L690](https://github.com/boykopovar/AnyPS5/blob/cffaab57eef97f417457a95b18092e80b6c790f5/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L690), [L714](https://github.com/boykopovar/AnyPS5/blob/cffaab57eef97f417457a95b18092e80b6c790f5/core/shader/recompiler/ControlFlow/src/RequestSerializer.cpp#L714) | | |
adriadam10 commented 2026-10-07 08:16:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-07T08:16:50Z.


Checked the round trip, the v1-v7 fixtures and the truncation cases; full ctest is green on RADV merged onto current main, and agc_shader_memory fails with the serializer change reverted. Merging once CI is green.

Heads-up for #448: it also bumps the request version (8 for the vertex paClVsOutCntl, 9 for quadPixelMask), so it will need renumbering after this lands.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6033889752 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/869#issuecomment-6033889752). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-07T08:16:50Z. --- Checked the round trip, the v1-v7 fixtures and the truncation cases; full ctest is green on RADV merged onto current main, and `agc_shader_memory` fails with the serializer change reverted. Merging once CI is green. Heads-up for #448: it also bumps the request version (8 for the vertex `paClVsOutCntl`, 9 for `quadPixelMask`), so it will need renumbering after this lands.
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!869
No description provided.