perf(agc): bind one texture for the dynamic-resolution variants of an image table surface #10256

Merged
Capmare merged 6 commits from upstream-pr/10256 into main 2026-11-04 04:48:19 +00:00
Capmare commented 2026-10-23 15:56:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Capmare on 2026-10-23T15:56:34Z.


What

A game that renders at a dynamic resolution keeps several descriptors of one surface in an image table, one per extent. The extent sets the pitch, so only the descriptor that matches the newest GPU write reads the memory in its layout. Today every descriptor builds its own texture from the same guest bytes.

  • variantRepresentatives groups the table's read-only elements by surface (address, bank xor, format, tile mode, dimension, mip range, layers). A group that holds more than one extent has a representative: the member whose extent matches the newest GPU write to the address (StorageTexture::LastWrite), else the extent of the active depth surface at the address (ActiveDepthExtent), else the largest accessible member.
  • The other members bind the representative's texture. If the representative is rejected, they are rejected with the message "the dynamic-resolution variant this entry borrows from was rejected".
  • A table that substitutes is not remembered for reuse. A borrowing entry reports the representative's extent to image_get_resinfo and to texel fetches; this is listed in docs/dev/debt/libSceAgcDriver.md.

Related: #6099 describes the storage cache holding several times the guest memory for dynamic resolution. This change does not touch the storage cache.

Tested

  • Linux (Rocky Linux 10.2), Release, BUILD_TESTING=ON, NVIDIA GeForce RTX 4070 SUPER, NVIDIA 615.71.09, ANYPS5_REQUIRE_VULKAN=1:
    • full ctest -j20 on head 9823e7ffe (main 88795ed44 merged in): 2384 tests, 1 fails: guest_math aborts. It aborts on main 88795ed44 too;
    • agc_driver_image_table_variants (new) covers the representative choice (newest write, active depth surface, largest accessible), the rejected representative, and what a borrowing entry reads and reports for size;
    • ctest -V -R ^agc_driver_image_table with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and ANYPS5_NO_SHADER_CACHE=1: 8 of 8 pass on the head, 7 of 7 on main, 0 VUID- errors in both (run on 8fb5807f5).
  • Windows 11, MinGW-w64 UCRT: agc_driver_image_table_variants passes on an RTX 4070 SUPER, a GTX 1650 SUPER and a Radeon RDNA2 iGPU (run by another contributor in the comments, on 8fb5807f5).
  • Marvel's Wolverine (PPSA03671), RTX 4070 SUPER, scripted menu input, captured with APS5_TRACE_FRAMES; numbers and digest are in the comment "Performance on the current base".
  • Not tested: other titles; Intel GPUs; macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file (none added)
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source (none added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none (related: #6099)
  • Unblocks: none
  • GPUs tested: NVIDIA GeForce RTX 4070 SUPER (Linux); NVIDIA GeForce RTX 4070 SUPER, NVIDIA GeForce GTX 1650 SUPER, AMD Radeon RDNA2 iGPU (Windows, reported in the comments)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4985537935 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10256). Originally posted by [Capmare](https://github.com/Capmare) on 2026-10-23T15:56:34Z. --- ### What A game that renders at a dynamic resolution keeps several descriptors of one surface in an image table, one per extent. The extent sets the pitch, so only the descriptor that matches the newest GPU write reads the memory in its layout. Today every descriptor builds its own texture from the same guest bytes. - `variantRepresentatives` groups the table's read-only elements by surface (address, bank xor, format, tile mode, dimension, mip range, layers). A group that holds more than one extent has a representative: the member whose extent matches the newest GPU write to the address (`StorageTexture::LastWrite`), else the extent of the active depth surface at the address (`ActiveDepthExtent`), else the largest accessible member. - The other members bind the representative's texture. If the representative is rejected, they are rejected with the message "the dynamic-resolution variant this entry borrows from was rejected". - A table that substitutes is not remembered for reuse. A borrowing entry reports the representative's extent to `image_get_resinfo` and to texel fetches; this is listed in `docs/dev/debt/libSceAgcDriver.md`. Related: #6099 describes the storage cache holding several times the guest memory for dynamic resolution. This change does not touch the storage cache. ### Tested - Linux (Rocky Linux 10.2), Release, `BUILD_TESTING=ON`, NVIDIA GeForce RTX 4070 SUPER, NVIDIA 615.71.09, `ANYPS5_REQUIRE_VULKAN=1`: - full `ctest -j20` on head 9823e7ffe (`main` 88795ed44 merged in): 2384 tests, 1 fails: `guest_math` aborts. It aborts on `main` 88795ed44 too; - `agc_driver_image_table_variants` (new) covers the representative choice (newest write, active depth surface, largest accessible), the rejected representative, and what a borrowing entry reads and reports for size; - `ctest -V -R ^agc_driver_image_table` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `ANYPS5_NO_SHADER_CACHE=1`: 8 of 8 pass on the head, 7 of 7 on `main`, 0 `VUID-` errors in both (run on 8fb5807f5). - Windows 11, MinGW-w64 UCRT: `agc_driver_image_table_variants` passes on an RTX 4070 SUPER, a GTX 1650 SUPER and a Radeon RDNA2 iGPU (run by another contributor in the comments, on 8fb5807f5). - Marvel's Wolverine (PPSA03671), RTX 4070 SUPER, scripted menu input, captured with `APS5_TRACE_FRAMES`; numbers and digest are in the comment "Performance on the current base". - Not tested: other titles; Intel GPUs; macOS. ### 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 (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file (none added) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none (related: #6099) - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4070 SUPER (Linux); NVIDIA GeForce RTX 4070 SUPER, NVIDIA GeForce GTX 1650 SUPER, AMD Radeon RDNA2 iGPU (Windows, reported in the comments) - [x] AI-assisted: yes
MarcZX10 commented 2026-10-24 21:34:54 +00:00 (Migrated from github.com)

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

Review: CHANGES_REQUESTED


Reviewed the updated head 411523eaab. The current diff passes repository conventions and git diff --check. I could not run the GPU execution suite here: this environment has neither vulkaninfo nor /dev/dri. The posted execution and title runs are pinned to d55c90c9f7, before this branch merged main, so please rerun the focused image-table test and Vulkan validation on this head and identify any baseline failures there. The performance label still needs the matched main/change summary records and trace_digest output (or traces), including steady state; the current Windows measurements stop at the title splash screen and do not include those artifacts. Finally, pairwise merge-tree against open PR #6340 conflicts in ShaderResources.cpp. Please coordinate and record the landing order, preserve both changes, then repeat the affected tests and performance capture on the final combined head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5640115776 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10256#pullrequestreview-5640115776). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T21:34:54Z. **Review:** CHANGES_REQUESTED --- Reviewed the updated head 411523eaab6aac26f2ba6d760b382f32bfa3e972. The current diff passes repository conventions and git diff --check. I could not run the GPU execution suite here: this environment has neither vulkaninfo nor /dev/dri. The posted execution and title runs are pinned to d55c90c9f7, before this branch merged main, so please rerun the focused image-table test and Vulkan validation on this head and identify any baseline failures there. The performance label still needs the matched main/change summary records and trace_digest output (or traces), including steady state; the current Windows measurements stop at the title splash screen and do not include those artifacts. Finally, pairwise merge-tree against open PR #6340 conflicts in ShaderResources.cpp. Please coordinate and record the landing order, preserve both changes, then repeat the affected tests and performance capture on the final combined head.
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!10256
No description provided.