fix(shader): decode a T# with an unset format field as null #10556

Merged
mixyt merged 2 commits from upstream-pr/10556 into main 2026-11-03 08:08:38 +00:00
mixyt commented 2026-10-24 09:47:24 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by mixyt on 2026-10-24T09:47:24Z.


What

A directly bound sampled image T# whose 9-bit format field names no texture format (0, or all ones 0x1ff — the zero-format and the 0xffffffff-filled words of an unbound texture slot) now decodes like a null descriptor, with no view behind it, instead of throwing. The rule requires the descriptor's TYPE to be an image type the decode implements (8 to 14): a reserved or non-image TYPE keeps its rejection however the format field reads, so the replay tool's invalid request (TYPE 2, all-ones words) fails exactly as on main with its fixture unchanged. The null decode applies to the compile-time descriptor decode and to the runtime SRT materialization alike. The driver's IsNullSampledTextureResource applies the same TYPE and format rule to sampled-image consumers; storage bindings and written-buffer tracking keep the base-and-type null rule, so an unset-format storage or atomic image still throws. An image-table entry with an unset format stays poison, and a format that names a real but unimplemented texture still throws. The console's result of sampling such a slot is not measured; the null decode follows the existing all-zero descriptor rule (noted in docs/dev/debt/shader.md).

Tested

Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), NVIDIA GTX 1650.

  • Neptunia ReVerse (PPSA02721, 01.000.000), on the earlier head, driver 616.56: main aborts on the first rendered frame with sampled image descriptor uses an unsupported format (T# ffffffff ffffffff 00000019 ...) (format 0x1ff, TYPE 12), then with runtime image descriptor is invalid (format 0) once the first is passed. With this PR the title runs its Idea Factory logo animation, title menu, intro dialogue and tutorial at 24-28 fps with pad input (screenshots and VideoOut telemetry attached); the first 3D section still stops on guest sampler descriptor requests a LOD bias beyond the device limit, a separate gap.
  • On the rebased head c88b87df3, with the complete libs set rebuilt from that tree, the title ran our full 300 s cap: 7,316 presents (about 24 fps), no exception and no descriptor rejection; the time cap ended the run and it did not reach the earlier head's LOD-bias stop within it. (A single rebuilt driver launched over an older libs set fails to load on a libSceSystemService.prx import, so the whole libs set is rebuilt for this run.)
  • Focused tests on the rebased head c88b87df3 (Windows 11, GTX 1650, driver 621.01, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1): agc_shader_memory, agc_driver_image_table, agc_driver_graphics, agc_shader_replay_requests, agc_shader_replay_tool and agc_shader_type_zero_image_materialization pass, both without and with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.363; the loader log shows VkLayer_khronos_validation.dll loaded and the instance layer inserted, and the verbose run has no VUID- messages).
  • Regressions for the split: agc_shader_memory materializes the measured TYPE 12 words with format 0 and 0x1ff as null, refuses a reserved TYPE 2 T# with the same format fields (runtime image descriptor is invalid) and keeps storage/atomic unset-format images invalid; agc_driver_graphics refuses a sampled reserved TYPE 2 T# at ShaderResources construction (unsupported image type 2) and accepts a sampled TYPE 12 one as null, plus the storage and DispatchWriteRanges cases; RunGuestTextureResourceTests pins IsNullTextureResource vs IsNullSampledTextureResource across TYPE 2, 12 and 15.
  • agc_driver_sample_order, agc_driver_sample_order_grid_reference and agc_driver_sample_order_recipe_depth_locations fail on this GTX 1650 both on main and with this PR (device-behavior expectation; the same tests skip on this machine's Intel UHD, which reports 1x1 sample location grids).

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; 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
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA02721 #11493
  • GPUs tested: NVIDIA GTX 1650 (0x1f9d), driver 616.56 (earlier title run) and 621.01 (rebased head: title rerun and focused tests), Windows 11
  • AI-assisted: yes
PPSA02721-20261024-133540 PPSA02721-20261024-115857 PPSA02721-20261024-115713
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4994352338 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556). Originally posted by [mixyt](https://github.com/mixyt) on 2026-10-24T09:47:24Z. --- ### What A directly bound sampled image T# whose 9-bit format field names no texture format (0, or all ones 0x1ff — the zero-format and the 0xffffffff-filled words of an unbound texture slot) now decodes like a null descriptor, with no view behind it, instead of throwing. The rule requires the descriptor's TYPE to be an image type the decode implements (8 to 14): a reserved or non-image TYPE keeps its rejection however the format field reads, so the replay tool's invalid request (TYPE 2, all-ones words) fails exactly as on `main` with its fixture unchanged. The null decode applies to the compile-time descriptor decode and to the runtime SRT materialization alike. The driver's `IsNullSampledTextureResource` applies the same TYPE and format rule to sampled-image consumers; storage bindings and written-buffer tracking keep the base-and-type null rule, so an unset-format storage or atomic image still throws. An image-table entry with an unset format stays poison, and a format that names a real but unimplemented texture still throws. The console's result of sampling such a slot is not measured; the null decode follows the existing all-zero descriptor rule (noted in `docs/dev/debt/shader.md`). ### Tested Windows 11, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh r7), NVIDIA GTX 1650. - Neptunia ReVerse (PPSA02721, 01.000.000), on the earlier head, driver 616.56: `main` aborts on the first rendered frame with `sampled image descriptor uses an unsupported format (T# ffffffff ffffffff 00000019 ...)` (format 0x1ff, TYPE 12), then with `runtime image descriptor is invalid` (format 0) once the first is passed. With this PR the title runs its Idea Factory logo animation, title menu, intro dialogue and tutorial at 24-28 fps with pad input (screenshots and VideoOut telemetry attached); the first 3D section still stops on `guest sampler descriptor requests a LOD bias beyond the device limit`, a separate gap. - On the rebased head `c88b87df3`, with the complete libs set rebuilt from that tree, the title ran our full 300 s cap: 7,316 presents (about 24 fps), no exception and no descriptor rejection; the time cap ended the run and it did not reach the earlier head's LOD-bias stop within it. (A single rebuilt driver launched over an older libs set fails to load on a `libSceSystemService.prx` import, so the whole libs set is rebuilt for this run.) - Focused tests on the rebased head `c88b87df3` (Windows 11, GTX 1650, driver 621.01, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`): `agc_shader_memory`, `agc_driver_image_table`, `agc_driver_graphics`, `agc_shader_replay_requests`, `agc_shader_replay_tool` and `agc_shader_type_zero_image_materialization` pass, both without and with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (layer 1.4.363; the loader log shows `VkLayer_khronos_validation.dll` loaded and the instance layer inserted, and the verbose run has no `VUID-` messages). - Regressions for the split: `agc_shader_memory` materializes the measured TYPE 12 words with format 0 and 0x1ff as null, refuses a reserved TYPE 2 T# with the same format fields (`runtime image descriptor is invalid`) and keeps storage/atomic unset-format images invalid; `agc_driver_graphics` refuses a sampled reserved TYPE 2 T# at `ShaderResources` construction (`unsupported image type 2`) and accepts a sampled TYPE 12 one as null, plus the storage and `DispatchWriteRanges` cases; `RunGuestTextureResourceTests` pins `IsNullTextureResource` vs `IsNullSampledTextureResource` across TYPE 2, 12 and 15. - `agc_driver_sample_order`, `agc_driver_sample_order_grid_reference` and `agc_driver_sample_order_recipe_depth_locations` fail on this GTX 1650 both on `main` and with this PR (device-behavior expectation; the same tests skip on this machine's Intel UHD, which reports 1x1 sample location grids). ### 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; silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation `.md` files or images added to the repository - [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: PPSA02721 #11493 - [x] GPUs tested: NVIDIA GTX 1650 (0x1f9d), driver 616.56 (earlier title run) and 621.01 (rebased head: title rerun and focused tests), Windows 11 - [x] AI-assisted: yes <img width="3840" height="2160" alt="PPSA02721-20261024-133540" src="https://github.com/user-attachments/assets/d99ae8e0-9284-453c-a103-057eba05340c" /> <img width="3840" height="2160" alt="PPSA02721-20261024-115857" src="https://github.com/user-attachments/assets/84832ca9-8f6b-4dc9-aae9-aa8bdde2edce" /> <img width="3840" height="2160" alt="PPSA02721-20261024-115713" src="https://github.com/user-attachments/assets/8f478a71-976d-40fb-baa6-db6b0e70b8c3" />
MarcZX10 commented 2026-10-24 10:34:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T10:34:44Z.

Review: CHANGES_REQUESTED


The unset-format null rule currently applies to every directly bound image resource, not only the sampled reads described in the PR. nullImageDescriptor(const ImageResource&, ...) returns true for any image.table == NoTable when format is 0 or 0x1ff. That helper is also used by runtime storage-image inspection/materialization; an invalid-format storage image can therefore be accepted as null and its writes/atomics silently skipped instead of rejected. Please scope this exception to the measured sampled/read-only case (for example, sampled + read + !written + !atomic), leaving storage and atomic resources invalid unless their behavior is separately established, and add a regression proving an unset-format storage descriptor still fails. The new shader-memory cases cover sampled descriptors, so they do not currently catch this path.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5637942134 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556#pullrequestreview-5637942134). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T10:34:44Z. **Review:** CHANGES_REQUESTED --- The unset-format null rule currently applies to every directly bound image resource, not only the sampled reads described in the PR. `nullImageDescriptor(const ImageResource&, ...)` returns true for any `image.table == NoTable` when format is 0 or 0x1ff. That helper is also used by runtime storage-image inspection/materialization; an invalid-format storage image can therefore be accepted as null and its writes/atomics silently skipped instead of rejected. Please scope this exception to the measured sampled/read-only case (for example, sampled + read + !written + !atomic), leaving storage and atomic resources invalid unless their behavior is separately established, and add a regression proving an unset-format storage descriptor still fails. The new shader-memory cases cover sampled descriptors, so they do not currently catch this path.
MarcZX10 commented 2026-10-24 14:02:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T14:02:25Z.

Review: CHANGES_REQUESTED


Follow-up review of exact head ab264470df68f2dc9a5e0dcc714340cd81078729. The new ResourceMaterializer predicate correctly limits its new null rule to a direct sampled read that is neither written nor atomic, and verifyUnsetFormatImageMaterialization now asserts that its storage/atomic materialization cases are rejected.

The driver-side classification is still global, though: IsNullTextureResource in GuestTextureResource.cpp now returns true for formats 0 and 0x1ff regardless of resource class. The current ShaderResources.cpp storage-image branches call it and skip the binding as null (plannedStorageImages is decremented); WrittenBuffers.cpp also skips the storage range. Those consumers can therefore silently drop an invalid-format storage image if it reaches the runtime descriptor path. The new materializer unit test does not exercise those driver consumers.

Please scope the format-based null rule to sampled-image consumers (for example, pass descriptor role/class to the helper or use a sampled-only predicate), and add a regression showing an unset-format storage image is rejected by the driver path and is not omitted from written-buffer tracking. The sample-only change and reported Windows/NVIDIA results are useful, but I did not run the GPU tests locally.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5638516945 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556#pullrequestreview-5638516945). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T14:02:25Z. **Review:** CHANGES_REQUESTED --- Follow-up review of exact head `ab264470df68f2dc9a5e0dcc714340cd81078729`. The new `ResourceMaterializer` predicate correctly limits its new null rule to a direct sampled read that is neither written nor atomic, and `verifyUnsetFormatImageMaterialization` now asserts that its storage/atomic materialization cases are rejected. The driver-side classification is still global, though: `IsNullTextureResource` in `GuestTextureResource.cpp` now returns true for formats 0 and 0x1ff regardless of resource class. The current `ShaderResources.cpp` storage-image branches call it and skip the binding as null (`plannedStorageImages` is decremented); `WrittenBuffers.cpp` also skips the storage range. Those consumers can therefore silently drop an invalid-format storage image if it reaches the runtime descriptor path. The new materializer unit test does not exercise those driver consumers. Please scope the format-based null rule to sampled-image consumers (for example, pass descriptor role/class to the helper or use a sampled-only predicate), and add a regression showing an unset-format storage image is rejected by the driver path and is not omitted from written-buffer tracking. The sample-only change and reported Windows/NVIDIA results are useful, but I did not run the GPU tests locally.
MarcZX10 commented 2026-10-24 19:51:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T19:51:04Z.

Review: DISMISSED


Re-reviewed exact head 6d96cec31a1213af58799cfe6a975ef608ca24cb. The implementation now uses the sampled-only null predicate at sampled consumers and preserves the base/type predicate for storage and written-buffer paths, which addresses the behavior I flagged. The remaining test gap from my prior review is still open: the new GuestTextureResource test proves the predicate split and format rejection, but does not exercise ShaderResources rejecting an unset-format storage image or prove that the corresponding range is not skipped by written-buffer tracking. Please add focused coverage for those consumer paths, or point to existing tests that exercise them. The reported Windows/NVIDIA and AMD title runs used the earlier ab264470 head; please confirm the focused validation-layer tests on this scoped head. No new review action on GPU behavior until those checks are current.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5639704711 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556#pullrequestreview-5639704711). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T19:51:04Z. **Review:** DISMISSED --- Re-reviewed exact head `6d96cec31a1213af58799cfe6a975ef608ca24cb`. The implementation now uses the sampled-only null predicate at sampled consumers and preserves the base/type predicate for storage and written-buffer paths, which addresses the behavior I flagged. The remaining test gap from my prior review is still open: the new `GuestTextureResource` test proves the predicate split and format rejection, but does not exercise `ShaderResources` rejecting an unset-format storage image or prove that the corresponding range is not skipped by written-buffer tracking. Please add focused coverage for those consumer paths, or point to existing tests that exercise them. The reported Windows/NVIDIA and AMD title runs used the earlier `ab264470` head; please confirm the focused validation-layer tests on this scoped head. No new review action on GPU behavior until those checks are current.
MarcZX10 commented 2026-10-28 22:11:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-28T22:11:56Z.

Review: CHANGES_REQUESTED


Reviewing exact head 556257c5a0b84cfe66da043321495688cfd1dc09.

What I ran

  • Inspected the exact implementation and fixture changes, prior test-failure reports, the title evidence, and current hosted checks.
  • Hosted conventions, eligibility, labels, and report checks pass. Linux, Windows, relinker, and specialized jobs are skipped.
  • The earlier Windows/GTX 1650 validation and title runs are author-reported on prior heads; I did not run a local build or GPU test.

Results

Check Result Evidence
Unset-format sampled descriptor behavior Reviewed Exact PR diff and replay regression discussion
Focused shader/driver tests Pass, author-reported Previous head; validation layer loaded with no VUIDs
Replay tool/request regression Pass, contributor-reported Fixture-only follow-up on previous head
Hosted conventions, eligibility, labels, report Pass GitHub Actions
Hosted product and specialized jobs Skipped GitHub Actions
Local build and GPU test Not run This review

Findings

Blocking

  • IsNullSampledTextureResource accepts any sampled descriptor whose format is 0 or 0x1ff, without first validating its TYPE. The PR discussion demonstrated the consequence: the existing replay fixture had an unset-format T# with reserved TYPE 2, and the new rule made that invalid request materialize successfully as null. The fixture was then changed to use a valid format so the replay test continued to fail, but that does not restore rejection for the invalid descriptor itself. The only reported title descriptors use TYPE 12; the console behavior for unset-format TYPE 2–7 is not measured. Please preserve rejection for reserved/non-image types (including TYPE 2) before applying the unset-format null rule, and add sampled descriptor/materialization regressions for both a measured valid image TYPE and an invalid TYPE with an unset format.

Non-blocking

  • The change keeps unset-format storage/atomic paths invalid, and the reported follow-up tests distinguish sampled-image handling from storage and write-range consumers.
  • The title report is useful but partial: it advances Neptunia ReVerse to a separate LOD-bias limitation, and does not establish behavior for the invalid TYPE 2 combination above.

Sources

Not verified

  • I did not run local CTest, a Vulkan GPU test, or a PS5 console comparison.
  • The reported title and validation runs are from PR participants and earlier heads.

To get this to a good state

Validate the descriptor type before applying the unset-format null shortcut, and cover valid-image versus reserved-type descriptors with unset formats; then request a re-review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5690376245 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556#pullrequestreview-5690376245). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-28T22:11:56Z. **Review:** CHANGES_REQUESTED --- Reviewing exact head `556257c5a0b84cfe66da043321495688cfd1dc09`. ## What I ran - Inspected the exact implementation and fixture changes, prior test-failure reports, the title evidence, and current hosted checks. - Hosted conventions, eligibility, labels, and report checks pass. Linux, Windows, relinker, and specialized jobs are skipped. - The earlier Windows/GTX 1650 validation and title runs are author-reported on prior heads; I did not run a local build or GPU test. ## Results | Check | Result | Evidence | |---|---|---| | Unset-format sampled descriptor behavior | Reviewed | Exact PR diff and replay regression discussion | | Focused shader/driver tests | Pass, author-reported | Previous head; validation layer loaded with no VUIDs | | Replay tool/request regression | Pass, contributor-reported | Fixture-only follow-up on previous head | | Hosted conventions, eligibility, labels, report | Pass | GitHub Actions | | Hosted product and specialized jobs | Skipped | GitHub Actions | | Local build and GPU test | Not run | This review | ## Findings ### Blocking - `IsNullSampledTextureResource` accepts any sampled descriptor whose format is 0 or 0x1ff, without first validating its TYPE. The PR discussion demonstrated the consequence: the existing replay fixture had an unset-format T# with reserved TYPE 2, and the new rule made that invalid request materialize successfully as null. The fixture was then changed to use a valid format so the replay test continued to fail, but that does not restore rejection for the invalid descriptor itself. The only reported title descriptors use TYPE 12; the console behavior for unset-format TYPE 2–7 is not measured. Please preserve rejection for reserved/non-image types (including TYPE 2) before applying the unset-format null rule, and add sampled descriptor/materialization regressions for both a measured valid image TYPE and an invalid TYPE with an unset format. ### Non-blocking - The change keeps unset-format storage/atomic paths invalid, and the reported follow-up tests distinguish sampled-image handling from storage and write-range consumers. - The title report is useful but partial: it advances Neptunia ReVerse to a separate LOD-bias limitation, and does not establish behavior for the invalid TYPE 2 combination above. ## Sources - [Repository rule for unknown behavior](https://github.com/boykopovar/AnyPS5/blob/main/AGENTS.md) - [Current pull request and descriptor-type regression discussion](https://github.com/boykopovar/AnyPS5/pull/10556) ## Not verified - I did not run local CTest, a Vulkan GPU test, or a PS5 console comparison. - The reported title and validation runs are from PR participants and earlier heads. ## To get this to a good state Validate the descriptor type before applying the unset-format null shortcut, and cover valid-image versus reserved-type descriptors with unset formats; then request a re-review.
MarcZX10 commented 2026-10-29 09:43:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:43:57Z.

Review: APPROVED


Re-checked — approved

The current implementation resolves the prior type-order concern: descriptor TYPE is validated before the unset-format rule, so only supported image types 8–14 take the sampled-null path. Reserved and non-image types with format 0 or 0x1ff still fail. The replay fixture again uses the original all-ones descriptor and is rejected for the same non-image TYPE as on main.

What I checked

  • Exact head c88b87df3d4088695bcb2a91a1f4964ba710d003 is based on current main aaccd0ba39b7d40fdbf19664575a7e567d8542f7; merge preview is clean.
  • Inspected the sampled-only predicate and its call sites, confirmed storage-image paths retain the original format validation, and reviewed regressions for TYPE 12 plus rejected TYPE 2/7/15.
  • The author reports agc_shader_memory, agc_driver_image_table, agc_driver_graphics, agc_shader_replay_requests, agc_shader_replay_tool, and agc_shader_type_zero_image_materialization passing on this head; conventions pass. The reported host did not have the validation layer installed. The new hosted conventions/labels checks are pending.

I did not run a local build or GPU test. The exact-head results above are author-reported; no console behavior is claimed. No blocking source issue remains.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5695684142 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556#pullrequestreview-5695684142). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T09:43:57Z. **Review:** APPROVED --- # Re-checked — approved The current implementation resolves the prior type-order concern: descriptor TYPE is validated before the unset-format rule, so only supported image types 8–14 take the sampled-null path. Reserved and non-image types with format 0 or 0x1ff still fail. The replay fixture again uses the original all-ones descriptor and is rejected for the same non-image TYPE as on `main`. ## What I checked - Exact head `c88b87df3d4088695bcb2a91a1f4964ba710d003` is based on current `main` `aaccd0ba39b7d40fdbf19664575a7e567d8542f7`; merge preview is clean. - Inspected the sampled-only predicate and its call sites, confirmed storage-image paths retain the original format validation, and reviewed regressions for TYPE 12 plus rejected TYPE 2/7/15. - The author reports `agc_shader_memory`, `agc_driver_image_table`, `agc_driver_graphics`, `agc_shader_replay_requests`, `agc_shader_replay_tool`, and `agc_shader_type_zero_image_materialization` passing on this head; conventions pass. The reported host did not have the validation layer installed. The new hosted conventions/labels checks are pending. I did not run a local build or GPU test. The exact-head results above are author-reported; no console behavior is claimed. No blocking source issue remains.
XairRrR commented 2026-11-02 22:18:12 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-02T22:18:12Z.

Review: APPROVED


Reviewed — approved

A directly bound sampled T# whose TYPE is 8–14 and whose format field is 0 or 0x1ff now decodes as null in the materializer and at the driver's sampled consumers. Reserved TYPEs, storage images and atomic images keep their rejection. The focused tests pass, and the negative control fails as it should.

What I ran

Head e1eda1a2aedf73874ea2e28bc2e981a8ef0fac94, merged with --no-ff into main 9090972b7e91fd266819cbd77a8b058e177b5682 (merged tree 9f16b8a122e8a8cb0f2aeb7d153c4357579aa7c7). Machine: Debian 13 VM, 2× Xeon Gold 6136 (32 vCPU), GCC 14.2.0, Release/Ninja, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19).

git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...e1eda1a2aedf73874ea2e28bc2e981a8ef0fac94
python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682
env ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -j8 --test-load 32 --output-on-failure \
  -R "^(agc_driver_image_table|agc_driver_graphics|agc_shader_type_zero_image_materialization|agc_shader_memory|agc_shader_replay_requests|agc_shader_replay_tool)$"
# negative control (see below)
ninja -C build -j32 -l32 agc_shader_memory_tests agc_driver_graphics_tests libs
env ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build --output-on-failure -R "^(agc_driver_graphics|agc_shader_memory)$"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Configure / build / libs (script) ok
Selected tests (script): 2042 run 1924 passed, 111 skipped (all expected per check_skips.py), 0 new failures, 0 timeouts; 7 known failures that also fail on main (agc_driver_division, agc_driver_f32_denormal_flush, agc_driver_f64_div_scale_denormal_modes, agc_driver_f64_fma_denormal_modes, agc_driver_mullit_f32_denormal_modes, unwrap_self, vector_constant_factor_tininess)
Validation-layer comparison (script): 757 tests layer loaded in 756, missing in none, 0 tests with new VUID- lines vs main
Focused tests (my run) 6/6 passed: agc_shader_replay_requests 0.01 s, agc_shader_type_zero_image_materialization 0.01 s, agc_shader_replay_tool 0.24 s, agc_shader_memory 7.9 s, agc_driver_image_table 8.4 s, agc_driver_graphics 34.5 s

I confirm what babyhuey and wachi35676 found: the earlier agc_shader_replay_tool regression is gone on this head. The invalid.req fixture is back to its upstream words, and capture rejects it again for its non-image TYPE.

Negative control

I restored ShaderResources.cpp and ResourceMaterializer.cpp from main. I kept the PR's GuestTextureResource.{hpp,cpp} so the predicate unit test still compiles. Then I rebuilt and ran the tests.

  • agc_shader_memory fails: runtime image descriptor is invalid: image 0 ... T# ffffffff e00fffff 00000019 c0017901 .... This is the measured TYPE 12 word set with format 0x1ff.
  • agc_driver_graphics fails: AGC graphics: unsupported guest texture format 0. This is the sampled unset-format binding in unsetFormatStorageImageTests.

After that I restored the merged files, rebuilt, and both tests passed again. git status --porcelain is empty.

Findings

Blocking

None.

Non-blocking

  1. One sampled consumer still uses the general predicate. The fallback branch of ShaderResources::PresyncSurfaces is at core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5648-5653 (at head). This branch runs when Stage A left no imageRecords, for example with APS5_NO_PRECOLLECT=1 (line 4932–4934). It walks sampled and storage elements through forEachImageElement but filters only with IsNullTextureResource.
    • Why it matters: a sampled TYPE 12 T# with format 0 or 0x1ff reaches DecodeTextureResource there and throws unsupported guest texture format. The normal path accepts the same T# as null. It does not affect the default configuration, which builds image records, but the sampled-consumer split is incomplete.
    • Suggested fix: in that branch, use binding.kind == DescriptorKind::SampledImage ? IsNullSampledTextureResource(words) : IsNullTextureResource(words). This matches line 4962. It could also use firstLayerWords, as the record path does.
  2. agc_driver_graphics exceeds the 30 s limit. It took 34.5 s here, and the AMD CI comment reports 82.9 s with validation layers. The PR adds only a few mock ShaderResources constructions, so the test was already slow before this change. I did not time it on main, so this is not counted against the PR. It is still worth splitting the test eventually.

Not verified

  • Console behaviour: I did not check what the console returns when it samples a T# with an unset format. The debt entry already records this as unmeasured.
  • Title runs: the title runs (Neptunia ReVerse on GTX 1650 and RX 9070 XT) and the Windows validation runs were reported by participants. I did not reproduce them; no title was launched.
  • Validation layer on this machine: I did not rerun the validation-layer comparison myself. The script's comparison over 757 tests shows no new VUID- lines.
  • GCN mode: IsNullSampledTextureResource reads the raw word-1 bits 20–28 without GCN remapping. I did not exercise the GCN-guest path.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5744200272 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10556#pullrequestreview-5744200272). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-02T22:18:12Z. **Review:** APPROVED --- # Reviewed — approved A directly bound sampled T# whose TYPE is 8–14 and whose format field is 0 or 0x1ff now decodes as null in the materializer and at the driver's sampled consumers. Reserved TYPEs, storage images and atomic images keep their rejection. The focused tests pass, and the negative control fails as it should. ## What I ran Head `e1eda1a2aedf73874ea2e28bc2e981a8ef0fac94`, merged with `--no-ff` into `main` `9090972b7e91fd266819cbd77a8b058e177b5682` (merged tree `9f16b8a122e8a8cb0f2aeb7d153c4357579aa7c7`). Machine: Debian 13 VM, 2× Xeon Gold 6136 (32 vCPU), GCC 14.2.0, Release/Ninja, Vulkan through lavapipe (Mesa 26.1.6, LLVM 19). ``` git diff --check 9090972b7e91fd266819cbd77a8b058e177b5682...e1eda1a2aedf73874ea2e28bc2e981a8ef0fac94 python3 tools/check_conventions.py --base 9090972b7e91fd266819cbd77a8b058e177b5682 env ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build -j8 --test-load 32 --output-on-failure \ -R "^(agc_driver_image_table|agc_driver_graphics|agc_shader_type_zero_image_materialization|agc_shader_memory|agc_shader_replay_requests|agc_shader_replay_tool)$" # negative control (see below) ninja -C build -j32 -l32 agc_shader_memory_tests agc_driver_graphics_tests libs env ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ctest --test-dir build --output-on-failure -R "^(agc_driver_graphics|agc_shader_memory)$" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Configure / build / `libs` (script) | ok | | Selected tests (script): 2042 run | 1924 passed, 111 skipped (all expected per `check_skips.py`), 0 new failures, 0 timeouts; 7 known failures that also fail on `main` (`agc_driver_division`, `agc_driver_f32_denormal_flush`, `agc_driver_f64_div_scale_denormal_modes`, `agc_driver_f64_fma_denormal_modes`, `agc_driver_mullit_f32_denormal_modes`, `unwrap_self`, `vector_constant_factor_tininess`) | | Validation-layer comparison (script): 757 tests | layer loaded in 756, missing in none, 0 tests with new `VUID-` lines vs `main` | | Focused tests (my run) | 6/6 passed: `agc_shader_replay_requests` 0.01 s, `agc_shader_type_zero_image_materialization` 0.01 s, `agc_shader_replay_tool` 0.24 s, `agc_shader_memory` 7.9 s, `agc_driver_image_table` 8.4 s, `agc_driver_graphics` 34.5 s | I confirm what babyhuey and wachi35676 found: the earlier `agc_shader_replay_tool` regression is gone on this head. The `invalid.req` fixture is back to its upstream words, and capture rejects it again for its non-image TYPE. ## Negative control I restored `ShaderResources.cpp` and `ResourceMaterializer.cpp` from `main`. I kept the PR's `GuestTextureResource.{hpp,cpp}` so the predicate unit test still compiles. Then I rebuilt and ran the tests. - `agc_shader_memory` fails: `runtime image descriptor is invalid: image 0 ... T# ffffffff e00fffff 00000019 c0017901 ...`. This is the measured TYPE 12 word set with format 0x1ff. - `agc_driver_graphics` fails: `AGC graphics: unsupported guest texture format 0`. This is the sampled unset-format binding in `unsetFormatStorageImageTests`. After that I restored the merged files, rebuilt, and both tests passed again. `git status --porcelain` is empty. ## Findings ### Blocking None. ### Non-blocking 1. **One sampled consumer still uses the general predicate.** The fallback branch of `ShaderResources::PresyncSurfaces` is at `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5648-5653` ([at head](https://github.com/boykopovar/AnyPS5/blob/e1eda1a2aedf73874ea2e28bc2e981a8ef0fac94/core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp#L5648-L5653)). This branch runs when Stage A left no `imageRecords`, for example with `APS5_NO_PRECOLLECT=1` (line 4932–4934). It walks sampled and storage elements through `forEachImageElement` but filters only with `IsNullTextureResource`. - **Why it matters:** a sampled TYPE 12 T# with format 0 or 0x1ff reaches `DecodeTextureResource` there and throws `unsupported guest texture format`. The normal path accepts the same T# as null. It does not affect the default configuration, which builds image records, but the sampled-consumer split is incomplete. - **Suggested fix:** in that branch, use `binding.kind == DescriptorKind::SampledImage ? IsNullSampledTextureResource(words) : IsNullTextureResource(words)`. This matches line 4962. It could also use `firstLayerWords`, as the record path does. 2. **`agc_driver_graphics` exceeds the 30 s limit.** It took 34.5 s here, and the AMD CI comment reports 82.9 s with validation layers. The PR adds only a few mock `ShaderResources` constructions, so the test was already slow before this change. I did not time it on `main`, so this is not counted against the PR. It is still worth splitting the test eventually. ## Not verified - **Console behaviour:** I did not check what the console returns when it samples a T# with an unset format. The debt entry already records this as unmeasured. - **Title runs:** the title runs (Neptunia ReVerse on GTX 1650 and RX 9070 XT) and the Windows validation runs were reported by participants. I did not reproduce them; no title was launched. - **Validation layer on this machine:** I did not rerun the validation-layer comparison myself. The script's comparison over 757 tests shows no new `VUID-` lines. - **GCN mode:** `IsNullSampledTextureResource` reads the raw word-1 bits 20–28 without GCN remapping. I did not exercise the GCN-guest path. <!-- anyps5-bots job=1922 head=e1eda1a2aedf73874ea2e28bc2e981a8ef0fac94 -->
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!10556
No description provided.