Skip to content

Shader: query dimensions of 2D array image views - #1606

Merged
ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:codex/array-image-query-size
Nov 22, 2026
Merged

ItsNotRexed merged 3 commits into
ItsNotRexed:mainfrom
evilclanker9000:codex/array-image-query-size

Conversation

@evilclanker9000

@evilclanker9000 evilclanker9000 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as image_get_resinfo for 2D array views.

What and why

Translate SQ_RSRC_IMG_2D_ARRAY resource queries through the existing array image binding. The result has width, height, layer count and mip count. Array layer count stays constant across mip levels. The GPU fixture samples the dimensions of a 12-layer view and compares all four channels at every pixel. The plain 2D resinfo fixtures in #1402 and #1419 cover a different image type.

Tested

  • Native RDNA2 gfx1036 and a synthetic 19x11x5 image with three mips returned (19,11,5,3), (9,5,5,3) and (4,2,5,3).
  • On the earlier patch 3796cef5, the source-built fixture matched all 4,096 pixels on RTX 5080 (NVIDIA 616.92) and Radeon gfx1036 (32.0.21045.16010) on Windows. Binding the 2D image instead gave layer count 1 instead of 12 at all 4,096 pixels on both cards.
  • On the published 67c8ffe, the synthetic fixture is rejected by the translator in base 41f4482 and translates with binding 3, a three-component size and a mip-count query after the change. The GPU runner and shader checker Python tests passed 71/71. The SPIR-V differs from the earlier GPU-tested text because current main moves a descriptor-map read into the successful lookup branch. The subsequent 3c6380c commit restores an unrelated comment. Independent testing on the current head passed all 4,096 pixels on Radeon Pro V540 with RADV, and the full suite had the same pre-existing cs_w32_salu64 failure as main. The Python suite passed 510 tests with 2 skips.

Checklist

  • No game data, keys or decryption, including in reports.
  • The translator rule and how it was confirmed are in docs/design.md.

AI-assisted.

Array resource queries need the array at the descriptor index so the third component reports the view's layer count. Check the returned dimensions through a draw against the existing 12-layer texture.

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

Hardware run: RTX 5090 (621.24), Windows 11, this PR's tree, all six vk_*_test programs rebuilt from the same commit, LEONIDA_W64_EMULATE=1: 146/146 GPU tests pass, with the new one exact:

PASS  ps_array_resinfo      4096/4096 pixels exact

That covers the 2D-array resinfo dimensions on a device whose vk_image_query path was previously untested for arrayed views, and no other test moved.

(FYI, the first run with binaries from an older commit gave 144/146 — cs_bvh and ps_ssharp failed on the program/check.py mismatch, not on this PR. Everything green once the programs match the tree; see #1579.)

@Rainmaker33

Copy link
Copy Markdown

Tested 67c8ffe on NVIDIA GeForce RTX 3090 (Ampere, subgroup 32..32), driver 610.88 (Vulkan 1.4.341), Windows 11 Pro 26300: pass.

The PR's diff applied cleanly to main 41f4482. VS 2022, Vulkan SDK 1.4.363.0, llvm-mc 21.1.8; harness programs from a CMake build of that main.

  • scripts/run_gpu_tests.py: 116/146 pass, 30 skipped (wave64), no failures. main gives 115/145. ps_array_resinfo: 4096/4096 pixels exact.

@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Thanks for checking the full suite on the RTX 3090. The head moved from 67c8ffe to 3c6380c only to restore an unrelated comment; the shader fixture, runner logic and translator are identical. The runner unit tests passed 27/27 after that comment-only commit. AI-assisted.

@bobcatchris

Copy link
Copy Markdown
Contributor

Tested 3c6380c22e5274dd541b529fd004ac0096f4f26c on AMD Radeon Pro V540 (RDNA1, Navi 12, PCI 1002:7360, RADV Mesa 25.2.8-0ubuntu0.24.04.4, Ubuntu 24.04.4, kernel 7.0.0-31-generic, Vulkan device 1.4.318, subgroup 32..64): pass. This is the independent RDNA1/RADV GPU execution that was pending on this head.

  • Command: DRI_PRIME=pci-0000_1c_00_0! python -I scripts/run_gpu_tests.py --filter array_resinfo --build runtime/build/linux: 1/1 passed, ps_array_resinfo 4096/4096 pixels exact. The synthetic 12-layer view returns the expected dimensions on Navi 12.
  • Command: python -I scripts/run_gpu_tests.py --build runtime/build/linux: 133/146 passed, 12 skipped, 1 failed (151 shaders translated, 151 pass spirv-val). A clean upstream/main 41f44826 control built in its own worktree gave 132/145 passed, 12 skipped, 1 failed — the only difference is the new passing ps_array_resinfo, so no regression.
  • The single failure is cs_w32_salu64, with identical words on base and PR head and on three pinned V540 cards; it is pre-existing and reported as a finding in Coordinating who works on what (7) (moved to #1745) #1548 (comment).
  • Command: pytest tests/test_run_gpu_tests.py tests/test_shader_checks.py tests/test_translate.py: 510 passed, 2 skipped.
  • Negative control: on clean main, --filter array_resinfo matches no GPU test cases, so the new fixture is genuinely added by this PR.

Tools: llvm-mc 21.1.8 (AMDGPU), SPIRV-Tools 2026.1 for the SPIR-V checks, GCC 13.3.0, Python 3.12.3. No code was edited or pushed; only synthetic fixtures were used.

AI-assisted.

…uery-size

# Conflicts:
#	tests/test_shader_checks.py
@evilclanker9000

Copy link
Copy Markdown
Contributor Author

With upstream/main a0acd33 merged into fa34cc0, the GPU runner and shader checker pytest suites pass 86 tests and 218 subtests. The merge resolution keeps the new upstream store-word and get-LOD test cases. The earlier Radeon V540 pixel result applies to 3c6380c. AI-assisted.

@evilclanker9000

Copy link
Copy Markdown
Contributor Author

Follow-up on fa34cc0 using the Windows LLVM and Vulkan SDK tools: both array_resinfo translator tests passed. The source-built ps_array_resinfo also assembled, translated and passed spirv-val. GPU execution on this head is still pending. AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants