gpu: compare the sampler descriptor index source on the same tables #1166

Manually merged
github merged 2 commits from gh-pr/1166/head into gh-pr/1166/base 2026-11-26 22:45:30 +00:00
Owner

@⁠ChazY11 on GitHub · 2026-11-24 02:17 UTC · original
ChazY11:tests/sampler-index-control → main · +318 −1 · 5 files · 2 commits · merged 2026-11-24 03:19 UTC

What

The focused control PR you asked for on #1115. One shader, built twice, that differs only in the source of the
sampler descriptor index:

build index source role
sampler_index_dispatch_cs SV_DispatchThreadID.x the passing control, asserted
sampler_index_group_cs SV_GroupID.x the recorded reproduction, never asserted

Everything else is held identical between the two builds, as you specified: the four descriptor ranges (SRV t0, UAV
u0, two samplers at s1 space 0, two comparison samplers at s1 space 3), the cs_6_0 shader model, the four-word
output layout (word i ordinary sampled with descriptor i, word i+2 comparison) and all three sampler swaps.

offscreen_check <warp|hardware> --sampler-index-control prints, per swap, expected and actual words for each
build, then one summary line:

control=dispatch_thread swap=0 expected=0.25 0.75 0 1 actual=0.25 0.75 0 1 status=pass
control=group_index      swap=0 expected=0.25 0.75 0 1 actual=0.25 0.25 0 0 status=differs
...
dispatch_thread_control=pass group_index_reproduction=differs dxc=1.8.2502.11

The dispatch-thread build throws on any mismatch, so a broken table or swap still fails the test; the group-id build is
recorded only, because an adapter that folds the index matches on some drivers.

Measured

Windows 11 build 26300.9974, x64, Core Ultra 9 285H; MSVC 14.44.35207, Windows SDK 10.0.26100, DXC 1.8.2502.11,
debug layer enabled, debug_errors=0 debug_warnings=0 in every run.

$env:XBOX2WINDOWS_ADAPTER = 'Intel'    # or 'NVIDIA'; unset for WARP
ctest --preset dev --no-tests=error -R '^sampler_index_control_' -V
adapter driver dispatch-thread control group-index reproduction
NVIDIA RTX 5080 Laptop (10de:2c59) 32.0.15.8142 pass, all three swaps matches
Intel Arc 140T (8086:7d51) 32.0.101.8132 pass, all three swaps differs — 0.25 0.25/0 0, 0.75 0.75/0 0, 0.25 0.25/1 1
Microsoft Basic Render Driver (WARP) 10.0.26100.9818 pass, all three swaps matches

On the Arc the two builds differ in the same three swaps, so the index source alone reproduces it: the second group
reads descriptor 0 of both tables even though it reports group id 1.

The translated path keeps its failure

Unchanged, as you asked — no expectation was touched:

Intel Arc 140T:
  sampler_index_control_warp ....... Passed
  sampler_index_control_hardware ... Passed
  spirv_sampler_views_hardware .....***Failed    1.52 sec      <- still fails, same as before this PR

Tested

ctest -R 'sampler_index_control'                                    -> 2/2 pass (warp, hardware)
ctest -R 'offscreen_capability_table_self_test|desktop_root_signature|era_heap_allocation|offscreen_warp'
                                                                    -> 4/4 pass
ctest -R 'sampler_index_control|offscreen_capability_table_self_test|desktop_root_signature|era_heap_allocation|offscreen_warp'
                                                                    -> 6/6 pass
python -B tests/docs_links_check.py            -> 15 files, 253 links
python -B tests/bidi_controls_check.py         -> 948 files, none
full build (cmake --build --preset dev)        -> no FAILED target

The new operation is covered by the existing CLI self-test (cli_validation=ok), including its usage error.

Notes

  • AI-assisted. Every number is from this machine and reproducible with the command above.
  • Refs #1115. The measurement prose stays in #1133 as you said; this PR adds the fixture and one short paragraph
    describing it, not new claims about the cause.
  • The bytecode headers are generated at build time by DXC from the tracked .hlsl, so the two builds cannot drift
    apart; no binary DXIL is committed.
  • Nothing from a game: the texture values, samplers and expected words are generated by the fixture.
**@⁠ChazY11** on GitHub · 2026-11-24 02:17 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1166) `ChazY11:tests/sampler-index-control` → `main` · +318 −1 · 5 files · 2 commits · merged 2026-11-24 03:19 UTC ## What The focused control PR you asked for on #1115. One shader, built twice, that differs **only** in the source of the sampler descriptor index: | build | index source | role | |---|---|---| | `sampler_index_dispatch_cs` | `SV_DispatchThreadID.x` | the passing control, asserted | | `sampler_index_group_cs` | `SV_GroupID.x` | the recorded reproduction, never asserted | Everything else is held identical between the two builds, as you specified: the four descriptor ranges (SRV `t0`, UAV `u0`, two samplers at `s1` space 0, two comparison samplers at `s1` space 3), the `cs_6_0` shader model, the four-word output layout (`word i` ordinary sampled with descriptor `i`, `word i+2` comparison) and all three sampler swaps. `offscreen_check <warp|hardware> --sampler-index-control` prints, **per swap**, expected and actual words for each build, then one summary line: ```text control=dispatch_thread swap=0 expected=0.25 0.75 0 1 actual=0.25 0.75 0 1 status=pass control=group_index swap=0 expected=0.25 0.75 0 1 actual=0.25 0.25 0 0 status=differs ... dispatch_thread_control=pass group_index_reproduction=differs dxc=1.8.2502.11 ``` The dispatch-thread build throws on any mismatch, so a broken table or swap still fails the test; the group-id build is recorded only, because an adapter that folds the index matches on some drivers. ## Measured Windows 11 build 26300.9974, x64, Core Ultra 9 285H; MSVC 14.44.35207, Windows SDK 10.0.26100, **DXC 1.8.2502.11**, debug layer enabled, `debug_errors=0 debug_warnings=0` in every run. ```powershell $env:XBOX2WINDOWS_ADAPTER = 'Intel' # or 'NVIDIA'; unset for WARP ctest --preset dev --no-tests=error -R '^sampler_index_control_' -V ``` | adapter | driver | dispatch-thread control | group-index reproduction | |---|---|---|---| | NVIDIA RTX 5080 Laptop (10de:2c59) | 32.0.15.8142 | pass, all three swaps | `matches` | | **Intel Arc 140T (8086:7d51)** | **32.0.101.8132** | **pass, all three swaps** | **`differs`** — `0.25 0.25`/`0 0`, `0.75 0.75`/`0 0`, `0.25 0.25`/`1 1` | | Microsoft Basic Render Driver (WARP) | 10.0.26100.9818 | pass, all three swaps | `matches` | On the Arc the two builds differ in the same three swaps, so the index source alone reproduces it: the second group reads descriptor 0 of both tables even though it reports group id 1. ## The translated path keeps its failure Unchanged, as you asked — no expectation was touched: ```text Intel Arc 140T: sampler_index_control_warp ....... Passed sampler_index_control_hardware ... Passed spirv_sampler_views_hardware .....***Failed 1.52 sec <- still fails, same as before this PR ``` ## Tested ```text ctest -R 'sampler_index_control' -> 2/2 pass (warp, hardware) ctest -R 'offscreen_capability_table_self_test|desktop_root_signature|era_heap_allocation|offscreen_warp' -> 4/4 pass ctest -R 'sampler_index_control|offscreen_capability_table_self_test|desktop_root_signature|era_heap_allocation|offscreen_warp' -> 6/6 pass python -B tests/docs_links_check.py -> 15 files, 253 links python -B tests/bidi_controls_check.py -> 948 files, none full build (cmake --build --preset dev) -> no FAILED target ``` The new operation is covered by the existing CLI self-test (`cli_validation=ok`), including its usage error. ## Notes - AI-assisted. Every number is from this machine and reproducible with the command above. - `Refs #1115`. The measurement prose stays in #1133 as you said; this PR adds the fixture and one short paragraph describing it, not new claims about the cause. - The bytecode headers are generated at build time by DXC from the tracked `.hlsl`, so the two builds cannot drift apart; no binary DXIL is committed. - Nothing from a game: the texture values, samplers and expected words are generated by the fixture.
Records the Arc sampler-views difference as a control instead of a report (#1115).

One shader, tests/sampler_index_control.hlsl, is built twice and the builds differ
only in the source of the sampler descriptor index: SV_DispatchThreadID in the
first, SV_GroupID in the second. Both keep the four descriptor ranges (SRV t0,
UAV u0, two samplers at s1 space 0, two comparison samplers at s1 space 3), the
cs_6_0 shader model, the four-word output layout and all three sampler swaps, so
the index is the only difference between the two readbacks.

offscreen_check <warp|hardware> --sampler-index-control dispatches both builds
through those tables and prints, per swap, the expected and actual words and a
status for each build, then one summary line with the adapter, the driver and the
DXC version that produced the builds. The dispatch-thread build is the passing
control and throws on any mismatch; the group-id build is recorded and never
asserted, because an adapter that folds the index matches on some drivers.

Measured on Windows 11 build 26300.9974 with DXC 1.8.2502.11: the dispatch-thread
build matched all three swaps on the RTX 5080 Laptop (32.0.15.8142), the Intel Arc
140T (32.0.101.8132) and in-box WARP (10.0.26100.9818). The group-id build matched
on the RTX and WARP and read 0.25 0.25 / 0 0, 0.75 0.75 / 0 0 and 0.25 0.25 / 1 1
on the Arc. The translated SPIR-V fixture keeps its existing failure on that
adapter; no expectation was changed.

Tests: sampler_index_control_{warp,hardware}, the existing capability-table self
test (cli_validation covers the new operation) and the smoke set all pass; the
docs link and bidirectional-control checks pass. Refs #1115.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 22:45:27 +00:00
github manually merged commit 2721db8593 into gh-pr/1166/base 2026-11-26 22:45:30 +00:00
Author
Owner

@⁠R0Y00 on GitHub · 2026-11-24 02:40 UTC · original

I kept the output slots on SV_DispatchThreadID in both builds and added a fresh sentinel before each dispatch. The selected ID now changes only the sampler indices. On 2721db85, WARP and RTX 4060 Laptop both matched all swaps for both builds under Release (Windows 11 26200.9974, DXC 1.8.2502.11, debug layer on). The missing-write control retained -2 and -4 in the intended slots and failed. Please rerun this exact commit on the Arc 140T when you have a chance so we can isolate the original mismatch.

**@⁠R0Y00** on GitHub · 2026-11-24 02:40 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1166#issuecomment-7120368327) I kept the output slots on SV_DispatchThreadID in both builds and added a fresh sentinel before each dispatch. The selected ID now changes only the sampler indices. On 2721db85, WARP and RTX 4060 Laptop both matched all swaps for both builds under Release (Windows 11 26200.9974, DXC 1.8.2502.11, debug layer on). The missing-write control retained -2 and -4 in the intended slots and failed. Please rerun this exact commit on the Arc 140T when you have a chance so we can isolate the original mismatch.
Author
Owner

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

Reviewed commit 4b69ea7f405ea57d3bb1b3dd43dc464561bb9fb9 on Linux.

Code notes:

  • tests/sampler_index_control.hlsl and tests/spirv_window/sampler_index_control.cpp: cleanly isolate SV_DispatchThreadID vs SV_GroupID on identical descriptor tables, shader model (cs_6_0), and sampler swaps, tracking output_state across all six dispatches and asserting only the dispatch_thread control.
  • tests/offscreen_check.cpp and CMakeLists.txt: wire --sampler-index-control, DXC_VERSION_STRING, CLI self-test coverage, and CTest targets. Minor formatting nit in tests/offscreen_check.cpp:984: kGateSm60SamplerIndexControl and kGateSm60RawUavDump are missing a newline between them.

Linux checks passed: python3 tests/docs_links_check.py, python3 tests/bidi_controls_check.py, python3 tests/gpu_report_format_check.py, python3 tests/xgameruntime_table_check.py, python3 tests/hardware_reports_check.py.
Windows MSVC/DXC build, WARP, and hardware execution rely on CI (currently pending).

**@⁠tedin7** on GitHub · 2026-11-24 02:27 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/1166#pullrequestreview-6032753115) · **reviewed** Reviewed commit `4b69ea7f405ea57d3bb1b3dd43dc464561bb9fb9` on Linux. Code notes: - `tests/sampler_index_control.hlsl` and `tests/spirv_window/sampler_index_control.cpp`: cleanly isolate `SV_DispatchThreadID` vs `SV_GroupID` on identical descriptor tables, shader model (`cs_6_0`), and sampler swaps, tracking `output_state` across all six dispatches and asserting only the `dispatch_thread` control. - `tests/offscreen_check.cpp` and `CMakeLists.txt`: wire `--sampler-index-control`, `DXC_VERSION_STRING`, CLI self-test coverage, and CTest targets. Minor formatting nit in `tests/offscreen_check.cpp:984`: `kGateSm60SamplerIndexControl` and `kGateSm60RawUavDump` are missing a newline between them. Linux checks passed: `python3 tests/docs_links_check.py`, `python3 tests/bidi_controls_check.py`, `python3 tests/gpu_report_format_check.py`, `python3 tests/xgameruntime_table_check.py`, `python3 tests/hardware_reports_check.py`. Windows MSVC/DXC build, WARP, and hardware execution rely on CI (currently pending).
This discussion has been locked. Commenting is limited to contributors.
No description provided.