shader: read the split Texture2DArray comparison sampler back on the GPU #1107

Manually merged
github merged 2 commits from gh-pr/1107/head into gh-pr/1107/base 2026-11-26 22:42:08 +00:00
Owner

@⁠Jess-Doit on GitHub · 2026-11-24 01:07 UTC · original
Jess-Doit:test/claude-1079-array-readback → main · +119 −41 · 3 files · 2 commits · merged 2026-11-24 02:20 UTC

Change

Follow-up to #1079, which split shared comparison samplers on Texture2DArray images and left the arrayed module's DXC compile and GPU readback for a Windows run.

  • tests/spirv_window/compare_sampler.cpp: an array / array-<variant> descriptor variant makes t0 and t1 two-layer Texture2DArray resources with explicit array SRVs. Layer 1 differs from layer 0 in every texel the shader reads: depth 0.875 (both comparisons pass), ordinary 0.3125, mip 1 0.5625.
  • tests/spirv_window/compare_sampler.py: a layer-1 copy of the arrayed module (coordinate (0.25, 0.25, 1)). DXC must still reject the unsplit arrayed module and compile both split ones. Readbacks of layer 0, layer 1, layer 1 against layer 0's reference, and the comparison and ordinary sampler controls on layer 1.
  • docs/experiments.md: describe the arrayed GPU stage.

The existing Texture2D draws and their controls are unchanged.

Verification

Tested f38773dc (on ea0e838e) on Windows 10 22H2 19045.6456 with a GTX 1060 6GB (10de:1c03, driver 32.0.15.6094) and in-box WARP (1414:008c, 10.0.19041.5794). The D3D12 debug layer was enabled on both.

. .\tools\dev.ps1
$env:XBOX2WINDOWS_ADAPTER = '1060'
foreach ($preset in 'dev', 'release') {
    cmake --preset $preset
    cmake --build --preset $preset --target offscreen_check -j 2
    ctest --preset $preset --no-tests=error -R '^spirv_compare_sampler_' -V
}

Each preset passed 2/2 (spirv_compare_sampler_hardware, spirv_compare_sampler_warp) with zero skips. Results were identical on both adapters:

Stage Result
spirv-val --target-env vulkan1.2, arrayed shared + split, layers 0 and 1 pass
DXC, unsplit arrayed module rejected: no matching member function for call to 'SampleLevel' (expected)
DXC cs_6_0, split arrayed module, layers 0 and 1 compiles
Layer 0 vs the Texture2D reference 3f800000,00000000,3ec00000, 0/16 mismatches
Layer 1 vs its own reference 3f800000,3f800000,3ea00000, 0/16 mismatches
Layer 1 vs layer 0's reference (control) 2 mismatches, exactly words 1 and 2
Layer 1, comparison sampler GREATER only words 0 and 1 change (00000000,00000000)
Layer 1, ordinary sampler MinLOD 1 only word 2 changes, to layer 1's mip (3f100000, not layer 0's 3f200000)

git diff --check and tests/docs_links_check.py are clean.

AI-assisted (Claude Code).

**@⁠Jess-Doit** on GitHub · 2026-11-24 01:07 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1107) `Jess-Doit:test/claude-1079-array-readback` → `main` · +119 −41 · 3 files · 2 commits · merged 2026-11-24 02:20 UTC ## Change Follow-up to #1079, which split shared comparison samplers on `Texture2DArray` images and left the arrayed module's DXC compile and GPU readback for a Windows run. - `tests/spirv_window/compare_sampler.cpp`: an `array` / `array-<variant>` descriptor variant makes t0 and t1 two-layer `Texture2DArray` resources with explicit array SRVs. Layer 1 differs from layer 0 in every texel the shader reads: depth 0.875 (both comparisons pass), ordinary 0.3125, mip 1 0.5625. - `tests/spirv_window/compare_sampler.py`: a layer-1 copy of the arrayed module (coordinate `(0.25, 0.25, 1)`). DXC must still reject the unsplit arrayed module and compile both split ones. Readbacks of layer 0, layer 1, layer 1 against layer 0's reference, and the comparison and ordinary sampler controls on layer 1. - `docs/experiments.md`: describe the arrayed GPU stage. The existing `Texture2D` draws and their controls are unchanged. ## Verification Tested `f38773dc` (on `ea0e838e`) on Windows 10 22H2 `19045.6456` with a GTX 1060 6GB (`10de:1c03`, driver `32.0.15.6094`) and in-box WARP (`1414:008c`, `10.0.19041.5794`). The D3D12 debug layer was enabled on both. ```powershell . .\tools\dev.ps1 $env:XBOX2WINDOWS_ADAPTER = '1060' foreach ($preset in 'dev', 'release') { cmake --preset $preset cmake --build --preset $preset --target offscreen_check -j 2 ctest --preset $preset --no-tests=error -R '^spirv_compare_sampler_' -V } ``` Each preset passed 2/2 (`spirv_compare_sampler_hardware`, `spirv_compare_sampler_warp`) with zero skips. Results were identical on both adapters: | Stage | Result | |---|---| | `spirv-val --target-env vulkan1.2`, arrayed shared + split, layers 0 and 1 | pass | | DXC, unsplit arrayed module | rejected: `no matching member function for call to 'SampleLevel'` (expected) | | DXC `cs_6_0`, split arrayed module, layers 0 and 1 | compiles | | Layer 0 vs the `Texture2D` reference | `3f800000,00000000,3ec00000`, 0/16 mismatches | | Layer 1 vs its own reference | `3f800000,3f800000,3ea00000`, 0/16 mismatches | | Layer 1 vs layer 0's reference (control) | 2 mismatches, exactly words 1 and 2 | | Layer 1, comparison sampler `GREATER` | only words 0 and 1 change (`00000000,00000000`) | | Layer 1, ordinary sampler `MinLOD` 1 | only word 2 changes, to layer 1's mip (`3f100000`, not layer 0's `3f200000`) | `git diff --check` and `tests/docs_links_check.py` are clean. AI-assisted (Claude Code).
Follow-up to #1079, which split shared comparison samplers on Texture2DArray images and left the arrayed
module's DXC compile and GPU readback for a Windows run.

- compare_sampler.cpp: an "array" / "array-<variant>" descriptor variant makes t0 and t1 two-layer
  Texture2DArray resources (explicit Texture2DArray SRVs). Layer 1 differs in every sampled texel: depth
  0.875 (both comparisons pass), ordinary 0.3125, mip 1 0.5625.
- compare_sampler.py: a layer-1 copy of the arrayed module; DXC must still reject the unsplit arrayed module
  and compile both split ones; readbacks of layer 0 (Texture2D reference), layer 1 (its own reference),
  layer 1 against layer 0's reference (words 1 and 2 must differ), and the comparison and ordinary sampler
  controls on layer 1.
- docs/experiments.md: describe the arrayed GPU stage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:42:06 +00:00
github manually merged commit 18ef8ce7a7 into gh-pr/1107/base 2026-11-26 22:42:08 +00:00
Author
Owner

@⁠Toons29 on GitHub · 2026-11-24 02:04 UTC · original

Tested 18ef8ce7 on an AMD Radeon RX 9070 (RDNA 4, 1002:7550), driver 32.0.32029.2010, Windows 11 build 26300, dev preset, debug layer unavailable: pass

ctest --preset dev --no-tests=error -R '^spirv_compare_sampler_' -V

spirv_compare_sampler_hardware and spirv_compare_sampler_warp both pass, with no skips. On the RX 9070, the baseline, the comparison descriptor (00000000,3f800000,3ec00000), the ordinary MinLOD-1 descriptor (3f800000,00000000,3f200000) and array layers 0 and 1 all read back with mismatches=0 over 16 words. Every control is caught: the wrong reference (1), comparison vs baseline (2), ordinary vs baseline (1), layer 1 vs layer 0 (2), array comparison vs layer 1 (2) and array ordinary vs layer 1 (1). The array layer 1 comparison readback is 00000000,00000000,3ea00000.

I first ran it at f38773dc, before the main merge, and every readback above is the same at both commits.

**@⁠Toons29** on GitHub · 2026-11-24 02:04 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1107#issuecomment-7119727667) Tested 18ef8ce7 on an AMD Radeon RX 9070 (RDNA 4, `1002:7550`), driver `32.0.32029.2010`, Windows 11 build 26300, `dev` preset, debug layer unavailable: pass ```powershell ctest --preset dev --no-tests=error -R '^spirv_compare_sampler_' -V ``` `spirv_compare_sampler_hardware` and `spirv_compare_sampler_warp` both pass, with no skips. On the RX 9070, the baseline, the comparison descriptor (`00000000,3f800000,3ec00000`), the ordinary MinLOD-1 descriptor (`3f800000,00000000,3f200000`) and array layers 0 and 1 all read back with `mismatches=0` over 16 words. Every control is caught: the wrong reference (1), comparison vs baseline (2), ordinary vs baseline (1), layer 1 vs layer 0 (2), array comparison vs layer 1 (2) and array ordinary vs layer 1 (1). The array layer 1 comparison readback is `00000000,00000000,3ea00000`. I first ran it at f38773dc, before the main merge, and every readback above is the same at both commits.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-24 02:15 UTC · original · reviewed

Reviewed at 18ef8ce7a760c46eb78d623cf6740298536eea94.

  • Code & structure: tests/spirv_window/compare_sampler.cpp cleanly extends check_spirv_compare_sampler with array / array-<variant> using two-layer Texture2DArray SRVs whose layer 1 differs in every sampled texel (depth 0.875, ordinary 0.3125, mip 1 0.5625). tests/spirv_window/compare_sampler.py verifies DXC still rejects the unsplit shared_array HLSL, compiles lowered_array and lowered_array_layer1, and checks layer 0 vs layer 1 readback plus comparison-greater (words 0–1) and ordinary-min-lod1 (word 2 on layer 1's mip 1).
  • Linux checks run: python3 -B tests/docs_links_check.py (15 files, 253 links), python3 -B tests/bidi_controls_check.py (939 files), python3 -B tests/gpu_report_format_check.py (10 tests), python3 -B tests/xgameruntime_table_check.py, python3 -B tests/spirv_window/check.py, and python3 -m py_compile tests/spirv_window/compare_sampler.py — all passed.
  • CI / Windows: Linux Python checks and Assemble and translate gfx1013 fixtures passed; the 2 Windows build/test checks are currently pending, so Windows DXC/WARP/hardware readback relies on CI.
**@⁠tedin7** on GitHub · 2026-11-24 02:15 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1107#pullrequestreview-6032633296) · **reviewed** Reviewed at `18ef8ce7a760c46eb78d623cf6740298536eea94`. - **Code & structure**: `tests/spirv_window/compare_sampler.cpp` cleanly extends `check_spirv_compare_sampler` with `array` / `array-<variant>` using two-layer `Texture2DArray` SRVs whose layer 1 differs in every sampled texel (depth `0.875`, ordinary `0.3125`, mip 1 `0.5625`). `tests/spirv_window/compare_sampler.py` verifies DXC still rejects the unsplit `shared_array` HLSL, compiles `lowered_array` and `lowered_array_layer1`, and checks layer 0 vs layer 1 readback plus `comparison-greater` (words 0–1) and `ordinary-min-lod1` (word 2 on layer 1's mip 1). - **Linux checks run**: `python3 -B tests/docs_links_check.py` (15 files, 253 links), `python3 -B tests/bidi_controls_check.py` (939 files), `python3 -B tests/gpu_report_format_check.py` (10 tests), `python3 -B tests/xgameruntime_table_check.py`, `python3 -B tests/spirv_window/check.py`, and `python3 -m py_compile tests/spirv_window/compare_sampler.py` — all passed. - **CI / Windows**: Linux Python checks and `Assemble and translate gfx1013 fixtures` passed; the 2 Windows build/test checks are currently pending, so Windows DXC/WARP/hardware readback relies on CI.
This discussion has been locked. Commenting is limited to contributors.
No description provided.