Skip to content

fix(agc): serve views of arrays past maxImageArrayLayers from their viewed slices - #6772

Merged
adriadam10 merged 4 commits into
boykopovar:mainfrom
XairRrR:fix/storage-array-window
Oct 20, 2026
Merged

adriadam10 merged 4 commits into
boykopovar:mainfrom
XairRrR:fix/storage-array-window

Conversation

@XairRrR

@XairRrR XairRrR commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

A PS5 texture array may hold up to 8192 layers; Vulkan devices allow fewer (maxImageArrayLayers is 2048 on NVIDIA). A storage view of such an array created the whole array's image anyway: vkCreateImage with more layers than the device allows is invalid (VUID-VkImageCreateInfo-arrayLayers-02256), and a shader store into a layer the device did not back faults the GPU.

Uncharted: Legacy of Thieves Collection (PPSA05684, #4001) binds a 16x16 R8G8B8A8_UNORM array (kStandard64KB, 2 mips) of up to 7809 layers as a storage image, in windows of a few hundred to 2048 slices (for example layers 1536..3200, created as a 3201-layer image). A few minutes into its orphanage chapter the device was lost: Xid 109 CTX SWITCH TIMEOUT, then VK_EXT_device_fault reported write invalid at a page-aligned address. The validation layer named the cause (arrayLayers (3201) exceeds the maxArrayLayers (2048)).

ArrayLayerWindow (TextureTiling.cpp) describes the viewed slices [baseArray, depthOrLastArray] as an array of their own, starting at the first viewed slice, when the whole array is past the limit. A non-XOR swizzle does not depend on the slice index, so those slices detile exactly as in the whole array. cachedStorageTexture uses it for every storage view and cachedTexture for every sampled view; a 3D volume is not an array and a 2D image is one layer whatever its last array field holds, so both pass unchanged. A view whose slices alone exceed the limit, a view of an XOR swizzle whose equation mixes in the slice, and any other Texture or StorageTexture image past the limit throw instead of creating an invalid image. The sampled lookup throws before it reads the surface: the same menu samples that array through image-table T#s whose views span 2689 to 8065 slices, and reading and snapshotting the whole surface (~8 MB) before the Texture constructor refused it cost ~55 ms per frame on the async queue.

#6481 checks sampled image-table entries against the device's image limits before reading them; this serves the views that fit from their slices (sampled and storage) and refuses the rest at the lookup. If #6481 lands first, its layer check should see the windowed descriptor (ArrayLayerWindow) so a fitting view of a larger array is not refused.

Tested

  • Linux (Arch, kernel 7.2.9), RTX 4070 Ti SUPER, driver 615.78.08.
  • agc_driver_graphics: ArrayLayerWindow rebases a 3201-layer view at slice 1536 to 1665 slices at base + 1536 * layerBytes with the same slice layout, keeps an array within the limit, rebases a linear array, refuses a window wider than the limit, an XOR swizzle and a cube, and passes a volume deeper than the limit and a 2D image with a large last-array field unchanged.
  • New agc_driver_image_array_window_past_layer_limit: a compute shader samples (image_sample_lz) and loads (image_load) slices 8100-8102 of an 8103-layer 1D array and reads exactly those slices; before this change the sampled lookup threw "a texture array with more layers than maxImageArrayLayers is not implemented". A view of all 8103 layers is refused with the window's error on a device whose limit is lower.
  • Related tests pass: agc_driver_graphics, agc_driver_image_one_dimensional_array, agc_driver_image_gather_one_dimensional_array, agc_driver_image_store_array_through_volume, agc_driver_array_layer_target, agc_driver_layered_volume_draw, agc_driver_depth_plane_sampling, agc_driver_depth_plane_guest_layers; conventions and test registration checks pass.
  • Uncharted: Legacy of Thieves Collection (PPSA05684) main menu on the local integration build (main + open PRs), RTX 4070 Ti SUPER, NVIDIA 615.78.08, three 60 s menu-only runs: 8.74 / 8.87 / 9.00 fps with this commit against 4.93-7.12 without it; the "keeps the snapshot path" fallback went from 19-30 per run to 0, async-queue resource completion from 72.6 to 1.7-1.8 ms per frame. The menu frames are unchanged (and match builds from before fix(agc): serve views of arrays past maxImageArrayLayers from their viewed slices #6772).
  • All agc_ tests pass except agc_driver_store_over_untracked, which fails on unchanged main on this machine too.
  • Uncharted: Legacy of Thieves Collection (PPSA05684, Uncharted: Legacy of Thieves Collection (PPSA05684) on Linux / NVIDIA #4001), orphanage chapter, automated run with the same slice window applied: no device loss in 16 minutes (it was lost within 1 to 15 minutes before); the storage view windows were served from their slices.

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
  • 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
  • Unblocks: PPSA05684 Uncharted: Legacy of Thieves Collection (PPSA05684) on Linux / NVIDIA #4001
  • GPUs tested: NVIDIA RTX 4070 Ti SUPER, driver 615.78.08, Linux
  • AI-assisted: yes

@XairRrR
XairRrR force-pushed the fix/storage-array-window branch from 80d33f9 to dfeb3d8 Compare October 16, 2026 11:26
@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6718 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp L1103
PR 6820 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp L1103

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 1368 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4040 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 4448 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5441 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5499 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5500 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 5925 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
docs/dev/ARCHITECTURE.md
PR 6044 docs/dev/ARCHITECTURE.md
PR 6146 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6177 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6187 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6192 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6194 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6197 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6209 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6223 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6235 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6280 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6340 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6412 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
docs/dev/ARCHITECTURE.md
PR 6481 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6498 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6548 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6682 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6808 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6937 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ARCHITECTURE.md
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ARCHITECTURE.md
PR 6960 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6970 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6971 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 6972 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 6977 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp
PR 7002 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7048 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7085 core/libs/prx/libSceAgcDriver/Graphics/include/TextureTiling.hpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7332 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7484 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7514 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7604 core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
PR 7618 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp
docs/dev/ARCHITECTURE.md
PR 7644 docs/dev/ARCHITECTURE.md
PR 7668 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7684 docs/dev/ARCHITECTURE.md
PR 7689 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 7862 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
core/libs/prx/libSceAgcDriver/tests/Graphics.cpp
PR 7948 core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp
PR 8099 core/libs/prx/libSceAgcDriver/tests/Graphics.cpp

@github-actions github-actions Bot added docs agc libSceAgc* labels Oct 16, 2026

@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.

Reviewed the storage-array windowing path. The code limits the requested slice window to maxImageArrayLayers, derives its guest base from the original array geometry, and rejects thick/non-array and slice-dependent XOR cases before creating the view. The layout regression checks the rebased address, slice count and mip offset, and the validation report identifies the original oversized Vulkan image. I found no blocking issue.

@Dextroid17

Copy link
Copy Markdown
Contributor

@XairRrR thanks for this. One regression: storage views of 3D volumes deeper than 2048 texels now throw. They worked before this PR.

AGC graphics: a storage image with more layers than maxImageArrayLayers that is not a 1D or 2D array is not implemented

Cause: StorageArrayWindow returns early only when depthOrLastArray < maxArrayLayers (core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp:439). For a k3D descriptor, depthOrLastArray is depth minus one, not a last array slice: DescribeSurface makes the image imageDepth = depthOrLastArray + 1 with imageLayers = 1. Vulkan requires arrayLayers to be 1 for a 3D image and limits its depth by maxImageDimension3D (4096 on lavapipe), not by maxImageArrayLayers (2048). A volume 2049 to 4096 deep is therefore a valid image, but it now fails at the next Require. cachedStorageTexture calls StorageArrayWindow for every storage image binding, so by reading this covers any storage use of such a volume, not only the case I ran. The PR description lists "a volume" among the refused cases, and the new unit test checks that rejection (reject(... volume ..., "not a 1D or 2D array")), but a volume this deep was not an invalid image.

Minimal fix: let volumes pass through unchanged.

core/libs/prx/libSceAgcDriver/Graphics/src/TextureTiling.cpp:439

    if (viewed.depthOrLastArray < maxArrayLayers || viewed.dimension == TextureDimension::k3D) return viewed;

core/libs/prx/libSceAgcDriver/tests/TextureTiling.cpp:408

        Require(StorageArrayWindow(volume, 2048).baseAddress == volume.baseAddress && StorageArrayWindow(volume, 2048).depthOrLastArray == volume.depthOrLastArray, "a volume is not an array");

Repro: I copied tests/execution/ImageStoreArrayThroughVolume.cpp and changed Depth from 2 to 2049, with an 8 MiB guest block to hold it. It is the same compute store of a 2D-array view through a linear 3D volume descriptor, and it checks the same 32 stored texels and that the bytes past the volume are unchanged.

tree deep-volume probe (depth 2049) agc_driver_graphics
PR head dfeb3d8 3/3 fail, error above 3/3 pass
head with ShaderResources.cpp + Texture.cpp taken from the merge base 3f171d0 3/3 pass, all 32 texels correct not run
head + the two suggestions above 3/3 pass 3/3 pass

Everything else checked out:

  • Your new test passes 3/3 on head and fails 3/3 with the production change reverted and StorageArrayWindow stubbed to return its input ("must start at its first viewed slice").
  • Merged with main at 16a0f50, agc_driver_graphics passes 3/3. It still merges cleanly (git merge-tree) with main at c842491.
  • check_conventions.py passes.

I did not check whether any shipped title binds a 3D storage volume this deep. The validation layer isn't installed here, so I make no VUID claims, including for the 2D-array view of the 2049-deep image on the merge-base files.

Setup: Linux, lavapipe Mesa 26.2.4 (LLVM 23.1.1), ctest -V --no-tests=error -R '^agc_driver_graphics$', probe run directly, head dfeb3d8.

AI-assisted: yes

@XairRrR

XairRrR commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@Dextroid17 thanks, you're right: a volume's depthOrLastArray is its depth, bounded by maxImageDimension3D, so a 2049-4096 deep volume was a valid image and must not be refused. Pushed 7d5a751 with your two suggestions: StorageArrayWindow returns a k3D descriptor unchanged, and the test now checks that a volume deeper than the limit keeps its descriptor (the "not a 1D or 2D array" rejection is tested with a cube instead). The creation guards in Texture/StorageTexture check geometry.imageLayers, which is 1 for a 3D image, so they were not affected.

AI-assisted: yes

@savvaniss

Copy link
Copy Markdown
Contributor

Intel and AMD Windows data, from GPUs on both sides of the limit.

Windows 11 Pro 26300, WinLibs GCC 15.2.0 r7, Release, every execution test built, ANYPS5_NO_SHADER_CACHE=1, serial CTest, main 47a266cf9. Intel UHD Graphics 770 (8086:a780, 32-wide subgroups), driver 32.0.101.7088. AMD Radeon RX 9070 XT (1002:7550, 64-wide subgroups), driver 32.0.31041.1004, with VkCache emptied first.

Reported maxImageArrayLayers: UHD 770 2048 (as on NVIDIA, so arrays past it take the new path), RX 9070 XT 8192 (the PS5 maximum, so the new path is never needed there).

UHD 770 RX 9070 XT
This head 7d5a75149 merged into main: the 16 tests built from tests/Graphics.cpp and tests/TextureTiling.cpp, ×3 pass pass

There is no without-run: this PR's TextureTiling.cpp test doesn't compile against main.

Full CTest (--parallel 4) with six open PRs merged into main (#6638, #6604, #6014, #6773, #6772, #6725): the same failures as main alone on both GPUs, nothing new. main alone: UHD 770 1392 of 1398, RX 9070 XT 1396 of 1398. The failures are image tables (#6647) and sample_multisample_target (#6971) on Intel, and quad_pixel_mask (#6255) and layered_volume_vertex_no_gpl (#4768) on AMD.

AI-assisted: yes (Claude Code)

@XairRrR XairRrR changed the title fix(agc): serve storage views of arrays past maxImageArrayLayers from their viewed slices fix(agc): serve views of arrays past maxImageArrayLayers from their viewed slices Oct 17, 2026
@XairRrR

XairRrR commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

Pushed a95b44a: sampled views now use the same layer window as storage views (StorageArrayWindow is renamed ArrayLayerWindow).

While testing the earlier head on Uncharted: Legacy of Thieves Collection (PPSA05684), the main menu lost about a third of its frame rate. It samples a 16x16 array of up to ~8000 layers through image-table views of 2689 to 8065 slices. The sampled lookup read and snapshotted the whole surface (~8 MB) before the Texture constructor refused it, about 17 times a frame. Now a view that fits is served from its slices, and one that does not is refused before anything is read. New test: agc_driver_image_array_window_past_layer_limit. Menu fps and the updated test list are in the description.

AI-assisted: yes

@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line needs rebase Conflicts with main, rebase needed labels Oct 18, 2026
@XairRrR
XairRrR force-pushed the fix/storage-array-window branch from a95b44a to 5a04013 Compare October 18, 2026 21:22
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 18, 2026
@XairRrR

XairRrR commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and added 04bc0ee. main's new agc_depth_copy_kept_bytes (from ea02128) builds its storage image on mockContext(), which left maxImageArrayLayers at 0. That made this PR's layer check reject the 8x8 image. The mock now reports 2048 layers, as real devices do. All agc_ tests pass except agc_driver_bda_device, which also fails on plain main on this machine. The conventions check passes.

AI-assisted: yes

@XairRrR
XairRrR force-pushed the fix/storage-array-window branch from 5a04013 to 04bc0ee Compare October 19, 2026 00:26
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
… their viewed slices

A PS5 array may hold up to 8192 layers; Vulkan devices allow fewer (2048 on
NVIDIA). A storage view of such an array created its whole image, with more
layers than the device allows: vkCreateImage is then invalid
(VUID-VkImageCreateInfo-arrayLayers-02256) and a store into a layer the device
did not back faults the GPU. Uncharted: Legacy of Thieves Collection (PPSA05684) views a 16x16 RGBA8
array of up to 7809 layers in slices of a few hundred to 2048 in its
orphanage chapter, which lost the device (Xid 109, write invalid) a few minutes in.

StorageArrayWindow describes the viewed slices as an array of their own
starting at the first viewed slice when the whole array is past the limit;
a non-XOR swizzle does not depend on the slice index, so the slices detile
alike. Views whose slices alone exceed the limit, XOR swizzles that mix in
the slice, and any other image past the limit now throw instead of creating
an invalid image.

AI-assisted: yes
A volume's depthOrLastArray is its depth, bounded by maxImageDimension3D,
not by maxImageArrayLayers: a 2049 to 4096 deep volume is a valid image
and threw since the window was introduced. Reported by Dextroid17.

AI-assisted: yes
… their viewed slices

The sampled lookup kept the whole array's layer count: a texture over an
array of more than maxImageArrayLayers layers read and snapshotted the
whole surface and then threw in the Texture constructor, on every lookup,
even when the descriptor viewed a few slices. A menu that samples a
16x16 array of up to 8065 layers through its image tables spent
~55 ms per frame reading those surfaces only to reject them.

cachedTexture now applies the window the storage path uses
(StorageArrayWindow, renamed ArrayLayerWindow since both paths use it):
a view whose slices fit the limit is served as an array of its own
starting at its first slice, and a view whose slices alone exceed the
limit throws before anything is read. A 2D image is one layer whatever
its last array field holds and is no longer refused by the storage path.

agc_driver_image_array_window_past_layer_limit samples and loads three
slices at 8100-8102 of an 8103-layer 1D array (before: "a texture array
with more layers than maxImageArrayLayers is not implemented") and checks
that a view of all its layers is refused with the window's error on a
device whose limit is lower.

AI-assisted: yes
Texture and storage images now refuse more array layers than the
device's maxImageArrayLayers. The mock context left that limit at 0,
so agc_depth_copy_kept_bytes failed creating its 8x8 storage image.
Give it the 2048 layers real devices report.

AI-assisted: yes
@XairRrR
XairRrR force-pushed the fix/storage-array-window branch from 04bc0ee to f408eb7 Compare October 19, 2026 21:06
@XairRrR

XairRrR commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main 7866e7d (f408eb7). #7258 (merged) added ViewedArrayWindow, which narrows a sampled view that starts past slice 0 to its viewed slices when the swizzle allows. This PR's ArrayLayerWindow only acts on arrays past maxImageArrayLayers, and it runs first in cachedTexture and for storage views. The two now sit side by side in TextureTiling.cpp, and both sets of tests are kept. For a sampled view past the limit, the two give the same window. Where they differ, this PR refuses a slice-dependent XOR swizzle rather than keeping the whole array. If you'd rather keep a single function for sampled views, I can drop the sampled call from this PR and leave it to storage views. All 798 agc_ tests pass (Linux, RTX 4070 Ti SUPER), and so does the conventions check.

AI-assisted: yes

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 19, 2026
@adriadam10
adriadam10 merged commit e9a5a0c into boykopovar:main Oct 20, 2026
10 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Re-checked after the rebase onto main with #7258: ArrayLayerWindow only acts on arrays past maxImageArrayLayers and sits next to ViewedArrayWindow without overlapping it; both sets of tests are kept and the merge is clean. Merged.

@blawesom

Copy link
Copy Markdown
Contributor

agc_driver_image_array_window_past_layer_limit is red on my RADV stack since this merged — first full-suite run after the merge reached main (it came in through the stacked-merge window ending at b85d972f4).

image_sample_lz on a window of a 1D array past maxImageArrayLayers: thread 7 component 0 is 107.000000/255, expected 147/255 — deterministic across reruns, cold GPU (junction 30 °C), and unchanged with the shader cache cleared and with ANYPS5_NO_SHADER_CACHE=1.

AMD RX 9070 XT (RADV GFX1201), Mesa 26.2.4, CachyOS, kernel 7.2.9. @adriadam10's pre-merge recheck above was green — on which stack? If that was a different GPU or Mesa, this may be NAVI4x- or Mesa-version-specific, in the pattern of #7766/#7784 (which pass on AMD's Windows proprietary driver and fail on RADV here).

For transparency on the diagnosis path: the test did not exist on main before the merge (I first misread it as a fresh main regression and ran a bisect; the A/B at the pre-merge anchor exposed the test binary as stale from a later tree, since the target didn't exist at that checkout — so "newly arrived red", not a regression). No open issue mentions it; happy to file one with this data or run any narrower repro.

oneandonlydean pushed a commit that referenced this pull request Oct 22, 2026
WinLibs GCC 15.2.0 rejects the alignas(65536) static array that agc_driver_image_array_window_past_layer_limit added in #6772 (requested alignment '65536' exceeds object file maximum 8192), which stops a Windows build with every AGC execution test. Take a 64 KiB aligned 4 MiB span of a larger static array instead, as #6452 did for the indirect arguments block, and check its alignment at start.
EagleBearerYS pushed a commit to EagleBearerYS/AnyPS5 that referenced this pull request Oct 24, 2026
WinLibs GCC 15.2.0 rejects the alignas(65536) static array that agc_driver_image_array_window_past_layer_limit added in boykopovar#6772 (requested alignment '65536' exceeds object file maximum 8192), which stops a Windows build with every AGC execution test. Take a 64 KiB aligned 4 MiB span of a larger static array instead, as boykopovar#6452 did for the indirect arguments block, and check its alignment at start.

(cherry picked from commit ca55e46)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* docs 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