fix(agc): name the fields a replaced shader header changes #2700

Closed
Dextroid17 wants to merge 2 commits from upstream-pr/2700 into main
Dextroid17 commented 2026-10-10 11:25:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-10T11:25:03Z.


What

A graphics, static or rectangle ABI resolution refuses a shader header whose bytes differ from the registered snapshot, but the refusal does not say how it differs — so a title that replaces a header cannot be diagnosed from its log without a rebuild. This names the fields that changed.

The comparison itself is unchanged: SameHeader still ignores user_data and still compares the same byte range, and the new helper walks a field table over exactly that range — a byte outside a named field is never reported as changed.

before:  graphics ABI refers to a replaced shader header
after:   graphics ABI refers to a replaced shader header (changed: target)

A title hits this. PPSA26344 (Ghost of Yōtei, 01.008), Linux x86-64, lavapipe, after about 1,300 shader compilations on a cold cache, a presentation window and a swapchain:

[libc] unhandled exception 'St13runtime_error'
terminate called after throwing an instance of 'std::runtime_error'
  what():  AGC driver: graphics ABI refers to a replaced shader header (changed: cx_registers, sh_registers, specials, input_semantics, output_semantics)

Every changed field is a pointer, and code, file_header, version, header_size, shader_size and target all match — so the title presents a header at the same shader code address whose register and semantic sub-arrays live elsewhere. Whether those arrays hold equivalent content, and whether a replaced header should be accepted rather than refused, is not something this change decides; it only makes the refusal diagnosable, which the log could not.

Reaching that line takes one other change: with this change alone the title stops earlier, at unsupported scalar source operand code 235 at program counter 856 (issue #1920, which #1940 addresses), so it never reaches this ABI path. The TechnicalDebt.md entry added here records the refusal and that PPSA26344 stops there; this body carries the extra fact that the aperture-source change is needed to get that far, so the next person does not hit the earlier wall and conclude this one was unreachable.

Tested

Linux x86-64, Release build, lavapipe (llvmpipe) as the Vulkan device.

  • ctest -R prepared_shaders → 7/7 pass, including agc_driver_prepared_shaders.py-driven modes; the target case in PreparedShaders.cpp now asserts replaced shader header (changed: target).
  • tools/check_conventions.py → all checks passed. tools/check_test_registration.py → 557 executables, 0 built and not run as recorded, none new.
  • PPSA26344 run on lavapipe gives the (changed: …) line quoted above — that line is from the title, not from a unit test.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4810843150 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2700). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-10T11:25:03Z. --- ### What A graphics, static or rectangle ABI resolution refuses a shader header whose bytes differ from the registered snapshot, but the refusal does not say *how* it differs — so a title that replaces a header cannot be diagnosed from its log without a rebuild. This names the fields that changed. The comparison itself is unchanged: `SameHeader` still ignores `user_data` and still compares the same byte range, and the new helper walks a field table over exactly that range — a byte outside a named field is never reported as changed. ``` before: graphics ABI refers to a replaced shader header after: graphics ABI refers to a replaced shader header (changed: target) ``` A title hits this. **PPSA26344 (Ghost of Yōtei, 01.008)**, Linux x86-64, lavapipe, after about 1,300 shader compilations on a cold cache, a presentation window and a swapchain: ``` [libc] unhandled exception 'St13runtime_error' terminate called after throwing an instance of 'std::runtime_error' what(): AGC driver: graphics ABI refers to a replaced shader header (changed: cx_registers, sh_registers, specials, input_semantics, output_semantics) ``` Every changed field is a pointer, and `code`, `file_header`, `version`, `header_size`, `shader_size` and `target` all match — so the title presents a header at the same shader `code` address whose register and semantic sub-arrays live elsewhere. Whether those arrays hold equivalent content, and whether a replaced header should be accepted rather than refused, is not something this change decides; it only makes the refusal diagnosable, which the log could not. Reaching that line takes one other change: with this change alone the title stops earlier, at `unsupported scalar source operand code 235 at program counter 856` (issue #1920, which #1940 addresses), so it never reaches this ABI path. The `TechnicalDebt.md` entry added here records the refusal and that PPSA26344 stops there; this body carries the extra fact that the aperture-source change is needed to get that far, so the next person does not hit the earlier wall and conclude this one was unreachable. ### Tested Linux x86-64, Release build, lavapipe (llvmpipe) as the Vulkan device. - `ctest -R prepared_shaders` → 7/7 pass, including `agc_driver_prepared_shaders.py`-driven modes; the `target` case in `PreparedShaders.cpp` now asserts `replaced shader header (changed: target)`. - `tools/check_conventions.py` → all checks passed. `tools/check_test_registration.py` → 557 executables, 0 built and not run as recorded, none new. - PPSA26344 run on lavapipe gives the `(changed: …)` line quoted above — that line is from the title, not from a unit test. ### 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 in TechnicalDebt - [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] AI-assisted: yes
github-actions[bot] commented 2026-10-10 11:25:13 +00:00 (Migrated from github.com)

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


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:6096996487 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2700#issuecomment-6096996487). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T11:25:13Z. --- 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.

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