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

Merged
ChazY11 merged 2 commits from upstream-pr/1166 into main 2026-11-24 03:19:50 +00:00
ChazY11 commented 2026-11-24 02:17:23 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by ChazY11 on 2026-11-24T02:17:23Z.


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.
<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6573105196 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1166). Originally posted by [ChazY11](https://github.com/ChazY11) on 2026-11-24T02:17:23Z. --- ## 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.
upstream-sync closed this pull request 2026-11-24 06:46:38 +00:00
tedin7 commented 2026-11-24 06:46:38 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T02:27:05Z.

Review: COMMENTED


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).

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6032753115 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1166#pullrequestreview-6032753115). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-24T02:27:05Z. **Review:** COMMENTED --- 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).
R0Y00 commented 2026-11-24 06:50:11 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by R0Y00 on 2026-11-24T02:40:10Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7120368327 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/1166#issuecomment-7120368327). Originally posted by [R0Y00](https://github.com/R0Y00) on 2026-11-24T02:40:10Z. --- 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.
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
R0Y00/Xbox2Windows!1159
No description provided.