Skip to content

fix(agc): write a single-slice 1D-array T# through a DIM 1D storage binding - #25151

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
birdmarty:fix/agc-1d-array-single-slice-storage
Nov 23, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
birdmarty:fix/agc-1d-array-single-slice-storage

Conversation

@birdmarty

@birdmarty birdmarty commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What

Allow a DIM 1D storage image binding over a single-slice 1D-array T# (BASE_ARRAY == lastArraySlice) by binding a 1D first-layer view of that slice.

Previously, ShaderResources::resolveImageBinding narrowed only a 2D storage binding over a 2D array to its base slice, so a DIM 1D storage binding over a 1D-array T# threw guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5). #23688 handles DIM 1D sampled reads and loads of 1D arrays (measured on gfx1036 to read slice BASE_ARRAY), while stores were not measured. When a 1D array has only one slice (baseArray == depthOrLastArray), a DIM 1D store can only address that slice, so narrowing it to a 1D first-layer view is unambiguous without a multi-slice hardware measurement. A 1D array with more than one slice still throws.

Changes

  • core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp: extend the storage binding's firstLayer check in ShaderResources::resolveImageBinding to accept DescriptorImageShape::Image1D over TextureDimension::k1DArray when resource.baseArray == resource.depthOrLastArray.
  • core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp: allow StorageTexture::createView to create a VK_IMAGE_VIEW_TYPE_1D first-layer view over a k1DArray surface.
  • core/libs/prx/libSceAgcDriver/tests/execution/ImageStoreLineThroughLineArraySlice.cpp: add agc_driver_image_store_line_through_line_array_slice, checking that a DIM 1D image_store through a single-slice 1D-array T# (32_SINT and 32_32_32_32_SINT) writes every texel and leaves trailing bytes untouched, and that the same store through a two-slice 1D array is still refused.
  • docs/dev/debt/changes/fix-agc-1d-array-single-slice-storage.md: document 1D stores to single-slice 1D arrays and that multi-slice 1D arrays remain refused pending hardware measurement.

Tested

Windows 11 Pro (build 26300), Intel Core i9-9900K, MinGW-w64 GCC 15.3.0, Release build with tests, AMD Radeon RX 6800 (vendor 0x1002, device 0x73bf, AMD proprietary driver 26.10.1 / Windows driver 32.0.21045.16010, Vulkan 1.4.315), based on origin/main e60b2f7.

Focused AGC image and shader memory tests (^agc_driver_image|^agc_shader_memory$) on main e60b2f7 and on this branch (1fbeda1), same machine and GPU, with ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1, VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (Vulkan SDK 1.4.363.0) and VK_LOADER_DEBUG=layer:

main e60b2f7 this change (1fbeda1)
Passed / skipped / failed 113 / 2 / 0 (115 total) 114 / 2 / 0 (116 total, adds agc_driver_image_store_line_through_line_array_slice)
Skipped (both) agc_driver_image_array_rows_past_layer_limit, agc_driver_image_array_window_past_layer_limit the same
Insert instance layer "VK_LAYER_KHRONOS_validation" 113 114
Missing validation layer errors 0 0
VUID- lines 0 0

Title test: Forza Horizon 5 (PPSA22327 v01.685.672, same machine): compute shader 0x7f5d100 writes a single-slice 1D-array T# (width 8, format 20, linear, slices 0..0, 1 mip) through a DIM 1D storage binding:

Not tested: multi-slice 1D arrays (still refused), other GPUs, Linux/macOS host builds, console hardware.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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
  • Fixes: none
  • Unblocks: PPSA22327 Forza Horizon 5 (PPSA22327) #25152
  • GPUs tested: AMD Radeon RX 6800 (vendor=0x1002, device=0x73bf), AMD proprietary driver 26.10.1 (Windows driver 32.0.21045.16010, Vulkan 1.4.315), Windows 11 Pro (build 26300); Khronos validation layer 1.4.363.0 on main and this change, 0 VUIDs
  • AI-assisted: yes

…inding

A storage image whose shader shape is 1D and whose T# is a 1D array was
refused with "guest storage texture dimension disagrees with the
shader's declared image shape (shape 0, dimension 5)": the storage path
narrowed only a 2D shape over a 2D array to its base slice. When the
1D array's base and last slices are equal, the access can only address
that slice, so the binding now uses a 1D first-layer view of it
(StorageTexture::createView gains the 1D view). A 1D array of more
than one slice still throws, since where a DIM 1D store lands there is
not measured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added unblocks title Names a title ID on the Unblocks line docs agc libSceAgc* labels Nov 21, 2026
@Doorriiaann

Copy link
Copy Markdown
Contributor

NVIDIA run: the new test passes and the image store and array tests do not regress.

Setup: RTX 3070 8 GB, NVIDIA 610.57.04, Ryzen 5 5600X, Debian 13 (kernel 6.12.115), GCC 13.3.0 Release, validation layer 1.4.335. Base is the merge-base e60b2f7, head is 1fbeda1. ANYPS5_GPU=NVIDIA ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer ctest -R '^(agc_driver_image_store_.*|agc_driver_image_array_.*|agc_shader_memory)$' -V, 3 runs each.

base this PR
agc_driver_image_store_line_through_line_array_slice (new) 3/3 pass
the other 14 tests (agc_driver_image_store_*, agc_driver_image_array_*, including _rows_past_layer_limit and _window_past_layer_limit, and agc_shader_memory) 42/42 pass 42/42 pass

Every run selects the RTX 3070; every Vulkan test's log shows the layer inserted, none reports it missing, and no log has a VUID- line.

AI-assisted: yes

@mihiii1337

Copy link
Copy Markdown
Contributor

Windows Intel check on a physical Intel UHD Graphics 8086:a78b with driver 31.0.101.5081, subgroup size 32, Windows 11 and WinLibs GCC 15.2.0 r7. I compared the direct parent e60b2f74ad with PR head 1fbeda1ffd. The baseline ran the PR's new test source unchanged against the baseline implementation.

CTest (prefix agc_driver_) Baseline PR
image_store_line_through_line_array_slice Failed at the dimension mismatch (shape 0, dimension 5) Passed
image_store_line_through_plane_array Passed Passed

The new test reached its final success marker after checking the full readback of both 32_SINT and 32_32_32_32_SINT and the expected rejection of the two-slice case. All four fresh processes confirmed the Intel adapter and Khronos validation layer 1.4.369. Vulkan was required and shader caching was disabled. There were no VUIDs or skips. AI-assisted testing.

@4le22io

4le22io commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

A Windows + NVIDIA run of the current head 1fbeda1. The earlier runs were AMD on Windows, NVIDIA on Linux and Intel on Windows. No regressions, and the new test passes.

System: Windows 11 Pro 10.0.26200, NVIDIA GeForce RTX 4060 (10de:2882, Ada), driver 621.01, Intel Core i5-12400F, WinLibs GCC 15.2.0 r7 (UCRT), Release, BUILD_TESTING=ON.

Trees, each a full build:

  • main 130814a;
  • main + 1fbeda1, merged with git merge --no-ff (clean merge, 4 files);
  • a control: this PR's tree with main's ShaderResources.cpp and Texture.cpp, so the new test runs against main's driver.

Run: ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation VK_LOADER_DEBUG=layer (Vulkan SDK 1.4.363.1), ctest -R '^(agc_driver_image.*|agc_shader_memory)$' -V (your Tested selection), 3 runs per tree:

tree tests result VUID Insert instance layer
main 115 115 pass, every run 0 113
this PR 116 116 pass, every run 0 114
control (main's driver + this PR's test) 116 115 pass, 1 fails, every run 0 114

With this PR, agc_driver_image_store_line_through_line_array_slice passes (1.2 s). In the control it stops at AGC graphics: guest storage texture dimension disagrees with the shader's declared image shape (shape 0, dimension 5), the refusal the PR removes. The neighbouring agc_driver_image_store_line_through_plane and ..._plane_array pass on all three trees.

ctest -R '^agc' -j 8 with the layer: 2072 tests on main and 2073 with this PR.

The layer was inserted 1886 times on main and 1887 with this PR. There are 0 was not found but was requested lines and 0 VUID- lines on both trees.

Not tested: a title, and multi-slice 1D arrays beyond the refusal case the new test already checks.

AI-assisted: yes (Claude Code). It merged the PR, ran the three builds and the test sets, and drafted and posted this comment.

@github-actions github-actions Bot added review queue Next in the maintainer review queue: checks pass, no open change request, no conflict and removed review queue Next in the maintainer review queue: checks pass, no open change request, no conflict labels Nov 21, 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 — no blocking findings

Nothing blocks this; the points below are optional.

What I ran

Reviewed head 1fbeda1ffd8be8c4e5eda298a8a8e7e12877dbb7. I did not run commands or tests; the test results below are author-reported. I read the changed lines in ShaderResources.cpp, Texture.cpp, ImageStoreLineThroughLineArraySlice.cpp, and fix-agc-1d-array-single-slice-storage.md, plus the storage-view call sites in ShaderResources.cpp and Texture.cpp.

Results

Check Result Note
Source review passed No concrete defect found in the reviewed changes.
Focused tests not run The reported RX 6800 results were not independently verified.
Console behavior not run The reported Forza Horizon 5 runs were not independently verified.

Negative control

Not run by me. The description reports that the new test failed against the unmodified implementation with a dimension mismatch.

Findings

Blocking

None.

Non-blocking

None.

Sources

The change permits first-layer storage views for a 1D array only when its base and last slices are equal, and selects a 1D Vulkan view for that case. The storage binding path carries this flag into view selection. ShaderResources.cpp at the reviewed head · Texture.cpp at the reviewed head

Not verified

I did not independently run the build, focused tests, convention checks, debt check, or title test. Other GPUs, host operating systems, console hardware, and multi-slice DIM 1D stores were not verified. All four changed files were reviewed; ShaderResources.cpp and Texture.cpp were read through the pinned repository reader because their full text was excluded from the review folder. No changed files were excluded from review.

To get this to a good state

Nothing is required. Optional: independently run the focused tests and confirm the reported hardware behavior.

@JJenkx

JJenkx commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Windows AMD run of head 1fbeda1ffd, merged onto main b7d463d438 (bd2baeb0d0, clean merge).

Setup: Windows 11 Enterprise 22621, WinLibs GCC 15.2 UCRT, Release, AMD Radeon RX 6700 XT, driver 32.0.21045.29003. ANYPS5_REQUIRE_VULKAN=1 (no fallback to a software device), ANYPS5_NO_SHADER_CACHE=1.

  • agc_driver_image_store_line_through_line_array_slice: all 1 pass in each of 3 runs (3 of 3), none skipped.

AI-assisted: yes.

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.

7 participants