fix(shader): reuse bound specialization fields for null buffer slots #13774

Merged
Celegans12 merged 1 commit from upstream-pr/13774 into main 2026-11-01 01:00:51 +00:00
Celegans12 commented 2026-10-31 05:34:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Celegans12 on 2026-10-31T05:34:42Z.


What

After #9957 moved buffer presence to run time, null V#s still select different shader modules from their unused stride, format and alignment words. This is the buffer-substitutes piece next in the order agreed in #675, after #8160/#8161.

Each program learns a slot's fields after its first valid bound plan. Null slots use those fields; never-bound slots use zeros. Bound slots retain their own fields and the actual descriptors still control presence. Full/masked result memos and plan creation share one immutable substitute snapshot, so null -> bound -> the identical null cannot retain a pre-learning module. Tables stay process-local; APS5_NO_BUFFER_SUBSTITUTES=1 restores main's selection.

Related: #6412 adds descriptor-status validation and key fields; retain them when composing. #6924 changes persistent plan identity; it must key the effective fields too. #7642/#9508/#10193 change the same ordinary/heap keys. #12662/#12980 extend the Prepare signature. #10757 changes memo-result recycling. These are composition points, not prerequisites.

Tested

  • Windows 11, MinGW-w64 GCC 15.2.0, Release, -DBUILD_TESTING=ON, based on main 18f5949788.
  • 20/20 focused tests pass on NVIDIA (--repeat until-fail:3).
  • Same build on Windows lavapipe: 20/20 pass.
  • agc_driver_null_buffer_substitutes and the added agc_shader_disk_cache check fail on main. Direct/captured/prepared calls, null loads/stores, changed formats, masked-memo verification and GPL on/off pass.
  • Validation loaded on candidate and main's 19 neighboring tests: no VUIDs/skips on either Windows driver.
  • Merge with main 8dc9f366ce: 20/20 on both Windows drivers.
  • Linux GCC 13.3/lavapipe: 18/18 repeated three times; main 17/17.
  • Not tested: Linux validation layer, new title run, AMD, Intel. No FPS claim.

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: PPSA26344 #675
  • GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, 610.62, Windows 11; Mesa 26.2.4 llvmpipe, Windows 11; Mesa 25.2.8 llvmpipe, WSL Ubuntu 24.04
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5094911302 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/13774). Originally posted by [Celegans12](https://github.com/Celegans12) on 2026-10-31T05:34:42Z. --- ### What After #9957 moved buffer presence to run time, null V#s still select different shader modules from their unused stride, format and alignment words. This is the buffer-substitutes piece next in the order agreed in #675, after #8160/#8161. Each program learns a slot's fields after its first valid bound plan. Null slots use those fields; never-bound slots use zeros. Bound slots retain their own fields and the actual descriptors still control presence. Full/masked result memos and plan creation share one immutable substitute snapshot, so null -> bound -> the identical null cannot retain a pre-learning module. Tables stay process-local; `APS5_NO_BUFFER_SUBSTITUTES=1` restores main's selection. Related: #6412 adds descriptor-status validation and key fields; retain them when composing. #6924 changes persistent plan identity; it must key the effective fields too. #7642/#9508/#10193 change the same ordinary/heap keys. #12662/#12980 extend the Prepare signature. #10757 changes memo-result recycling. These are composition points, not prerequisites. ### Tested - Windows 11, MinGW-w64 GCC 15.2.0, Release, `-DBUILD_TESTING=ON`, based on `main` 18f5949788. - 20/20 focused tests pass on NVIDIA (`--repeat until-fail:3`). - Same build on Windows lavapipe: 20/20 pass. - `agc_driver_null_buffer_substitutes` and the added `agc_shader_disk_cache` check fail on main. Direct/captured/prepared calls, null loads/stores, changed formats, masked-memo verification and GPL on/off pass. - Validation loaded on candidate and main's 19 neighboring tests: no VUIDs/skips on either Windows driver. - Merge with `main` 8dc9f366ce: 20/20 on both Windows drivers. - Linux GCC 13.3/lavapipe: 18/18 repeated three times; main 17/17. - Not tested: Linux validation layer, new title run, AMD, Intel. No FPS claim. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: PPSA26344 #675 - [x] GPUs tested: NVIDIA GeForce RTX 3080 Laptop GPU, 610.62, Windows 11; Mesa 26.2.4 llvmpipe, Windows 11; Mesa 25.2.8 llvmpipe, WSL Ubuntu 24.04 - [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!13774
No description provided.