fix(agc): serve sampled DCC array views from their viewed slices #9961

Merged
daviaaze merged 1 commit from upstream-pr/9961 into main 2026-10-25 20:53:47 +00:00
daviaaze commented 2026-10-23 00:23:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by daviaaze on 2026-10-23T00:23:42Z.


What

Targets Demon’s Souls PPSA01341 (#1283); title-unblock status remains unverified pending an in-game A/B. On current main, ViewedArrayWindow returns the entire array when dccAddress != 0 (TextureTiling.cpp:471). For the title’s sampled 1024x1024 format-22 view of slice 636 in a 637-slice Z_64KB_X array, the unreadable DCC keys mean texels are read as stored, but the snapshot still spans all 637 slices: 2,671,771,648 bytes.

This fix starts an XOR-swizzled window at the last slice-swizzle boundary before the view, and cuts a DCC-bearing view only when whole-surface keys resolve to Uncompressed. It drops DCC metadata on that window. The regression test decodes the title’s exact descriptor words and checks that the window covers slices 624..636 (54,525,952 bytes), preserves the Z_X texel addresses, and preserves the key decision. The descriptor itself is not modified.

Tested

  • Linux, NixOS; AMD Radeon RX 6700 XT with RADV/Mesa.
  • ctest -V -R '^agc_driver_graphics(_maps_fallback)?$' passed 2/2 on current main b4d8e8bb3b14a9ce97caeca6e4466b02836ee813 and on PR head b166232c722f77e3616dbed5e24a579e8be7d3bf (rebased onto that main), same machine, with ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan-ValidationLayers 1.4.363 on the layer path). agc_driver_graphics_tests does not link or load the Vulkan loader (no libvulkan in ldd; no loader output under VK_LOADER_DEBUG=layer), so the validation layer never attaches to these tests on either arm and the VUID comparison is 0 against 0 by construction, not evidence.
  • The R_X boundary case shows the distinction: on current main, a view at base slice 1530 keeps the full array; this fix windows from slice 1520. For the title’s DCC descriptor, the current main guard likewise keeps all 637 slices.
  • In-game A/B has not been completed; title-unblock status remains unverified.

Checklist

  • Based on current main; no other open PR implements this exact change
  • One topic per PR; follow-ups go in a new PR
  • No added code comments except technical-debt documentation
  • No new silent fallback or unimplemented path
  • No investigation notes, screenshots or logs in the repository
  • Generic behavior, not title-specific
  • Depends on: none
  • Fixes: none
  • Unblocks: PPSA01341 #1283 (target; in-game status unverified)
  • GPUs tested: AMD Radeon RX 6700 XT, RADV/Mesa, NixOS
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4975958489 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9961). Originally posted by [daviaaze](https://github.com/daviaaze) on 2026-10-23T00:23:42Z. --- ### What Targets Demon’s Souls PPSA01341 (#1283); title-unblock status remains unverified pending an in-game A/B. On current `main`, `ViewedArrayWindow` returns the entire array when `dccAddress != 0` (`TextureTiling.cpp:471`). For the title’s sampled 1024x1024 format-22 view of slice 636 in a 637-slice Z_64KB_X array, the unreadable DCC keys mean texels are read as stored, but the snapshot still spans all 637 slices: 2,671,771,648 bytes. This fix starts an XOR-swizzled window at the last slice-swizzle boundary before the view, and cuts a DCC-bearing view only when whole-surface keys resolve to `Uncompressed`. It drops DCC metadata on that window. The regression test decodes the title’s exact descriptor words and checks that the window covers slices 624..636 (54,525,952 bytes), preserves the Z_X texel addresses, and preserves the key decision. The descriptor itself is not modified. ### Tested - Linux, NixOS; AMD Radeon RX 6700 XT with RADV/Mesa. - `ctest -V -R '^agc_driver_graphics(_maps_fallback)?$'` passed 2/2 on current `main` `b4d8e8bb3b14a9ce97caeca6e4466b02836ee813` and on PR head `b166232c722f77e3616dbed5e24a579e8be7d3bf` (rebased onto that `main`), same machine, with `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Vulkan-ValidationLayers 1.4.363 on the layer path). `agc_driver_graphics_tests` does not link or load the Vulkan loader (no `libvulkan` in `ldd`; no loader output under `VK_LOADER_DEBUG=layer`), so the validation layer never attaches to these tests on either arm and the VUID comparison is 0 against 0 by construction, not evidence. - The R_X boundary case shows the distinction: on current `main`, a view at base slice 1530 keeps the full array; this fix windows from slice 1520. For the title’s DCC descriptor, the current `main` guard likewise keeps all 637 slices. - In-game A/B has not been completed; title-unblock status remains unverified. ### Checklist - [x] Based on current `main`; no other open PR implements this exact change - [x] One topic per PR; follow-ups go in a new PR - [x] No added code comments except technical-debt documentation - [x] No new silent fallback or unimplemented path - [x] No investigation notes, screenshots or logs in the repository - [x] Generic behavior, not title-specific - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: PPSA01341 #1283 (target; in-game status unverified) - [x] GPUs tested: AMD Radeon RX 6700 XT, RADV/Mesa, NixOS - [x] AI-assisted: yes
MarcZX10 commented 2026-10-23 05:33:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-23T05:33:50Z.

Review: DISMISSED


The new test and reported hardware coverage are relevant: the description records a Windows main-vs-change negative control from another contributor, while your Linux RX 6700 XT run reports the focused graphics test passing under the Khronos layer. Local current-main conventions, test registration and diff checks pass. I could not run the GPU test in this environment.

Please refresh from current main before this can be considered ready: check_main_sync.py reports 1 ahead /259 behind, with ShaderResources.cpp and docs/dev/debt/libSceAgcDriver.md changed on both sides since merge base (clean merge). After refreshing, run the same focused agc_driver_graphics_tests on current main and the change on the same RX 6700 XT, with ctest -V, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, and ANYPS5_REQUIRE_VULKAN=1; compare for new VUIDs. The body currently reports the change-side validation run but does not give a matching current-main run or VUID delta. Keep the title-unblock status as unverified until an in-game A/B reaches the reported point. This is for the repository's current-main and AGC validation requirements, not queue size.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5624321847 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9961#pullrequestreview-5624321847). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-23T05:33:50Z. **Review:** DISMISSED --- The new test and reported hardware coverage are relevant: the description records a Windows main-vs-change negative control from another contributor, while your Linux RX 6700 XT run reports the focused graphics test passing under the Khronos layer. Local current-main conventions, test registration and diff checks pass. I could not run the GPU test in this environment. Please refresh from current `main` before this can be considered ready: `check_main_sync.py` reports 1 ahead /259 behind, with `ShaderResources.cpp` and `docs/dev/debt/libSceAgcDriver.md` changed on both sides since merge base (clean merge). After refreshing, run the same focused `agc_driver_graphics_tests` on current main and the change on the same RX 6700 XT, with `ctest -V`, `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, and `ANYPS5_REQUIRE_VULKAN=1`; compare for new VUIDs. The body currently reports the change-side validation run but does not give a matching current-main run or VUID delta. Keep the title-unblock status as unverified until an in-game A/B reaches the reported point. This is for the repository's current-main and AGC validation requirements, not queue size.
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!9961
No description provided.