Skip to content

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

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
daviaaze:fix/agc-dcc-sliced-array-window
Oct 25, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
daviaaze:fix/agc-dcc-sliced-array-window

Conversation

@daviaaze

@daviaaze daviaaze commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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 Demon's Souls (PPSA01341) #1283 (target; in-game status unverified)
  • GPUs tested: AMD Radeon RX 6700 XT, RADV/Mesa, NixOS
  • AI-assisted: yes

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 23, 2026
@MarcZX10

Copy link
Copy Markdown
Contributor

The current conventions check is failing because the PR template still has Fixes: none unchecked. Please check that box (or name an issue if this change fixes one) and push/update the PR so the required check can pass. I confirmed this from the conventions run for head 8b41f3b0b9169577bf95878278974cda9a83296e; the other current checks shown are passing.

@klosixgaming-arch

Copy link
Copy Markdown
Contributor

Tested this change on Windows 11 with an NVIDIA GeForce RTX 5090 (driver 617.42) on AMD Ryzen 9 9950X3D.

Test Results

  • Clean merge on current origin/main (83462cc57ddecac5e5f3cdafafbe38d406e55953).
  • Built with MinGW-w64 GCC 15.2.0 (Release).
  • Negative test verification: Reverting TextureTiling.cpp's DCC guard to origin/main's baseline (if (!layered || viewed.baseArray == 0 || viewed.baseArray > viewed.depthOrLastArray || viewed.dccAddress != 0) return viewed;) fails as expected:
    AGC graphics: a view whose DCC keys read as stored is cut to its slices without metadata
    0% tests passed, 1 tests failed out of 1
    502 - agc_driver_graphics (Failed)
    
  • Positive test verification: With this PR applied, agc_driver_graphics passes cleanly (100% tests passed, 0 tests failed in 7.19s).
  • Regression suite:
    • agc_driver_mesh: Passed (1.24s)
    • agc_shader_memory: Passed (0.38s)
      All surrounding AGC subsystem tests passed cleanly.
  • Conventions check (tools/check_conventions.py): 0 findings, 0 errors.

Code review of the diff looks great. Narrowing sampled array windows to slice-swizzle boundaries and dropping DCC metadata when keys evaluate to Uncompressed avoids retaining multi-gigabyte uncut surfaces without compromising address calculation accuracy.

AI-assisted: yes. Written with AI assistance and reviewed by me.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 2434 docs/dev/debt/libSceAgcDriver.md
PR 4448 docs/dev/debt/libSceAgcDriver.md
PR 4449 docs/dev/debt/libSceAgcDriver.md
PR 5058 docs/dev/debt/libSceAgcDriver.md
PR 5372 docs/dev/debt/libSceAgcDriver.md
PR 5925 docs/dev/debt/libSceAgcDriver.md
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6223 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6273 docs/dev/debt/libSceAgcDriver.md
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6300 docs/dev/debt/libSceAgcDriver.md
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 6548 docs/dev/debt/libSceAgcDriver.md
PR 6549 docs/dev/debt/libSceAgcDriver.md
PR 6743 docs/dev/debt/libSceAgcDriver.md
PR 6808 docs/dev/debt/libSceAgcDriver.md
PR 6959 docs/dev/debt/libSceAgcDriver.md
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7256 docs/dev/debt/libSceAgcDriver.md
PR 7449 docs/dev/debt/libSceAgcDriver.md
PR 7505 docs/dev/debt/libSceAgcDriver.md
PR 7604 docs/dev/debt/libSceAgcDriver.md
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7910 docs/dev/debt/libSceAgcDriver.md
PR 8014 docs/dev/debt/libSceAgcDriver.md
PR 8223 docs/dev/debt/libSceAgcDriver.md
PR 8319 docs/dev/debt/libSceAgcDriver.md
PR 8520 docs/dev/debt/libSceAgcDriver.md
PR 8542 docs/dev/debt/libSceAgcDriver.md
PR 8592 docs/dev/debt/libSceAgcDriver.md
PR 8707 docs/dev/debt/libSceAgcDriver.md
PR 8874 docs/dev/debt/libSceAgcDriver.md
PR 8930 docs/dev/debt/libSceAgcDriver.md
PR 8998 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9020 docs/dev/debt/libSceAgcDriver.md
PR 9176 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9287 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9289 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9335 docs/dev/debt/libSceAgcDriver.md
PR 9356 docs/dev/debt/libSceAgcDriver.md
PR 9387 docs/dev/debt/libSceAgcDriver.md
PR 9393 docs/dev/debt/libSceAgcDriver.md
PR 9431 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9432 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9592 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9672 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9673 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9674 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9675 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9676 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9700 docs/dev/debt/libSceAgcDriver.md
PR 9748 docs/dev/debt/libSceAgcDriver.md
PR 9842 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9852 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9891 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9892 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9893 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9895 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 9897 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 9898 docs/dev/debt/libSceAgcDriver.md
PR 9904 docs/dev/debt/libSceAgcDriver.md
PR 9905 docs/dev/debt/libSceAgcDriver.md
PR 9906 docs/dev/debt/libSceAgcDriver.md
PR 9950 docs/dev/debt/libSceAgcDriver.md
PR 10049 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10193 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10194 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 10233 docs/dev/debt/libSceAgcDriver.md
PR 10435 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
docs/dev/debt/libSceAgcDriver.md
PR 10442 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 10940 docs/dev/debt/libSceAgcDriver.md

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@BKlaasWerkman

Copy link
Copy Markdown
Contributor

Windows run on NVIDIA and Intel, to go with the RADV one.

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2.0 r7, Release. NVIDIA GeForce RTX 3060 Ti (driver 617.42) and Intel Arc Graphics (Meteor Lake, driver 101.9150), selected with ANYPS5_GPU. Head 8b41f3b merged into main 938812d (clean merge). ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (1.4.363); no was not found but was requested line.

Tests: the 1230 of 2029 that tools/select_tests.py select picks for the PR's files, compared per test with a full run of the same main on the same GPU.

this PR compared with main
RTX 3060 Ti 1222 passed, 5 skipped, 3 failed same 3 failures (agc_driver_sample_order trio, #9056); no new or removed VUID-
Intel Arc 1200 passed, 28 skipped, 2 failed same 2 failures (agc_storage_write_back #10126, agc_driver_multisample_retirement #8604); no new or removed VUID-

agc_driver_graphics, which holds the changed tests/TextureTiling.cpp cases, passes on both. Intel Arc's agc_driver_alias_copy_label failed in the main run and passed here; it is intermittent on that device (#10199), so that is not this PR.

AI-assisted: yes (Claude Code)

@daviaaze
daviaaze force-pushed the fix/agc-dcc-sliced-array-window branch from 8b41f3b to 6d453d1 Compare October 23, 2026 17:29
@daviaaze
daviaaze requested a review from MarcZX10 October 23, 2026 19:52
@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line and removed unblocks title Names a title ID on the Unblocks line labels Oct 23, 2026
@daviaaze
daviaaze force-pushed the fix/agc-dcc-sliced-array-window branch 3 times, most recently from 6b0dacf to f7c5a43 Compare October 23, 2026 21:32
@adriadam10 adriadam10 self-assigned this Oct 23, 2026
@brummilab

Copy link
Copy Markdown

Tested on AMD under Windows: Radeon RX 6600 XT (Navi 23, 0x73ff), AMD driver 32.0.21045.16010, Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, Vulkan SDK 1.4.363. main 50757b01c and this PR (head f7c5a4348) merged onto it, same machine, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, the tests from the Tested section plus anything matching dcc (^(agc_driver_graphics|agc_driver_graphics_maps_fallback|agc_driver_mesh|agc_shader_memory|agc_driver_sample_order|agc_storage_write_back|agc_driver_multisample_retirement|agc_driver_alias_copy_label)$|dcc), each run on its own with VK_KHRONOS_VALIDATION_LOG_FILENAME so the layer's log confirms it loaded:

Tests Passed Layer loaded VUID- messages
main 15 15 10 0
this PR 15 15 10 0

The new TextureTiling.cpp checks run inside agc_driver_graphics, which passes. No new failures and no validation errors on either arm.

AI-assisted: yes

@daviaaze
daviaaze force-pushed the fix/agc-dcc-sliced-array-window branch from f7c5a43 to b166232 Compare October 25, 2026 17:45
@daviaaze

Copy link
Copy Markdown
Contributor Author

@MarcZX10 refreshed as requested: rebased onto current main b4d8e8bb3 (clean, head now b166232c7). check_conventions.py --base upstream/main passes. pr_overlap.py lists the same uncomparable files as the bot; the TextureTiling overlaps (#9431, #9432, #9672–#9676, #9842, #9891–#9893, #9895, #10435) are all PS4/GCN layout work and none touch DCC sampled-array windowing.

Same RX 6700 XT, main vs this PR, ctest -V, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation: agc_driver_graphics and agc_driver_graphics_maps_fallback pass 2/2 on both arms.

One correction to the VUID evidence, including mine: agc_driver_graphics_tests does not link or load the Vulkan loader (no libvulkan in ldd, no loader output with VK_LOADER_DEBUG=layer), so the validation layer cannot attach to it and "0 VUIDs" on either arm is vacuous for this test. I updated the Tested section to say so. If there is a target you want the VUID delta from that exercises this path on a real device, point me at it and I will run it on both arms.

The title-unblock claim stays unverified until an in-game A/B. Could you re-review, and could a maintainer allow the build/test jobs to run? On the previous head they were skipped.

@adriadam10
adriadam10 dismissed MarcZX10’s stale review October 25, 2026 18:12

Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.

@adriadam10
adriadam10 merged commit cceb6c3 into boykopovar:main Oct 25, 2026
11 of 12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

@MarcZX10 each point of your review is addressed on the current head b166232 (a rebase onto main b4d8e8bb3 with the same patch as f7c5a43): conventions pass, the description gives agc_driver_graphics on main and on the change on the same RX 6700 XT with the Khronos layer, ANYPS5_NO_SHADER_CACHE=1 and ANYPS5_REQUIRE_VULKAN=1, and Windows runs on NVIDIA, Intel and AMD from other contributors show no regressions. Checked the window arithmetic (slice-swizzle boundary 624 for slice 636, dccAddress dropped only when the whole-surface keys resolve to Uncompressed, base 0 and volumes unchanged), the title-descriptor test (fails without the change) and the TechnicalDebt line; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants