test(agc): clamp the array window test's layer to the slices its view covers #8969

Merged
Chuk49 merged 1 commit from upstream-pr/8969 into main 2026-10-24 12:33:28 +00:00
Chuk49 commented 2026-10-21 07:50:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Chuk49 on 2026-10-21T07:50:44Z.


What

agc_driver_image_array_window_past_layer_limit (from #6772) fails on RADV, 3 of 3 runs:

AGC graphics: image_sample_lz on a window of a 1D array past maxImageArrayLayers: thread 7 component 0 is 107.000000/255, expected 147/255

The failure is in the test's expectation, not in the driver.

The second Run(*device, 0) views slices 0 through 8102 of the 1D array. On a device whose maxImageArrayLayers is 2048 (NVIDIA, lavapipe), ArrayLayerWindow refuses that view and the test accepts the refusal. RADV's limit is higher than 8102: the driver creates the full array (layers=8103 in the log) and the dispatch runs.

The expected texel still clamps the layer coordinate to Layers - 1, which only fits the three-slice window of the first run. Thread 7 samples layer 5.0. The view covers it, so the hardware returns layer 5, which is (5·8+0)·9+3 mod 256 = 107. The test expected layer 2 instead: (2·8+0)·9+3 = 147.

The expectation now clamps to the slices the view covers, LastArray - baseArray:

  • For the first run (base 8100) that is still 2, so the expected values do not change.
  • On devices that refuse the second run, nothing changes.

On RADV, neither run reaches ArrayLayerWindow's past-limit branch: the first run is served by the viewed-slice window. So that branch is still covered only on devices with a lower limit.

Tested

Arch Linux (Omarchy), kernel 7.2.5, GCC 16.2.1, Release, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=ON, base main 71401e331.

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -j1 -V -R 'image_array_window|array_layer|layer_limit'. That is 2 tests: agc_driver_image_array_window_past_layer_limit and agc_driver_array_layer_target. Three runs each:

Run 1 Run 2 Run 3
main 1/2 1/2 1/2
this PR 2/2 2/2 2/2
  • main: agc_driver_image_array_window_past_layer_limit fails every time, with the message above.
  • This PR: the log shows both runs executing. The first is sampled array view ... slices 8100..8102 served from its viewed slices; the second is a layers=8103 texture.
  • Validation: the loader inserted VK_LAYER_KHRONOS_validation in both tests of every run (VK_LOADER_DEBUG=layer). No log contains was not found but was requested by env var VK_INSTANCE_LAYERS, and neither side logs a VUID- line.

Not run on a device with maxImageArrayLayers 2048. The change cannot alter that path: the refusal is caught before the expectation is checked.

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
  • Fixes: none
  • Unblocks: none
  • GPUs tested: AMD Radeon 8060S (Strix Halo, RDNA 3.5), RADV STRIX_HALO, Mesa 26.2.2, Arch Linux
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4948243583 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8969). Originally posted by [Chuk49](https://github.com/Chuk49) on 2026-10-21T07:50:44Z. --- ### What `agc_driver_image_array_window_past_layer_limit` (from #6772) fails on RADV, 3 of 3 runs: ``` AGC graphics: image_sample_lz on a window of a 1D array past maxImageArrayLayers: thread 7 component 0 is 107.000000/255, expected 147/255 ``` The failure is in the test's expectation, not in the driver. The second `Run(*device, 0)` views slices 0 through 8102 of the 1D array. On a device whose `maxImageArrayLayers` is 2048 (NVIDIA, lavapipe), `ArrayLayerWindow` refuses that view and the test accepts the refusal. RADV's limit is higher than 8102: the driver creates the full array (`layers=8103` in the log) and the dispatch runs. The expected texel still clamps the layer coordinate to `Layers - 1`, which only fits the three-slice window of the first run. Thread 7 samples layer 5.0. The view covers it, so the hardware returns layer 5, which is (5·8+0)·9+3 mod 256 = 107. The test expected layer 2 instead: (2·8+0)·9+3 = 147. The expectation now clamps to the slices the view covers, `LastArray - baseArray`: - For the first run (base 8100) that is still 2, so the expected values do not change. - On devices that refuse the second run, nothing changes. On RADV, neither run reaches `ArrayLayerWindow`'s past-limit branch: the first run is served by the viewed-slice window. So that branch is still covered only on devices with a lower limit. ### Tested Arch Linux (Omarchy), kernel 7.2.5, GCC 16.2.1, Release, `BUILD_TESTING=ON`, `ANYPS5_ENABLE_SPIRV_TOOLS=ON`, base `main` `71401e331`. `ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ctest --test-dir build -j1 -V -R 'image_array_window|array_layer|layer_limit'`. That is 2 tests: `agc_driver_image_array_window_past_layer_limit` and `agc_driver_array_layer_target`. Three runs each: | | Run 1 | Run 2 | Run 3 | |---|---|---|---| | `main` | 1/2 | 1/2 | 1/2 | | this PR | 2/2 | 2/2 | 2/2 | - **`main`:** `agc_driver_image_array_window_past_layer_limit` fails every time, with the message above. - **This PR:** the log shows both runs executing. The first is `sampled array view ... slices 8100..8102 served from its viewed slices`; the second is a `layers=8103` texture. - **Validation:** the loader inserted `VK_LAYER_KHRONOS_validation` in both tests of every run (`VK_LOADER_DEBUG=layer`). No log contains `was not found but was requested by env var VK_INSTANCE_LAYERS`, and neither side logs a `VUID-` line. Not run on a device with `maxImageArrayLayers` 2048. The change cannot alter that path: the refusal is caught before the expectation is checked. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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](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 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: AMD Radeon 8060S (Strix Halo, RDNA 3.5), RADV STRIX_HALO, Mesa 26.2.2, Arch Linux - [x] AI-assisted: yes
jotitadev commented 2026-10-21 21:56:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-21T21:56:35Z.

Review: COMMENTED


A run on a device with maxImageArrayLayers 2048, the case the description notes was not covered.

Machine: Ubuntu 26.04, i7-8700, GCC 15.2, Release, BUILD_TESTING=ON. NVIDIA GeForce RTX 3070 (driver 595.99.02, maxImageArrayLayers 2048) and lavapipe (Mesa 26.0.3, LLVM 21.1.8, also 2048). Head 0ad445efd applied onto main 0c6a5bd59 (3-way, clean). ANYPS5_NO_SHADER_CACHE=1, -j1 --timeout 60.

agc_driver_image_array_window_past_layer_limit RTX 3070 lavapipe
main pass pass
this PR pass pass

On both devices the test passes on main and with this PR: the limit is 2048, so the second Run is refused and the first is served from its viewed slices (-V shows a window of a 1D array past maxImageArrayLayers was sampled and loaded from its viewed layers). The expectation change only moves the clamp for the covered-slice window, which these devices do not reach, so there is no behaviour difference here. This confirms the change is safe on maxImageArrayLayers 2048 hardware; the red-to-green it fixes still needs a device with a higher limit (RADV), as the description says.

Not run: a device with a limit above 8102, Windows, the Khronos validation layer (not installed on this host).

GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux) and lavapipe (Mesa 26.0.3), Ubuntu 26.04

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5606736577 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/8969#pullrequestreview-5606736577). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-21T21:56:35Z. **Review:** COMMENTED --- A run on a device with `maxImageArrayLayers` 2048, the case the description notes was not covered. **Machine:** Ubuntu 26.04, i7-8700, GCC 15.2, Release, `BUILD_TESTING=ON`. NVIDIA GeForce RTX 3070 (driver 595.99.02, `maxImageArrayLayers` 2048) and lavapipe (Mesa 26.0.3, LLVM 21.1.8, also 2048). Head `0ad445efd` applied onto `main` `0c6a5bd59` (3-way, clean). `ANYPS5_NO_SHADER_CACHE=1`, `-j1 --timeout 60`. | `agc_driver_image_array_window_past_layer_limit` | RTX 3070 | lavapipe | |---|---|---| | `main` | pass | pass | | this PR | pass | pass | On both devices the test passes on `main` and with this PR: the limit is 2048, so the second `Run` is refused and the first is served from its viewed slices (`-V` shows `a window of a 1D array past maxImageArrayLayers was sampled and loaded from its viewed layers`). The expectation change only moves the clamp for the covered-slice window, which these devices do not reach, so there is no behaviour difference here. This confirms the change is safe on `maxImageArrayLayers` 2048 hardware; the red-to-green it fixes still needs a device with a higher limit (RADV), as the description says. Not run: a device with a limit above 8102, Windows, the Khronos validation layer (not installed on this host). GPUs tested: NVIDIA GeForce RTX 3070 (595.99.02, Linux) and lavapipe (Mesa 26.0.3), Ubuntu 26.04 Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
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!8969
No description provided.