fix(shader): accept TYPE=0 images during materialization #5473

Merged
MarcZX10 merged 7 commits from upstream-pr/5473 into main 2026-10-15 11:37:53 +00:00
MarcZX10 commented 2026-10-13 20:40:20 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T20:40:20Z.


What

Treats AMD image descriptors with TYPE=0 as null for read-only static image slots, even when the descriptor base and other words are nonzero. It leaves table entries, writable image slots, and atomic image slots refused because the available hardware evidence does not establish null behavior for those cases. The runtime binding behavior is in #4779, so this follow-up depends on that PR. The case was reported for PPSA01341 (Demon's Souls); its captured TYPE=0 descriptors caused the recompiler to reject the shader request before runtime binding.

Malformed-image fixtures use reserved TYPE=1, while the dedicated nonzero-payload TYPE=0 read-only regression remains. Table snapshots track which descriptor dwords were captured and poison an image record only when the required TYPE dword is missing. Partial captures that include TYPE continue through normal materialization.

Tested

  • Linux x86-64, GCC 12.2, Ninja Release: built agc_shader_memory_tests and agc_driver_image_table_tests.
  • agc_shader_memory_tests passed end to end, including the straddling-record regression and deterministic replay.
  • agc_shader_memory_tests --bindless passed, including the TYPE=0 table-entry refusal regression.
  • agc_shader_memory_tests --type-zero-image-materialization passed, including rejection of writable and atomic TYPE=0 descriptors.
  • agc_driver_image_table_tests built but cannot run on this host: the emulator's CPU guard requires LZCNT, BMI1, BMI2, MOVBE, AVX2, and FMA, which its Xeon E5-1620 v2 does not provide.
  • tools/check_conventions.py --base upstream/main and git diff --check pass.
  • No title run was performed on this follow-up.

Checklist

  • Based on current main; no other open PR implements this recompiler behavior
  • One topic per PR
  • No comments in code except technical debt
  • Unimplemented paths throw; no new unimplemented path
  • No investigation files added to the repository
  • Generic behavior, not title-specific
  • Depends on: #4779
  • Unblocks: PPSA01341 after #4779
  • GPUs tested: none in this follow-up
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4849197459 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T20:40:20Z. --- ### What Treats AMD image descriptors with `TYPE=0` as null for read-only static image slots, even when the descriptor base and other words are nonzero. It leaves table entries, writable image slots, and atomic image slots refused because the available hardware evidence does not establish null behavior for those cases. The runtime binding behavior is in [#4779](https://github.com/boykopovar/AnyPS5/pull/4779), so this follow-up depends on that PR. The case was reported for PPSA01341 (Demon's Souls); its captured `TYPE=0` descriptors caused the recompiler to reject the shader request before runtime binding. Malformed-image fixtures use reserved `TYPE=1`, while the dedicated nonzero-payload `TYPE=0` read-only regression remains. Table snapshots track which descriptor dwords were captured and poison an image record only when the required `TYPE` dword is missing. Partial captures that include `TYPE` continue through normal materialization. ### Tested - Linux x86-64, GCC 12.2, Ninja Release: built `agc_shader_memory_tests` and `agc_driver_image_table_tests`. - `agc_shader_memory_tests` passed end to end, including the straddling-record regression and deterministic replay. - `agc_shader_memory_tests --bindless` passed, including the TYPE=0 table-entry refusal regression. - `agc_shader_memory_tests --type-zero-image-materialization` passed, including rejection of writable and atomic TYPE=0 descriptors. - `agc_driver_image_table_tests` built but cannot run on this host: the emulator's CPU guard requires LZCNT, BMI1, BMI2, MOVBE, AVX2, and FMA, which its Xeon E5-1620 v2 does not provide. - `tools/check_conventions.py --base upstream/main` and `git diff --check` pass. - No title run was performed on this follow-up. ### Checklist - [x] Based on current `main`; no other open PR implements this recompiler behavior - [x] One topic per PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw; no new unimplemented path - [x] No investigation files added to the repository - [x] Generic behavior, not title-specific - [x] Depends on: #4779 - [x] Unblocks: PPSA01341 after #4779 - [x] GPUs tested: none in this follow-up - [x] AI-assisted: yes
xXPBSXx commented 2026-10-13 23:19:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T23:19:17Z.


Windows test of this PR (stacked on #4779). Windows 10 (19045), MinGW-w64 GCC 15.2, Release, ninja -j 4, ctest -R ^<name>$ called directly, 3 runs each. Tree: main 30f961266 + merge of #4779 (7e1e1ce05) + merge of #5473 (52992026a) = local merge commit 1f3be6bba.

  • agc_shader_type_zero_image_materialization: exit 0, 3 of 3.
  • agc_driver_graphics: exit 0, 3 of 3.
  • agc_shader_bindless: exit 8, 0 of 3, bindless: an invalid T# was accepted.
  • agc_shader_memory: exit 8, 0 of 3, guarded sources: an invalid T# behind a taken branch was accepted.

Baseline on the same machine and in the same build directory, same commands: main + #4779 only (5bd44d17b) and plain main (7a0c838ca, it had moved after 30f961266) pass agc_shader_bindless and agc_shader_memory in 3 of 3 runs each. So on this Windows build the two existing tests pass before this PR and fail with it. The PR description mentions that the full agc_shader_memory test failed earlier on the same assertion (on its Linux build); on Windows it does not fail without this PR.

Not tested: Linux, a title run, AMD, other ctest targets. These tests select no GPU (GPUs on the machine: NVIDIA GeForce RTX 4080 SUPER, AMD Radeon RX 6400).

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157257233 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6157257233). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T23:19:17Z. --- Windows test of this PR (stacked on #4779). Windows 10 (19045), MinGW-w64 GCC 15.2, Release, `ninja -j 4`, `ctest -R ^<name>$` called directly, 3 runs each. Tree: `main` `30f961266` + merge of #4779 (`7e1e1ce05`) + merge of #5473 (`52992026a`) = local merge commit `1f3be6bba`. - `agc_shader_type_zero_image_materialization`: exit 0, 3 of 3. - `agc_driver_graphics`: exit 0, 3 of 3. - `agc_shader_bindless`: exit 8, 0 of 3, `bindless: an invalid T# was accepted`. - `agc_shader_memory`: exit 8, 0 of 3, `guarded sources: an invalid T# behind a taken branch was accepted`. Baseline on the same machine and in the same build directory, same commands: `main` + #4779 only (`5bd44d17b`) and plain `main` (`7a0c838ca`, it had moved after `30f961266`) pass `agc_shader_bindless` and `agc_shader_memory` in 3 of 3 runs each. So on this Windows build the two existing tests pass before this PR and fail with it. The PR description mentions that the full `agc_shader_memory` test failed earlier on the same assertion (on its Linux build); on Windows it does not fail without this PR. Not tested: Linux, a title run, AMD, other ctest targets. These tests select no GPU (GPUs on the machine: NVIDIA GeForce RTX 4080 SUPER, AMD Radeon RX 6400). AI-assisted (Claude Code).
MarcZX10 commented 2026-10-13 23:40:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T23:40:29Z.


Thanks for the Windows comparison; it exposed that the two malformed-descriptor fixtures still used TYPE=0, which this change now deliberately treats as null. I updated both the guarded-source and bindless invalid-descriptor cases to use reserved TYPE=1; the dedicated nonzero-payload TYPE=0 materialization test remains in place.

On Linux with GCC 12.2 / Ninja Release, agc_shader_bindless, agc_shader_memory, and agc_shader_type_zero_image_materialization all pass (3/3), and tools/check_conventions.py --base upstream/main passes. The fix is pushed as 9add44799; could you rerun the two affected checks on Windows against this head when convenient?

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157522837 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6157522837). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T23:40:29Z. --- Thanks for the Windows comparison; it exposed that the two malformed-descriptor fixtures still used `TYPE=0`, which this change now deliberately treats as null. I updated both the guarded-source and bindless invalid-descriptor cases to use reserved `TYPE=1`; the dedicated nonzero-payload `TYPE=0` materialization test remains in place. On Linux with GCC 12.2 / Ninja Release, `agc_shader_bindless`, `agc_shader_memory`, and `agc_shader_type_zero_image_materialization` all pass (3/3), and `tools/check_conventions.py --base upstream/main` passes. The fix is pushed as `9add44799`; could you rerun the two affected checks on Windows against this head when convenient? AI-assisted: yes.
xXPBSXx commented 2026-10-14 02:28:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T02:28:48Z.


Update to my Windows test above: the head of this PR has changed since (now 9add447991162ccb5c558530b888a8b799d5a747; my first run was on 52992026a). Re-run on main 016db923afd3bfc210654ce59073a19f27c879be + #4779 (7e1e1ce05) + this head, one run each with ctest -V, Windows 10 (19045), MinGW-w64 GCC 15.2, Release: agc_shader_bindless, agc_shader_memory, agc_shader_type_zero_image_materialization and agc_driver_graphics all pass (exit code 0). The two failures I reported (agc_shader_bindless, agc_shader_memory) belong to the earlier head and no longer occur. The ctest -V output of these runs contains no Vulkan device or Selected GPU line.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159539495 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6159539495). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-14T02:28:48Z. --- Update to my Windows test above: the head of this PR has changed since (now `9add447991162ccb5c558530b888a8b799d5a747`; my first run was on `52992026a`). Re-run on `main` `016db923afd3bfc210654ce59073a19f27c879be` + #4779 (`7e1e1ce05`) + this head, one run each with `ctest -V`, Windows 10 (19045), MinGW-w64 GCC 15.2, Release: `agc_shader_bindless`, `agc_shader_memory`, `agc_shader_type_zero_image_materialization` and `agc_driver_graphics` all pass (exit code 0). The two failures I reported (`agc_shader_bindless`, `agc_shader_memory`) belong to the earlier head and no longer occur. The `ctest -V` output of these runs contains no Vulkan device or `Selected GPU` line. AI-assisted (Claude Code).
xXPBSXx commented 2026-10-14 07:02:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-14T07:02:43Z.


Title evidence for this pull request (and #4779), PPSA01746 (Kena: Bridge of Spirits), Windows 10 (19045), RTX 4080 SUPER, one run each, no picture checked.

On main 52283005901 the title stops at the storage-image write-back throw, so this stop cannot be reached there. To see what comes after it I removed the two Require(!unsavedOutsideWatch ...) checks in Texture.cpp locally. That local change is a diagnostic experiment only, it is not proposed anywhere.

  • Without this pull request and #4779 (same local tree): the run ends with presentation failed: runtime image descriptor is invalid / what(): runtime image descriptor is invalid (ResourceMaterializer.cpp:496), PPSA01746_rT/run_083039.err lines 124-126.
  • With #4779 (7e1e1ce05) and this head (9add44799) merged into that tree (merge tree 2352738758d): no what(), no FATAL, no presentation failed in PPSA01746_rT/run_085421.err (129 lines, last line a [shader-disk-cache] statistic); the run was started with a 300 s limit and was over at 09:00:36 local time (started 08:54:16).

Not known: whether the descriptor of this title really has TYPE=0 (the dwords were not logged), so the link to this change is indirect.

Test conditions: libraries ninja -j 8 libs exit 0 (08:50:49 to 08:53:50 local time, 128 .prx, libSceAgcDriver.prx 08:53:36, libkernel.prx 08:53:48); app.exe of 2026-10-14 07:29:50 from another session's relink of this title (relinker commit and relink command not recorded by me), directory reused for both runs.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6162833991 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6162833991). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-14T07:02:43Z. --- Title evidence for this pull request (and #4779), PPSA01746 (Kena: Bridge of Spirits), Windows 10 (19045), RTX 4080 SUPER, one run each, no picture checked. On `main` `52283005901` the title stops at the storage-image write-back throw, so this stop cannot be reached there. To see what comes after it I removed the two `Require(!unsavedOutsideWatch ...)` checks in `Texture.cpp` locally. That local change is a diagnostic experiment only, it is not proposed anywhere. - Without this pull request and #4779 (same local tree): the run ends with `presentation failed: runtime image descriptor is invalid` / `what(): runtime image descriptor is invalid` (`ResourceMaterializer.cpp:496`), `PPSA01746_rT/run_083039.err` lines 124-126. - With #4779 (`7e1e1ce05`) and this head (`9add44799`) merged into that tree (merge tree `2352738758d`): no `what()`, no `FATAL`, no `presentation failed` in `PPSA01746_rT/run_085421.err` (129 lines, last line a `[shader-disk-cache]` statistic); the run was started with a 300 s limit and was over at 09:00:36 local time (started 08:54:16). Not known: whether the descriptor of this title really has TYPE=0 (the dwords were not logged), so the link to this change is indirect. Test conditions: libraries `ninja -j 8 libs` exit 0 (08:50:49 to 08:53:50 local time, 128 `.prx`, `libSceAgcDriver.prx` 08:53:36, `libkernel.prx` 08:53:48); `app.exe` of 2026-10-14 07:29:50 from another session's relink of this title (relinker commit and relink command not recorded by me), directory reused for both runs. AI-assisted (Claude Code).
MarcZX10 commented 2026-10-14 14:40:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T14:40:59Z.


Rebased onto current main (f3434892b), preserving the new layout-pair CMake entries while keeping the dedicated test in the Windows test environment. On Linux/GCC 12.2, agc_shader_memory_tests rebuilt and agc_shader_type_zero_image_materialization passed 1/1; tools/check_conventions.py --base upstream/main and git diff --check pass. I have not rerun the full shader-memory suite or a title on this rebased head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6170971546 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6170971546). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T14:40:59Z. --- Rebased onto current `main` (`f3434892b`), preserving the new layout-pair CMake entries while keeping the dedicated test in the Windows test environment. On Linux/GCC 12.2, `agc_shader_memory_tests` rebuilt and `agc_shader_type_zero_image_materialization` passed 1/1; `tools/check_conventions.py --base upstream/main` and `git diff --check` pass. I have not rerun the full shader-memory suite or a title on this rebased head.
MarcZX10 commented 2026-10-14 19:56:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T19:56:25Z.


Rebased the follow-up onto current main (411e5e6d9) after #4779 merged, resolving the test-file conflict while preserving the current image-table coverage and the TYPE=0/reserved-type regressions. The full Linux agc_shader_memory CTest passes (1/1), agc_shader_memory_tests rebuilt, and local plus hosted conventions pass. The dedicated TYPE=0 CTest is not registered in the reused build tree, so I verified it as part of the full shader-memory test instead. Current hosted Build checks are still running; eligibility and the progress report passed. Commit 825a26751 is authored as MarcZX100.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6177093375 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6177093375). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T19:56:25Z. --- Rebased the follow-up onto current `main` (`411e5e6d9`) after #4779 merged, resolving the test-file conflict while preserving the current image-table coverage and the TYPE=0/reserved-type regressions. The full Linux `agc_shader_memory` CTest passes (1/1), `agc_shader_memory_tests` rebuilt, and local plus hosted conventions pass. The dedicated TYPE=0 CTest is not registered in the reused build tree, so I verified it as part of the full shader-memory test instead. Current hosted Build checks are still running; eligibility and the progress report passed. Commit `825a26751` is authored as MarcZX100.
MarcZX10 commented 2026-10-14 19:59:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T19:59:52Z.


CI has finished on rebased head 825a26751: the Windows relinker CTest passed, as did the selected Linux/macOS relinker, register-context, and write-watch jobs, eligibility, conventions, and report. The separate full Linux and Windows build jobs were skipped by the workflow path policy. GitHub now reports the PR CLEAN.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6177157542 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6177157542). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T19:59:52Z. --- CI has finished on rebased head `825a26751`: the Windows relinker CTest passed, as did the selected Linux/macOS relinker, register-context, and write-watch jobs, eligibility, conventions, and report. The separate full Linux and Windows build jobs were skipped by the workflow path policy. GitHub now reports the PR CLEAN.
adriadam10 commented 2026-10-14 20:09:46 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T20:09:46Z.

Review: CHANGES_REQUESTED


Thanks for the rebase. Checked on this PR merged onto current main: agc_shader_type_zero_image_materialization passes, but three existing tests now fail because they still use TYPE=0 as their "invalid descriptor":

  • agc_shader_memory and agc_shader_bindless: core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp:1269 (heap[0][3] &= 0x0fffffffu clears TYPE) fails with image tables: an invalid T# was bound. Use a reserved type (e.g. TYPE=1) there, as you did for the guarded-source case.
  • agc_driver_image_table: tests/execution/ImageTable.cpp:544 (SetRecord(7, ..., 0x0000ffacu)) and :1006 (invalid{... 0x0000ffacu}) have TYPE=0, so the "not an image" fault checks at :753, :875 and :1041 no longer fire (log: deferred write-back failed ... outside the snapshot, then did not report its address, words and reason).

Please switch those fixtures to a reserved type and rerun agc_shader_memory, agc_shader_bindless and agc_driver_image_table; CI doesn't run them on this PR, so the full suites need a local run. The rest looks fine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5523998220 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#pullrequestreview-5523998220). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T20:09:46Z. **Review:** CHANGES_REQUESTED --- Thanks for the rebase. Checked on this PR merged onto current `main`: `agc_shader_type_zero_image_materialization` passes, but three existing tests now fail because they still use `TYPE=0` as their "invalid descriptor": - `agc_shader_memory` and `agc_shader_bindless`: `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp:1269` (`heap[0][3] &= 0x0fffffffu` clears TYPE) fails with `image tables: an invalid T# was bound`. Use a reserved type (e.g. `TYPE=1`) there, as you did for the guarded-source case. - `agc_driver_image_table`: `tests/execution/ImageTable.cpp:544` (`SetRecord(7, ..., 0x0000ffacu)`) and `:1006` (`invalid{... 0x0000ffacu}`) have TYPE=0, so the "not an image" fault checks at `:753`, `:875` and `:1041` no longer fire (log: `deferred write-back failed ... outside the snapshot`, then `did not report its address, words and reason`). Please switch those fixtures to a reserved type and rerun `agc_shader_memory`, `agc_shader_bindless` and `agc_driver_image_table`; CI doesn't run them on this PR, so the full suites need a local run. The rest looks fine.
MarcZX10 commented 2026-10-14 20:26:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T20:26:54Z.


Linux follow-up on local head 825a26751 (GCC 12.2, Ninja, Release): I applied the three requested reserved-TYPE fixture changes and built all three test binaries successfully. The focused CTest run did not pass:

  • agc_shader_bindless: fails later in the shader-memory fixture with image tables: a straddling record was bound.
  • agc_shader_memory: same failure.
  • agc_driver_image_table: aborts before test logic because this host Xeon E5-1620 v2 lacks the AVX2/BMI/LZCNT/FMA features required by the emulator.

I verified that restoring the original TYPE=0 shader fixture instead fails earlier with image tables: an invalid T# was bound, so that does not establish a passing baseline. I have not pushed the fixture edits while the shader-suite failure remains unresolved. The CMake configure and all three builds succeeded.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6177714050 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6177714050). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T20:26:54Z. --- Linux follow-up on local head `825a26751` (GCC 12.2, Ninja, Release): I applied the three requested reserved-TYPE fixture changes and built all three test binaries successfully. The focused CTest run did not pass: - `agc_shader_bindless`: fails later in the shader-memory fixture with `image tables: a straddling record was bound`. - `agc_shader_memory`: same failure. - `agc_driver_image_table`: aborts before test logic because this host Xeon E5-1620 v2 lacks the AVX2/BMI/LZCNT/FMA features required by the emulator. I verified that restoring the original TYPE=0 shader fixture instead fails earlier with `image tables: an invalid T# was bound`, so that does not establish a passing baseline. I have not pushed the fixture edits while the shader-suite failure remains unresolved. The CMake configure and all three builds succeeded. AI-assisted: yes.
MarcZX10 commented 2026-10-14 20:31:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-14T20:31:31Z.


Follow-up on the local Linux run: the straddling test exposed that the table snapshot padded an incomplete descriptor to eight zero-filled dwords, making its missing TYPE look like a null descriptor. I now preserve the number of dwords actually captured and materialize incomplete image/sampler records as OutsideSnapshot poison. I also changed the two additional malformed TYPE=0 image fixtures in ShaderMemory.cpp to reserved TYPE=1; the dedicated TYPE=0 materialization regression remains unchanged.

On the updated head 4a7a38c43 (GCC 12.2, Ninja, Release): build of agc_shader_memory_tests, agc_driver_bindless_images_tests, and agc_driver_image_table_tests succeeded. CTest passed agc_shader_bindless, agc_shader_memory, and agc_shader_type_zero_image_materialization (3/3). agc_driver_image_table was attempted but aborts before test logic because this host Xeon E5-1620 v2 lacks the CPU extensions required by the emulator. tools/check_conventions.py --base upstream/main and git diff --check pass.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6177809496 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6177809496). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-14T20:31:31Z. --- Follow-up on the local Linux run: the straddling test exposed that the table snapshot padded an incomplete descriptor to eight zero-filled dwords, making its missing TYPE look like a null descriptor. I now preserve the number of dwords actually captured and materialize incomplete image/sampler records as `OutsideSnapshot` poison. I also changed the two additional malformed TYPE=0 image fixtures in `ShaderMemory.cpp` to reserved TYPE=1; the dedicated TYPE=0 materialization regression remains unchanged. On the updated head `4a7a38c43` (GCC 12.2, Ninja, Release): build of `agc_shader_memory_tests`, `agc_driver_bindless_images_tests`, and `agc_driver_image_table_tests` succeeded. CTest passed `agc_shader_bindless`, `agc_shader_memory`, and `agc_shader_type_zero_image_materialization` (3/3). `agc_driver_image_table` was attempted but aborts before test logic because this host Xeon E5-1620 v2 lacks the CPU extensions required by the emulator. `tools/check_conventions.py --base upstream/main` and `git diff --check` pass. AI-assisted: yes.
adriadam10 commented 2026-10-14 20:49:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T20:49:05Z.

Review: CHANGES_REQUESTED


Thanks for the update. The reserved-type fixtures fix agc_shader_memory and agc_shader_bindless on my side too, but the new commit (4a7a38c43, poison incomplete records) breaks two other tests. Checked on this PR merged onto current main (Linux, Release):

  • agc_driver_image_table fails with image table: valid entries faulted and deferred write-back failed: ... selected the descriptor at ... (words a795ce4c c1600055 8000c00f 90000fac): outside the snapshot. A valid descriptor (TYPE=9) is now poisoned as OutsideSnapshot because the shader only reads part of its dwords, so words.dwordCount != 8u (ResourceMaterializer.cpp:1057, :1147) is true for a record that is not truncated.
  • agc_driver_image_table_reuse fails with the shader does not bind the whole table.

Both pass when ResourceMaterializer.cpp is reverted to main and fail with it, so the regression comes from this change. (agc_driver_tessellation segfaults with and without the PR, unrelated.)

The capture count at :684-697 cannot tell "dwords the shader did not read" from "dwords outside the snapshot". Either track which dwords the record needs (TYPE sits in dword 3, so only that one decides null vs. not) or drop this commit and handle the straddling case separately. agc_driver_image_table cannot run on your host, so please check the CTest list above on a machine with AVX2/BMI, or say so and I will run it after your next push.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5524471082 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#pullrequestreview-5524471082). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T20:49:05Z. **Review:** CHANGES_REQUESTED --- Thanks for the update. The reserved-type fixtures fix `agc_shader_memory` and `agc_shader_bindless` on my side too, but the new commit (`4a7a38c43`, poison incomplete records) breaks two other tests. Checked on this PR merged onto current `main` (Linux, Release): - `agc_driver_image_table` fails with `image table: valid entries faulted` and `deferred write-back failed: ... selected the descriptor at ... (words a795ce4c c1600055 8000c00f 90000fac): outside the snapshot`. A valid descriptor (TYPE=9) is now poisoned as `OutsideSnapshot` because the shader only reads part of its dwords, so `words.dwordCount != 8u` (`ResourceMaterializer.cpp:1057`, `:1147`) is true for a record that is not truncated. - `agc_driver_image_table_reuse` fails with `the shader does not bind the whole table`. Both pass when `ResourceMaterializer.cpp` is reverted to `main` and fail with it, so the regression comes from this change. (`agc_driver_tessellation` segfaults with and without the PR, unrelated.) The capture count at `:684-697` cannot tell "dwords the shader did not read" from "dwords outside the snapshot". Either track which dwords the record needs (TYPE sits in dword 3, so only that one decides null vs. not) or drop this commit and handle the straddling case separately. `agc_driver_image_table` cannot run on your host, so please check the CTest list above on a machine with AVX2/BMI, or say so and I will run it after your next push.
github-actions[bot] commented 2026-10-14 21:11:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T21:11:24Z.


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
#5828 core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp L827
#5958 core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp L893
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6178597738 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6178597738). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-14T21:11:24Z. --- <!-- 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 | |---|---|---|---| | #5828 | `core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp` [L827](https://github.com/boykopovar/AnyPS5/blob/1db84d5748573165ccb241618bf5e1ccd91095c4/core/libs/prx/libSceAgcDriver/tests/ShaderMemory.cpp#L827) | | | | #5958 | `core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp` [L893](https://github.com/boykopovar/AnyPS5/blob/1db84d5748573165ccb241618bf5e1ccd91095c4/core/shader/recompiler/Optimization/src/ResourceMaterializer.cpp#L893) | | |
fdfawef324 commented 2026-10-14 23:23:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by fdfawef324 on 2026-10-14T23:23:56Z.


Replay comparison of this head (4a7a38c43), #5828 and main on a Demon's Souls TYPE 0 shader request: https://github.com/boykopovar/AnyPS5/pull/5828#issuecomment-6180693005. Both PRs clear the image refusal and stop at the same buffer-descriptor check. AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6180696906 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6180696906). Originally posted by [fdfawef324](https://github.com/fdfawef324) on 2026-10-14T23:23:56Z. --- Replay comparison of this head (`4a7a38c43`), #5828 and main on a Demon's Souls TYPE 0 shader request: https://github.com/boykopovar/AnyPS5/pull/5828#issuecomment-6180693005. Both PRs clear the image refusal and stop at the same buffer-descriptor check. AI-assisted: yes
MarcZX10 commented 2026-10-15 01:54:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T01:54:15Z.


Thanks for identifying that dwordCount conflates unread fields with missing data. Commit 682b07eb0 now records the available dword positions and requires only dword 3 (TYPE) before classifying an image record. Records with an unread TYPE are poisoned; partial captures that include TYPE remain eligible for normal materialization.

On Linux with GCC 12.2, agc_shader_memory_tests passes end to end, as do its --bindless and --type-zero-image-materialization cases. agc_driver_image_table_tests builds, but this Xeon E5-1620 v2 host lacks the AVX2/BMI features required to run it. Could you rerun agc_driver_image_table and agc_driver_image_table_reuse on your capable host?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182590794 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6182590794). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-15T01:54:15Z. --- Thanks for identifying that `dwordCount` conflates unread fields with missing data. Commit `682b07eb0` now records the available dword positions and requires only dword 3 (`TYPE`) before classifying an image record. Records with an unread `TYPE` are poisoned; partial captures that include `TYPE` remain eligible for normal materialization. On Linux with GCC 12.2, `agc_shader_memory_tests` passes end to end, as do its `--bindless` and `--type-zero-image-materialization` cases. `agc_driver_image_table_tests` builds, but this Xeon E5-1620 v2 host lacks the AVX2/BMI features required to run it. Could you rerun `agc_driver_image_table` and `agc_driver_image_table_reuse` on your capable host?
MarcZX10 commented 2026-10-15 02:00:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T02:00:25Z.


Follow-up to my earlier validation note: commit 0e7e149cc narrows TYPE=0 null handling to read-only static image slots. Writable and atomic image slots still fail materialization, and TYPE=0 table records remain poisoned; the fixture now covers all three boundaries. The available hardware evidence covers reads, not writes or atomics, so this keeps those paths unsupported.

On Linux with GCC 12.2, the full agc_shader_memory_tests, --bindless, and --type-zero-image-materialization runs pass. agc_driver_image_table_tests rebuilds, but this Xeon E5-1620 v2 host cannot pass its AVX2/BMI CPU guard. Please rerun agc_driver_image_table and agc_driver_image_table_reuse on a capable host and review the narrowed head.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182667720 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6182667720). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-15T02:00:25Z. --- Follow-up to my earlier validation note: commit `0e7e149cc` narrows TYPE=0 null handling to read-only static image slots. Writable and atomic image slots still fail materialization, and TYPE=0 table records remain poisoned; the fixture now covers all three boundaries. The available hardware evidence covers reads, not writes or atomics, so this keeps those paths unsupported. On Linux with GCC 12.2, the full `agc_shader_memory_tests`, `--bindless`, and `--type-zero-image-materialization` runs pass. `agc_driver_image_table_tests` rebuilds, but this Xeon E5-1620 v2 host cannot pass its AVX2/BMI CPU guard. Please rerun `agc_driver_image_table` and `agc_driver_image_table_reuse` on a capable host and review the narrowed head.
MarcZX10 commented 2026-10-15 02:02:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-15T02:02:09Z.


Follow-up after the new hosted run: current head 0e7e149cc has successful eligibility, conventions, and report checks; the full Linux/Windows build jobs were skipped by path policy. Review remains CHANGES_REQUESTED. The Linux regressions and CPU limitation are described above. The remaining review request is for agc_driver_image_table and agc_driver_image_table_reuse on a host that passes the emulator CPU-feature guard.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6182690490 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#issuecomment-6182690490). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-15T02:02:09Z. --- Follow-up after the new hosted run: current head `0e7e149cc` has successful eligibility, conventions, and report checks; the full Linux/Windows build jobs were skipped by path policy. Review remains `CHANGES_REQUESTED`. The Linux regressions and CPU limitation are described above. The remaining review request is for `agc_driver_image_table` and `agc_driver_image_table_reuse` on a host that passes the emulator CPU-feature guard.
adriadam10 commented 2026-10-15 11:13:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:13:18Z.

Review: APPROVED


Thanks for the update. Checked on this PR merged onto current main (Linux, Release): agc_shader_memory, agc_driver_image_table, agc_driver_image_table_reuse and the other image-table tests pass, and agc_shader_memory fails without the change. Both regressions from the previous round are gone; tracking only dword 3 (TYPE) in availableDwordMask fixes the straddling case without poisoning partially read valid descriptors. (agc_driver_tessellation segfaults on main too.)

Measured on gfx1035: image_load through a T# with TYPE=0 and a nonzero base returns 0,0,0,0, like a null image, so treating it as null for read-only slots matches hardware. Leaving writes, atomics and table entries throwing is right, there is no measurement for them.

I added one commit on your branch: the docs/dev/debt/libSceAgcDriver.md line said direct and table-backed reads are treated as null, but the code only accepts read-only slots outside tables. It now states the real scope and the measurement. Merging once the full Build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5532194003 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/5473#pullrequestreview-5532194003). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-15T11:13:18Z. **Review:** APPROVED --- Thanks for the update. Checked on this PR merged onto current `main` (Linux, Release): `agc_shader_memory`, `agc_driver_image_table`, `agc_driver_image_table_reuse` and the other image-table tests pass, and `agc_shader_memory` fails without the change. Both regressions from the previous round are gone; tracking only dword 3 (`TYPE`) in `availableDwordMask` fixes the straddling case without poisoning partially read valid descriptors. (`agc_driver_tessellation` segfaults on `main` too.) Measured on gfx1035: `image_load` through a T# with `TYPE=0` and a nonzero base returns 0,0,0,0, like a null image, so treating it as null for read-only slots matches hardware. Leaving writes, atomics and table entries throwing is right, there is no measurement for them. I added one commit on your branch: the `docs/dev/debt/libSceAgcDriver.md` line said direct and table-backed reads are treated as null, but the code only accepts read-only slots outside tables. It now states the real scope and the measurement. Merging once the full Build is green.
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!5473
No description provided.