fix(libSceAgc): refuse a null scratch on the hull fusion path and halves without special registers #16334

Merged
MarcZX10 merged 5 commits from upstream-pr/16334 into main 2026-11-09 10:09:03 +00:00
MarcZX10 commented 2026-11-06 10:01:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-06T10:01:17Z.


What

sceAgcFuseShaderHalves_0200 handled two inputs badly:

  • A hull half fused with a null scratch pointer copied the back header, so the fused registers still pointed at the back half's own register table and the checksum, resource and program address writes landed in the caller's const input. The geometry path already refused a null scratch; the hull path now does the same before anything is written.
  • A front or back half whose specials pointer was null crashed the host when vgt_shader_stages_en was read. Such a pair is now refused with the shader-half error. Every pair that reached that read before is unaffected.

Commits: one fix and one test per defect (eb04486b7a/c0a8599314 for the hull null scratch, 8cb5ea163d/97491f4834 for the null specials) and a docs(debt) commit recording that both refusals are this library's own choice, not measured on the console.

No open PR touches ShaderFusion.cpp (checked #16194, #16200, #8314 and #13940).

Tested

Linux, throwaway archive build of this head: BUILD-EXIT 0, ctest agc_shader_fusion (target agc_shader_fusion_tests) passed, 1 of 1. python3 tools/check_conventions.py --base upstream/main and git diff --check are clean. The new cases were not run against the unfixed code; that they fail without the fixes is reasoned from the code. Not run on Windows or macOS.

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 under Silent stubs in their library's technical debt file
  • 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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5186131376 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/16334). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-06T10:01:17Z. --- ### What `sceAgcFuseShaderHalves_0200` handled two inputs badly: - A hull half fused with a null scratch pointer copied the back header, so the fused registers still pointed at the back half's own register table and the checksum, resource and program address writes landed in the caller's const input. The geometry path already refused a null scratch; the hull path now does the same before anything is written. - A front or back half whose specials pointer was null crashed the host when `vgt_shader_stages_en` was read. Such a pair is now refused with the shader-half error. Every pair that reached that read before is unaffected. Commits: one `fix` and one `test` per defect (`eb04486b7a`/`c0a8599314` for the hull null scratch, `8cb5ea163d`/`97491f4834` for the null specials) and a `docs(debt)` commit recording that both refusals are this library's own choice, not measured on the console. No open PR touches `ShaderFusion.cpp` (checked #16194, #16200, #8314 and #13940). ### Tested Linux, throwaway archive build of this head: `BUILD-EXIT 0`, ctest `agc_shader_fusion` (target `agc_shader_fusion_tests`) passed, 1 of 1. `python3 tools/check_conventions.py --base upstream/main` and `git diff --check` are clean. The new cases were not run against the unfixed code; that they fail without the fixes is reasoned from the code. Not run on Windows or macOS. ### 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 under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [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] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
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!16334
No description provided.