perf(agc): bind a one-layer 2D array table entry to the 2D texture of its surface #15710

Merged
hugodearaujo merged 4 commits from upstream-pr/15710 into main 2026-11-14 11:45:01 +00:00
hugodearaujo commented 2026-11-04 08:57:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by hugodearaujo on 2026-11-04T08:57:02Z.


What

Marvel's Spider-Man 2 (PPSA03016) binds its whole texture heap as one image table every frame: about 19,400 entries, but only about 9,300 distinct surfaces. Almost every texture is in the table twice, once through a 2D T# and once through a 2D-array T# with one slice (BASE_ARRAY = LAST_ARRAY = 0). The two T#s are equal except for the type field (word 3 bits 28-31: 9 and 13), and the shader samples the second one through a 2D-array instruction. cachedTexture keys textures by their words, so each surface got two images with the same Vulkan shape and the same texels. On this title one resolution of the table made 18,356 textures over 9,312 surfaces, 12,007 MiB of device memory, more than the sampled cache budget (6.1 to 7.7 GB there), so every resolution re-created thousands of textures it could not keep ([texture-cache]: 4,500 to 9,600 "used uncached" per 10 s).

resolveImageTables now pairs such entries before it resolves the table (arrayPartners): an entry whose shape is Image2DArray, whose T# is a one-slice 2D array, and whose words equal a 2D entry's words except for the type field binds that 2D entry's texture through a VK_IMAGE_VIEW_TYPE_2D_ARRAY view of the same image.

  • Texture::ArrayView() (new): a one-layer 2D-array view of a single-layer 2D texture, created on first use from the view the constructor made (same format, components, levels and minimum LOD). createFirstLayerView records it, so every texture constructor that makes a 2D view offers it; depth-plane textures do not, and their partners resolve as before.
  • The 2D entries resolve first, then the array entries, so the pairing does not depend on the order of the entries. A table with a pair is not remembered for reuse, as with #10256's substitutes.
  • An array entry whose 2D partner was rejected, or whose texture has no array view, resolves on its own as before. A T# that differs in anything but the type (swizzle, format, mip range, slices, address) is not paired.
  • The table write uses ArrayView() for those entries; the per-entry checks (bind: sampler pairing) run as for any entry.
  • [textures] counts the entries bound this way.
  • The image-table debt file gets an entry for the pairing's limits: only the type may differ, multi-slice arrays keep their own image, and a table with a pair is not remembered for reuse.

Related: #13796 does the same pairing for storage images (SurfaceKey); this one is for the sampled textures of an image table, which never go through the storage cache when they are block-compressed (all of this title's pairs).

Tested

Linux 7.2.11, AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Release.

  • New agc_driver_image_table_array_views: one compute shader with two image_sample_lz of one table (a 2D instruction reading the record the first keys buffer names, a 2D-array instruction at slice 0 reading the record the second names), 256-bit T#s. Cases: a 2D T# and a one-slice 2D-array T# of one surface (the array entry binds the 2D texture, both read the surface's texels, and both read the new texels after the guest rewrites the surface); an array T# over another surface; an array T# with another swizzle (red = constant 1); a two-slice array T# of the same surface. The last three must not pair and must read their own data.
    • with the pairing disabled (a local mutation: arrayPartners is not called, so no entry pairs): the first case fails with "the one-layer 2D array entry did not bind the 2D entry's texture (0 shared)"; with the change: passes. Repeated on main 5b1d381d5a.
  • Validation layer, paired (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1), ^agc_driver_image_table|^agc_driver_bindless_images: on main acf7ac208a 9 of 9 pass (one skipped, agc_driver_image_table_vouched_lookups), on main + this change 10 of 10; 0 VUID- lines and no "was not found but was requested" line in either log. The same on the Spider-Man stack below, and on main 5b1d381d5a + this change (9 pass, agc_driver_image_table_vouched_lookups skipped as on main, no VUID- line).
  • agc_driver_graphics, agc_driver_sampled_cache_budget* and agc_driver_storage_cache_budget* pass on main + this change.
  • Title: Marvel's Spider-Man 2 (PPSA03016 01.004.003), same script for every run (Cross every 30 s from 60 s, 300 s limit), on main 4f41f4c375 + #9969 + #8939 + #13646 + #15399 + #15555 + #15649 (needed to get past loading), each with my memory guard (it stops the game when the GPU's free VRAM and GTT both run low, or GTT alone does):
    • without #10256 and without this change (2 runs, plus 5 earlier runs of the same code with an extra log): the table's first resolution plus about 1,400 storage images for its dynamic-resolution variants fill the heap, and the guard stops the game at 148 to 154 s.
    • with #10256 (2 runs): past that point, but the table re-creates its overflow every frame: 1 to 2 presents per 10 s after the table, device-local heap use 16.1-16.2 GB, sampled textures up to 12 GB; one run stopped by the guard at 298 s (GTT down to 1.5 GB), the other at the 300 s limit.
    • with #10256 and this change (3 runs; a fourth run with a local table log shows the same table at 10,011 textures and 9,807 MiB): 5 to 10 presents per 10 s after the table, no guard stop; all three reach the title's next stop, a recompile refusal in another shader (GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x0000a5b0(...), at 197, 258 and 229 s. The run with the counter on bound 231,236 entries through the 2D texture of their surface.
  • Linux and Windows, by milescoviello (comment), Release, GCC 15.2: on Ubuntu 26.04.1 with an RTX 4070 Ti (NVIDIA 615.71.09), this head 418ca34d98 merged onto main b8194198cf, and on a Windows 11 VM with a GeForce GT 1030 (WinLibs GCC 15.2 UCRT), merged onto main 2d27859b05, agc_driver_image_table_array_views passes 3 of 3 runs.

Performance

Interval summaries (APS5_TRACE_SUMMARY_EVERY=10) from the runs above, the same 10-second slot after the table on both sides. 04cfe95c14 is the stack with #10256, and 6ce8f42b3f adds this change. Frame time after the table goes from 1 present per 10 s, at a p50 of 10.7 s, to 10 presents at a p50 of 1.0 s, because the table stops re-creating textures it cannot keep. No trace window was captured. This is a memory change, and these lines only show the re-creation thrash ending; they are not a frame-time claim for a steady scene.

{"commit":"04cfe95c14da","dirty":null,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 9070 XT (RADV GFX1201)","driver":"radv Mesa 26.2.6-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":8,"memory_mib":31192,"title_id":"PPSA03016","title":"Marvel's Spider-Man 2","content_version":"01.004.003","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":1835,"ms":10671.273},"interval_start_s":174.513,"interval_end_s":185.184,"presents":1,"frame_ms":{"p50":10671.273,"p90":10671.273,"p99":10671.273,"max":10671.273},"gpu_busy_ms_per_present":1139.130,"worker_busy_pct":{"queue worker 0x0":79.699,"queue worker 0x20":1.503,"queue worker 0x28":0.303},"top_phases_ms_per_frame":{"Driver.Packet":8680.541,"Driver.Packet.dispatch":8483.618,"Driver.Dispatch":8472.704,"Vulkan.Dispatch":8132.896,"Resources.Complete":8098.036,"Vulkan.Dispatch.shader_resources":8094.709,"GpuMutex.wait.other":587.312,"Graphics.Wait":241.944},"trace_dropped":false,"trace":""}
{"commit":"6ce8f42b3f7f","dirty":null,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 9070 XT (RADV GFX1201)","driver":"radv Mesa 26.2.6-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":8,"memory_mib":31192,"title_id":"PPSA03016","title":"Marvel's Spider-Man 2","content_version":"01.004.003","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":1884,"ms":10092.411},"interval_start_s":174.267,"interval_end_s":184.359,"presents":10,"frame_ms":{"p50":1003.481,"p90":1093.134,"p99":1093.134,"max":1093.134},"gpu_busy_ms_per_present":174.632,"worker_busy_pct":{"queue worker 0x0":99.156,"queue worker 0x20":5.604,"queue worker 0x28":1.255},"top_phases_ms_per_frame":{"Driver.Packet":1064.699,"Driver.Packet.dispatch":980.509,"Driver.Dispatch":978.884,"Vulkan.Dispatch":760.217,"Vulkan.Dispatch.shader_resources":745.887,"Resources.Complete":724.198,"Driver.Dispatch.capture_resources":148.226,"Driver.Packet.prepare_memory":38.041},"trace_dropped":false,"trace":""}

Checklist

  • Based on current main; no other open PR implements the same functions (#13796 pairs 2D and one-slice 2D-array storage images in the storage cache, not image table textures)
  • 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
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none (#10256 is in main)
  • Fixes: none
  • Unblocks: PPSA03016 #10195 (keeps its bindless table inside device memory; its next stop is a shader refusal)
  • GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.11; NVIDIA RTX 4070 Ti (Linux) and GeForce GT 1030 (Windows 11 VM), by milescoviello
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5151665832 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15710). Originally posted by [hugodearaujo](https://github.com/hugodearaujo) on 2026-11-04T08:57:02Z. --- ### What Marvel's Spider-Man 2 (PPSA03016) binds its whole texture heap as one image table every frame: about 19,400 entries, but only about 9,300 distinct surfaces. Almost every texture is in the table twice, once through a 2D T# and once through a 2D-array T# with one slice (`BASE_ARRAY` = `LAST_ARRAY` = 0). The two T#s are equal except for the type field (word 3 bits 28-31: 9 and 13), and the shader samples the second one through a 2D-array instruction. `cachedTexture` keys textures by their words, so each surface got two images with the same Vulkan shape and the same texels. On this title one resolution of the table made 18,356 textures over 9,312 surfaces, 12,007 MiB of device memory, more than the sampled cache budget (6.1 to 7.7 GB there), so every resolution re-created thousands of textures it could not keep (`[texture-cache]`: 4,500 to 9,600 "used uncached" per 10 s). `resolveImageTables` now pairs such entries before it resolves the table (`arrayPartners`): an entry whose shape is `Image2DArray`, whose T# is a one-slice 2D array, and whose words equal a 2D entry's words except for the type field binds that 2D entry's texture through a `VK_IMAGE_VIEW_TYPE_2D_ARRAY` view of the same image. - `Texture::ArrayView()` (new): a one-layer 2D-array view of a single-layer 2D texture, created on first use from the view the constructor made (same format, components, levels and minimum LOD). `createFirstLayerView` records it, so every texture constructor that makes a 2D view offers it; depth-plane textures do not, and their partners resolve as before. - The 2D entries resolve first, then the array entries, so the pairing does not depend on the order of the entries. A table with a pair is not remembered for reuse, as with #10256's substitutes. - An array entry whose 2D partner was rejected, or whose texture has no array view, resolves on its own as before. A T# that differs in anything but the type (swizzle, format, mip range, slices, address) is not paired. - The table write uses `ArrayView()` for those entries; the per-entry checks (`bind`: sampler pairing) run as for any entry. - `[textures]` counts the entries bound this way. - The image-table debt file gets an entry for the pairing's limits: only the type may differ, multi-slice arrays keep their own image, and a table with a pair is not remembered for reuse. Related: #13796 does the same pairing for storage images (`SurfaceKey`); this one is for the sampled textures of an image table, which never go through the storage cache when they are block-compressed (all of this title's pairs). ### Tested Linux 7.2.11, AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Release. - New `agc_driver_image_table_array_views`: one compute shader with two `image_sample_lz` of one table (a 2D instruction reading the record the first keys buffer names, a 2D-array instruction at slice 0 reading the record the second names), 256-bit T#s. Cases: a 2D T# and a one-slice 2D-array T# of one surface (the array entry binds the 2D texture, both read the surface's texels, and both read the new texels after the guest rewrites the surface); an array T# over another surface; an array T# with another swizzle (red = constant 1); a two-slice array T# of the same surface. The last three must not pair and must read their own data. - with the pairing disabled (a local mutation: `arrayPartners` is not called, so no entry pairs): the first case fails with "the one-layer 2D array entry did not bind the 2D entry's texture (0 shared)"; with the change: passes. Repeated on `main` 5b1d381d5a. - Validation layer, paired (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`), `^agc_driver_image_table|^agc_driver_bindless_images`: on `main` acf7ac208a 9 of 9 pass (one skipped, `agc_driver_image_table_vouched_lookups`), on `main` + this change 10 of 10; 0 `VUID-` lines and no "was not found but was requested" line in either log. The same on the Spider-Man stack below, and on `main` 5b1d381d5a + this change (9 pass, `agc_driver_image_table_vouched_lookups` skipped as on `main`, no `VUID-` line). - `agc_driver_graphics`, `agc_driver_sampled_cache_budget*` and `agc_driver_storage_cache_budget*` pass on `main` + this change. - Title: Marvel's Spider-Man 2 (PPSA03016 01.004.003), same script for every run (Cross every 30 s from 60 s, 300 s limit), on `main` 4f41f4c375 + #9969 + #8939 + #13646 + #15399 + #15555 + #15649 (needed to get past loading), each with my memory guard (it stops the game when the GPU's free VRAM and GTT both run low, or GTT alone does): - without #10256 and without this change (2 runs, plus 5 earlier runs of the same code with an extra log): the table's first resolution plus about 1,400 storage images for its dynamic-resolution variants fill the heap, and the guard stops the game at 148 to 154 s. - with #10256 (2 runs): past that point, but the table re-creates its overflow every frame: 1 to 2 presents per 10 s after the table, device-local heap use 16.1-16.2 GB, sampled textures up to 12 GB; one run stopped by the guard at 298 s (GTT down to 1.5 GB), the other at the 300 s limit. - with #10256 and this change (3 runs; a fourth run with a local table log shows the same table at 10,011 textures and 9,807 MiB): 5 to 10 presents per 10 s after the table, no guard stop; all three reach the title's next stop, a recompile refusal in another shader (`GetImageResource dword 0 is not a valid runtime value; chain: ReadConstBuffer@pc=0x0000a5b0(...`), at 197, 258 and 229 s. The run with the counter on bound 231,236 entries through the 2D texture of their surface. - **Linux and Windows, by milescoviello** ([comment](https://github.com/boykopovar/AnyPS5/pull/15710#issuecomment-6779121552)), Release, GCC 15.2: on Ubuntu 26.04.1 with an RTX 4070 Ti (NVIDIA 615.71.09), this head `418ca34d98` merged onto `main` `b8194198cf`, and on a Windows 11 VM with a GeForce GT 1030 (WinLibs GCC 15.2 UCRT), merged onto `main` `2d27859b05`, `agc_driver_image_table_array_views` passes 3 of 3 runs. #### Performance Interval summaries (`APS5_TRACE_SUMMARY_EVERY=10`) from the runs above, the same 10-second slot after the table on both sides. `04cfe95c14` is the stack with #10256, and `6ce8f42b3f` adds this change. Frame time after the table goes from 1 present per 10 s, at a p50 of 10.7 s, to 10 presents at a p50 of 1.0 s, because the table stops re-creating textures it cannot keep. No trace window was captured. This is a memory change, and these lines only show the re-creation thrash ending; they are not a frame-time claim for a steady scene. ```json {"commit":"04cfe95c14da","dirty":null,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 9070 XT (RADV GFX1201)","driver":"radv Mesa 26.2.6-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":8,"memory_mib":31192,"title_id":"PPSA03016","title":"Marvel's Spider-Man 2","content_version":"01.004.003","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":1835,"ms":10671.273},"interval_start_s":174.513,"interval_end_s":185.184,"presents":1,"frame_ms":{"p50":10671.273,"p90":10671.273,"p99":10671.273,"max":10671.273},"gpu_busy_ms_per_present":1139.130,"worker_busy_pct":{"queue worker 0x0":79.699,"queue worker 0x20":1.503,"queue worker 0x28":0.303},"top_phases_ms_per_frame":{"Driver.Packet":8680.541,"Driver.Packet.dispatch":8483.618,"Driver.Dispatch":8472.704,"Vulkan.Dispatch":8132.896,"Resources.Complete":8098.036,"Vulkan.Dispatch.shader_resources":8094.709,"GpuMutex.wait.other":587.312,"Graphics.Wait":241.944},"trace_dropped":false,"trace":""} {"commit":"6ce8f42b3f7f","dirty":null,"env":{"APS5_PAD_INPUT_FILE":"<path>","APS5_TRACE_DIR":"<path>","APS5_TRACE_SUMMARY_EVERY":"10"},"gpu":"AMD Radeon RX 9070 XT (RADV GFX1201)","driver":"radv Mesa 26.2.6-arch1.1","os":"Linux 7.2.11-arch1-1","cpu":"AMD Ryzen 7 9800X3D 8-Core Processor","cpu_threads":8,"memory_mib":31192,"title_id":"PPSA03016","title":"Marvel's Spider-Man 2","content_version":"01.004.003","resolution":"3840x2160","window":{"spec":"summary_every 10","first_present":1884,"ms":10092.411},"interval_start_s":174.267,"interval_end_s":184.359,"presents":10,"frame_ms":{"p50":1003.481,"p90":1093.134,"p99":1093.134,"max":1093.134},"gpu_busy_ms_per_present":174.632,"worker_busy_pct":{"queue worker 0x0":99.156,"queue worker 0x20":5.604,"queue worker 0x28":1.255},"top_phases_ms_per_frame":{"Driver.Packet":1064.699,"Driver.Packet.dispatch":980.509,"Driver.Dispatch":978.884,"Vulkan.Dispatch":760.217,"Vulkan.Dispatch.shader_resources":745.887,"Resources.Complete":724.198,"Driver.Dispatch.capture_resources":148.226,"Driver.Packet.prepare_memory":38.041},"trace_dropped":false,"trace":""} ``` ### Checklist - [x] Based on current `main`; no other open PR implements the same functions (#13796 pairs 2D and one-slice 2D-array storage images in the storage cache, not image table textures) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none (#10256 is in `main`) - [x] Fixes: none - [x] Unblocks: PPSA03016 #10195 (keeps its bindless table inside device memory; its next stop is a shader refusal) - [x] GPUs tested: AMD Radeon RX 9070 XT, RADV Mesa 26.2.6, Linux 7.2.11; NVIDIA RTX 4070 Ti (Linux) and GeForce GT 1030 (Windows 11 VM), by milescoviello - [x] AI-assisted: yes
Superseabas commented 2026-11-04 15:58:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Superseabas on 2026-11-04T15:58:16Z.

Review: APPROVED


Head 2c8d89549f merged onto current main b11c7bf84f (clean merge, local only): code read, red/green check and a run on two Windows GPUs, NVIDIA and AMD's Windows driver, which the description and the CI runs don't cover. I don't have the title, so the memory and frame numbers are not reproduced here.

Windows 11 Home 10.0.26200, Ryzen 7 7700X, WinLibs GCC 16.2.0 (x86_64-ucrt-posix-seh, r3), Release, BUILD_TESTING=ON. ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ctest -R '^(agc_driver_image_table.*|agc_driver_bindless_images.*|agc_driver_sampled_cache_budget.*|agc_driver_storage_cache_budget.*)$', ANYPS5_GPU selecting the device (confirmed by Selected GPU):

GPU Driver main merged
NVIDIA GeForce RTX 5070 Ti (10de:2c05) 621.01 15 of 15 16 of 16
AMD Radeon Graphics, Ryzen 7 7700X iGPU (1002:164e) AMD 26.10.2 15 of 15 16 of 16
  • No VUID- lines and no missing-layer line on either side. agc_driver_image_table_vouched_lookups runs here (not skipped) and passes.
  • agc_driver_image_table_array_views and agc_driver_graphics: 3 of 3 on each GPU. The new test prints image table array view tests passed.
  • Red check: the merged tree with only ShaderResources.cpp taken back from main fails the new test on both GPUs with the one-layer 2D array entry did not bind the 2D entry's texture (0 shared).
  • check_conventions.py --base main passes on the merge.

Read through the change:

  • arrayPartners pairs only a Image2DArray-shaped entry whose T# decodes as a one-slice 2D array (baseArray and depthOrLastArray 0) with a Image2D-shaped 2D entry whose eight words match once word 3's type field is masked, and only when their depth-compare flags agree. Written (storage) entries and null or undecodable T#s are left out.
  • The 2D entries resolve first, so a partner's table.elementTextures slot is set before its array entry looks it up. A partner that was rejected or substituted (max()), or a texture without an array view, falls back to the entry's own resolution.
  • bind goes through place, which always appends to textures, so arrayViewTextures.insert(textures.size() - 1u) names the slot that entry just took. A rejected bind returns a message and nothing is recorded.
  • Only the image-table write path (binding.flags != 0) reads arrayViewTextures. The compact VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE path doesn't, and table entries don't go through it.
  • ArrayView() is created once under its own mutex from the constructor's 2D view info: same format, components and level range, layerCount 1, its min LOD kept, pNext replaced by a sampled-only usage. It is destroyed in release() with the other views. A 2D-array view of a single-layer 2D image is valid Vulkan, and the validation layer agrees on both drivers.
  • The debt entry states the remaining limits: the table holding a pair is not reused, and other differences still get their own image.

I found nothing to change.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5771485673 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15710#pullrequestreview-5771485673). Originally posted by [Superseabas](https://github.com/Superseabas) on 2026-11-04T15:58:16Z. **Review:** APPROVED --- Head `2c8d89549f` merged onto current `main` `b11c7bf84f` (clean merge, local only): code read, red/green check and a run on two Windows GPUs, NVIDIA and AMD's Windows driver, which the description and the CI runs don't cover. I don't have the title, so the memory and frame numbers are not reproduced here. Windows 11 Home 10.0.26200, Ryzen 7 7700X, WinLibs GCC 16.2.0 (`x86_64-ucrt-posix-seh`, r3), Release, `BUILD_TESTING=ON`. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ctest -R '^(agc_driver_image_table.*|agc_driver_bindless_images.*|agc_driver_sampled_cache_budget.*|agc_driver_storage_cache_budget.*)$'`, `ANYPS5_GPU` selecting the device (confirmed by `Selected GPU`): | GPU | Driver | `main` | merged | |---|---|---|---| | NVIDIA GeForce RTX 5070 Ti (`10de:2c05`) | 621.01 | 15 of 15 | 16 of 16 | | AMD Radeon Graphics, Ryzen 7 7700X iGPU (`1002:164e`) | AMD 26.10.2 | 15 of 15 | 16 of 16 | - No `VUID-` lines and no missing-layer line on either side. `agc_driver_image_table_vouched_lookups` runs here (not skipped) and passes. - `agc_driver_image_table_array_views` and `agc_driver_graphics`: 3 of 3 on each GPU. The new test prints `image table array view tests passed`. - Red check: the merged tree with only `ShaderResources.cpp` taken back from `main` fails the new test on both GPUs with `the one-layer 2D array entry did not bind the 2D entry's texture (0 shared)`. - `check_conventions.py --base main` passes on the merge. Read through the change: - `arrayPartners` pairs only a `Image2DArray`-shaped entry whose T# decodes as a one-slice 2D array (`baseArray` and `depthOrLastArray` 0) with a `Image2D`-shaped 2D entry whose eight words match once word 3's type field is masked, and only when their depth-compare flags agree. Written (storage) entries and null or undecodable T#s are left out. - The 2D entries resolve first, so a partner's `table.elementTextures` slot is set before its array entry looks it up. A partner that was rejected or substituted (`max()`), or a texture without an array view, falls back to the entry's own resolution. - `bind` goes through `place`, which always appends to `textures`, so `arrayViewTextures.insert(textures.size() - 1u)` names the slot that entry just took. A rejected `bind` returns a message and nothing is recorded. - Only the image-table write path (`binding.flags != 0`) reads `arrayViewTextures`. The compact `VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE` path doesn't, and table entries don't go through it. - `ArrayView()` is created once under its own mutex from the constructor's 2D view info: same format, components and level range, `layerCount` 1, its min LOD kept, `pNext` replaced by a sampled-only usage. It is destroyed in `release()` with the other views. A 2D-array view of a single-layer 2D image is valid Vulkan, and the validation layer agrees on both drivers. - The debt entry states the remaining limits: the table holding a pair is not reused, and other differences still get their own image. I found nothing to change. AI-assisted: yes (Claude Code)
BunnyFl commented 2026-11-04 16:08:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T16:08:21Z.

Review: APPROVED


@hugodearaujo this adds the Windows and AMD proprietary run that the description doesn't have. The pairing reads right to me, and it passes on the RX 9070 XT here.

Reading:

  • arrayPartners (core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5514) masks only the type field of word 3 (:5533). It pairs an Image2DArray entry with baseArray == 0 and depthOrLastArray == 0 to a 2D entry with the same words and the same depth-compare flag. Written (storage) entries and undecodable T#s are skipped.
  • The paired entry goes through bind (:5579-5601), which runs the same sampler checks as for any entry. bind only returns empty after place pushes the texture (:5573, :5599). arrayViewTextures.insert(textures.size() - 1u) (:5682) then names that entry's own texture slot.
  • A table with a pair sets reusable = false (:5650, :5679), as #10256's substitutes do.
  • Texture::ArrayView() (core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:1274) is created lazily under arrayMutex, and the release path destroys it next to the sRGB views (:1314-1315).

What I ran: head 2c8d89549f merged onto main b11c7bf84f (merge a83f093357), Windows 11, WinLibs GCC, Release, AMD Radeon RX 9070 XT, driver 32.0.32015.12012, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation. Your set, ^agc_driver_image_table|^agc_driver_bindless_images:

  • Merge: 10 of 10 pass, including agc_driver_image_table_array_views. main: 9 of 9 pass. Neither log has a VUID-, SYNC-HAZARD or missing-layer line, and agc_driver_image_table_vouched_lookups ran rather than skipped on this GPU.
  • Mutation: with partners always empty in resolveImageTables (:5647), agc_driver_image_table_array_views fails with the one-layer 2D array entry did not bind the 2D entry's texture (0 shared), as your description says.

One question, not blocking: ArrayView() builds its view from arrayInfo with a fresh pNext chain, holding only the sampled-usage struct and, when it is nonzero, VkImageViewMinLodCreateInfoEXT (Texture.cpp:1278-1287). createFirstLayerView keeps only the min LOD from the original chain (:1209-1216). Does any 2D texture constructor put something else in that chain, such as a usage restriction or a YCbCr or ASTC struct, that the array view would then lack? If none does today, that's fine. A line in the debt entry would keep it from being missed later.

Not checked here: the Spider-Man 2 runs, which need your stack, and the perf numbers, which come from your machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5771623955 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15710#pullrequestreview-5771623955). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-04T16:08:21Z. **Review:** APPROVED --- @hugodearaujo this adds the Windows and AMD proprietary run that the description doesn't have. The pairing reads right to me, and it passes on the RX 9070 XT here. **Reading:** - `arrayPartners` (`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5514`) masks only the type field of word 3 (`:5533`). It pairs an `Image2DArray` entry with `baseArray == 0` and `depthOrLastArray == 0` to a 2D entry with the same words and the same depth-compare flag. Written (storage) entries and undecodable T#s are skipped. - The paired entry goes through `bind` (`:5579-5601`), which runs the same sampler checks as for any entry. `bind` only returns empty after `place` pushes the texture (`:5573`, `:5599`). `arrayViewTextures.insert(textures.size() - 1u)` (`:5682`) then names that entry's own texture slot. - A table with a pair sets `reusable = false` (`:5650`, `:5679`), as #10256's substitutes do. - `Texture::ArrayView()` (`core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp:1274`) is created lazily under `arrayMutex`, and the release path destroys it next to the sRGB views (`:1314-1315`). **What I ran:** head `2c8d89549f` merged onto `main` `b11c7bf84f` (merge `a83f093357`), Windows 11, WinLibs GCC, Release, AMD Radeon RX 9070 XT, driver 32.0.32015.12012, with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`. Your set, `^agc_driver_image_table|^agc_driver_bindless_images`: - Merge: 10 of 10 pass, including `agc_driver_image_table_array_views`. `main`: 9 of 9 pass. Neither log has a `VUID-`, `SYNC-HAZARD` or missing-layer line, and `agc_driver_image_table_vouched_lookups` ran rather than skipped on this GPU. - Mutation: with `partners` always empty in `resolveImageTables` (`:5647`), `agc_driver_image_table_array_views` fails with `the one-layer 2D array entry did not bind the 2D entry's texture (0 shared)`, as your description says. One question, not blocking: `ArrayView()` builds its view from `arrayInfo` with a fresh `pNext` chain, holding only the sampled-usage struct and, when it is nonzero, `VkImageViewMinLodCreateInfoEXT` (`Texture.cpp:1278-1287`). `createFirstLayerView` keeps only the min LOD from the original chain (`:1209-1216`). Does any 2D texture constructor put something else in that chain, such as a usage restriction or a YCbCr or ASTC struct, that the array view would then lack? If none does today, that's fine. A line in the debt entry would keep it from being missed later. Not checked here: the Spider-Man 2 runs, which need your stack, and the perf numbers, which come from your machine.
BunnyFl commented 2026-11-04 21:14:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T21:14:10Z.

Review: APPROVED


@hugodearaujo re-checked at dce73ab2b5, still approved.

git range-diff against my approval of 2c8d89549f: your commit is unchanged, and dce73ab2b5 is the merge of main that resolved the ShaderResources.cpp conflict next to #15741. I built and ran that merge rather than reading the resolution only.

What I ran

Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.12012), this head merged cleanly onto main b611e634f7 (5241ad6f5a), with ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation and ctest -V:

  • The 10 tests from my first review (agc_driver_image_table*, agc_driver_bindless_images, and the new agc_driver_image_table_array_views): 10 of 10 pass. No VUID- or SYNC-HAZARD lines, and no was not found but was requested by env var VK_INSTANCE_LAYERS line.
  • Control: the same tree with core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp from main fails agc_driver_image_table_array_views and passes the other 9, again with no VUID- or SYNC-HAZARD lines.

Overlap

I left this out of my first review; tools/pr_overlap.py --branch on this head:

  • #15563 (XatiX) rewrites the entry decoding in resolveImageTables (resource, guestBytes, firstLayer) at the same lines (core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5691 on main) where this PR adds the one-layer array choice. Whichever lands second has to redo its change on the other.
  • #15659 (XatiX) adds a counter to the same ImageTableReuseCounts (core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp:161 on main) and to its return in ImageTableReuses. A mechanical conflict only.
  • #13796 (thuanquang) applies the same idea to storage images: one image for a 2D surface and its one-slice 2D array descriptor. Worth checking that the two agree on which descriptors count as one-slice.
  • 81 PRs conflict with main, and the tool could not compare them. Of those, 15 change the functions this PR touches; apart from #13796 and #10743 (per-layer storage views of a 2D array), they are larger reworks of the same functions (GPU image tables and descriptor heaps: #7642, #9508, #10193, #13928, #13929; table reuse: #6223, #6340; others: #6280, #6481, #6804, #10049, #10497, #15059).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5775897725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15710#pullrequestreview-5775897725). Originally posted by [BunnyFl](https://github.com/BunnyFl) on 2026-11-04T21:14:10Z. **Review:** APPROVED --- @hugodearaujo re-checked at `dce73ab2b5`, still approved. `git range-diff` against my approval of `2c8d89549f`: your commit is unchanged, and `dce73ab2b5` is the merge of `main` that resolved the `ShaderResources.cpp` conflict next to #15741. I built and ran that merge rather than reading the resolution only. ## What I ran Windows 11 Pro 10.0.26300, WinLibs GCC 15.2, Release, AMD Radeon RX 9070 XT (driver 32.0.32015.12012), this head merged cleanly onto `main` `b611e634f7` (`5241ad6f5a`), with `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` and `ctest -V`: - The 10 tests from my first review (`agc_driver_image_table*`, `agc_driver_bindless_images`, and the new `agc_driver_image_table_array_views`): 10 of 10 pass. No `VUID-` or `SYNC-HAZARD` lines, and no `was not found but was requested by env var VK_INSTANCE_LAYERS` line. - Control: the same tree with `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp` from `main` fails `agc_driver_image_table_array_views` and passes the other 9, again with no `VUID-` or `SYNC-HAZARD` lines. ## Overlap I left this out of my first review; `tools/pr_overlap.py --branch` on this head: - **#15563** (XatiX) rewrites the entry decoding in `resolveImageTables` (`resource`, `guestBytes`, `firstLayer`) at the same lines (`core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp:5691` on `main`) where this PR adds the one-layer array choice. Whichever lands second has to redo its change on the other. - **#15659** (XatiX) adds a counter to the same `ImageTableReuseCounts` (`core/libs/prx/libSceAgcDriver/Graphics/include/ShaderResources.hpp:161` on `main`) and to its `return` in `ImageTableReuses`. A mechanical conflict only. - **#13796** (thuanquang) applies the same idea to storage images: one image for a 2D surface and its one-slice 2D array descriptor. Worth checking that the two agree on which descriptors count as one-slice. - 81 PRs conflict with `main`, and the tool could not compare them. Of those, 15 change the functions this PR touches; apart from #13796 and #10743 (per-layer storage views of a 2D array), they are larger reworks of the same functions (GPU image tables and descriptor heaps: #7642, #9508, #10193, #13928, #13929; table reuse: #6223, #6340; others: #6280, #6481, #6804, #10049, #10497, #15059).
gabichuuuuu commented 2026-11-08 15:48:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-08T15:48:41Z.

Review: COMMENTED


Ran cbc54ed039 merged on main 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1 and VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Khronos validation layer 1.4.368), ctest -R '^agc_driver_image_table' -V:

main change, 2 runs each
NVIDIA 21/21 22/22 twice
Intel 21/21 22/22 twice
  • The PR's ImageTableArrayViews.cpp reads ImageTableReuseCounts::arrayViewsShared, which this PR adds, so there's no run of the tests without the change.
  • The layer was inserted in every test that opens a device (agc_driver_image_table_cache open none). No log has was not found but was requested by env var VK_INSTANCE_LAYERS, and no log on either side has a VUID-. To be sure validation messages reach these logs, the same layer with best practices on printed 28 BestPractices- warnings into an agc_driver_recorder log on each GPU.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5818523503 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/15710#pullrequestreview-5818523503). Originally posted by [gabichuuuuu](https://github.com/gabichuuuuu) on 2026-11-08T15:48:41Z. **Review:** COMMENTED --- Ran `cbc54ed039` merged on `main` 302864d48c on Windows 11 x64 (WinLibs GCC 15.2), on an NVIDIA laptop GPU (Turing, driver 621) and an Intel iGPU (driver 101.70xx), with `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1` and `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (Khronos validation layer 1.4.368), `ctest -R '^agc_driver_image_table' -V`: | | `main` | change, 2 runs each | |---|---|---| | NVIDIA | 21/21 | 22/22 twice | | Intel | 21/21 | 22/22 twice | - The PR's `ImageTableArrayViews.cpp` reads `ImageTableReuseCounts::arrayViewsShared`, which this PR adds, so there's no run of the tests without the change. - The layer was inserted in every test that opens a device (`agc_driver_image_table_cache` open none). No log has `was not found but was requested by env var VK_INSTANCE_LAYERS`, and no log on either side has a `VUID-`. To be sure validation messages reach these logs, the same layer with best practices on printed 28 `BestPractices-` warnings into an `agc_driver_recorder` log on each GPU. AI-assisted: yes.
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!15710
No description provided.