rdna2spirv: image_sample* outside 2D selects the UINT/SINT sampled view (OLD-9959 / SHADER-1404) #1247

Closed
leonida/mandy
ambroseautomation wants to merge 0 commits from carry/old-9959-sample-typed-dims into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

ambroseautomation commented 2026-11-24 20:48:36 +00:00

Claimed in the coordination issue as: OLD-9959 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143833765)

What and why

Carries forward old-pr/9959 (draft #225, original commit author slipperysquid preserved; indexed in #17; SHADER-1404), rebased cleanly onto current main, plus a small follow-up commit (68762f09c) updating tests/test_shader_checks.py for the new SAMPLE_DIMS_TESTS / sample_dims_test hook in check.py.

Extends typed UINT/SINT view selection in tools/rdna2spirv.py to implicit image_sample across every texture dimension and stage (matching image_sample_l / image_sample_lz):

  • Selects the T# FORMAT's float, UINT, or SINT sampled view for image_sample across 1D, 2D, 2D-array, cube, and 3D dimensions and in both pixel and non-pixel stages.
  • Computes quad gradients (OpDPdx / OpDPdy) before the per-format branch at the non-layer coordinate width in pixel shaders, and samples at explicit LOD 0 outside the pixel stage.
  • Adds tests/semantic/test_sample_implicit_dims.py, updates tests/semantic/test_sample_typed_dims.py, adds GPU fixtures ps_sample_array_uint/sint and ps_sample_volume_uint/sint with new vk_texture_test modes wired into check.py and scripts/run_gpu_tests.py, updates tests/test_shader_checks.py, and updates the contract row in docs/design.md.

Tested

  • python -m unittest discover -s tests/semantic -p test_sample_implicit_dims.py -v: 6 tests, OK (1 skipped: spirv-val not on PATH).
  • python -m unittest discover -s tests/semantic -p test_sample_typed_dims.py -v: 4 tests, OK (1 skipped: spirv-val not on PATH).
  • python -I tests/test_shader_checks.py: 87 tests, OK.
  • python -I tests/test_docs_links.py: 16 tests, OK.
  • python -I scripts/run_semantic_tests.py tests/semantic: 471 files, 6,174 tests, 0 files failed.
  • python -I scripts/check_no_game_data.py on all 12 touched files: exit 0 (no game data).

GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10; original author verified the GPU fixtures on RX 6800 XT / RTX 3070 / llvmpipe)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.
Claimed in the coordination issue as: OLD-9959 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7143833765) ### What and why Carries forward `old-pr/9959` (draft #225, original commit author `slipperysquid` preserved; indexed in #17; SHADER-1404), rebased cleanly onto current `main`, plus a small follow-up commit (`68762f09c`) updating `tests/test_shader_checks.py` for the new `SAMPLE_DIMS_TESTS` / `sample_dims_test` hook in `check.py`. Extends typed UINT/SINT view selection in `tools/rdna2spirv.py` to implicit `image_sample` across every texture dimension and stage (matching `image_sample_l` / `image_sample_lz`): - Selects the T# FORMAT's float, UINT, or SINT sampled view for `image_sample` across 1D, 2D, 2D-array, cube, and 3D dimensions and in both pixel and non-pixel stages. - Computes quad gradients (`OpDPdx` / `OpDPdy`) before the per-format branch at the non-layer coordinate width in pixel shaders, and samples at explicit LOD 0 outside the pixel stage. - Adds `tests/semantic/test_sample_implicit_dims.py`, updates `tests/semantic/test_sample_typed_dims.py`, adds GPU fixtures `ps_sample_array_uint`/`sint` and `ps_sample_volume_uint`/`sint` with new `vk_texture_test` modes wired into `check.py` and `scripts/run_gpu_tests.py`, updates `tests/test_shader_checks.py`, and updates the contract row in `docs/design.md`. ### Tested - `python -m unittest discover -s tests/semantic -p test_sample_implicit_dims.py -v`: 6 tests, OK (1 skipped: `spirv-val` not on PATH). - `python -m unittest discover -s tests/semantic -p test_sample_typed_dims.py -v`: 4 tests, OK (1 skipped: `spirv-val` not on PATH). - `python -I tests/test_shader_checks.py`: 87 tests, OK. - `python -I tests/test_docs_links.py`: 16 tests, OK. - `python -I scripts/run_semantic_tests.py tests/semantic`: 471 files, 6,174 tests, 0 files failed. - `python -I scripts/check_no_game_data.py` on all 12 touched files: exit 0 (no game data). GPUs tested: n/a (CPU SPIR-V interpreter semantic suite on Windows 11 Pro 64-bit, Python 3.12.10; original author verified the GPU fixtures on RX 6800 XT / RTX 3070 / llvmpipe) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [x] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed.
GeorgiyDemo commented 2026-11-24 21:05:36 +00:00

Tested 68762f09c on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against main 66d4f5aa3, with the PR's own runtime/test/vk_texture_test.cpp rebuilt from its head (the main binary rejects the new fixtures' arguments with a usage line):

  • GPU, PR build: --filter ps_sample_ 10/10 on MoltenVK 1.4.2 and 10/10 on KosmicKrisp (Mesa 26.3.1). The four new fixtures each pass with "4096 exact pixels (image_sample, _l and _lz of the integer texture)".
  • New fixtures with main's translator (same build, tools/rdna2spirv.py swapped back): 6/10 — ps_sample_array_sint, ps_sample_array_uint, ps_sample_volume_sint and ps_sample_volume_uint all FAIL, so the fixtures do catch the view-selection bug rather than only passing at the head.
  • Semantic: test_sample_implicit_dims.py passes at this head and fails 11 times against main; test_sample_typed_dims.py passes both here and on main, so that one does not discriminate.

AI-assisted; synthetic fixtures only, no game data.

Tested `68762f09c` on Apple M5 Pro (16-core GPU), macOS 26.7.3 (25G342), against `main` `66d4f5aa3`, with the PR's own `runtime/test/vk_texture_test.cpp` rebuilt from its head (the `main` binary rejects the new fixtures' arguments with a usage line): - **GPU, PR build:** `--filter ps_sample_` 10/10 on **MoltenVK 1.4.2** and 10/10 on **KosmicKrisp** (Mesa 26.3.1). The four new fixtures each pass with "4096 exact pixels (image_sample, _l and _lz of the integer texture)". - **New fixtures with `main`'s translator** (same build, `tools/rdna2spirv.py` swapped back): 6/10 — `ps_sample_array_sint`, `ps_sample_array_uint`, `ps_sample_volume_sint` and `ps_sample_volume_uint` all FAIL, so the fixtures do catch the view-selection bug rather than only passing at the head. - **Semantic:** `test_sample_implicit_dims.py` passes at this head and fails 11 times against `main`; `test_sample_typed_dims.py` passes both here and on `main`, so that one does not discriminate. AI-assisted; synthetic fixtures only, no game data.
Sign in to join this conversation.
No description provided.