startup: use NEVER for ordinary translated sampler filters #2228

Manually merged
github merged 2 commits from gh-pr/2228/head into gh-pr/2228/base 2026-11-27 00:07:42 +00:00
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 06:23 UTC · original
RavenCurseBurg:startup/ordinary-sampler-comparison → main · +8 −4 · 4 files · 2 commits · merged 2026-11-25 06:33 UTC

Refs #2221, item 2. Set the ordinary translated sampler's comparison function to NEVER, as used by the D3D12 debug layer for a non-comparison filter. The decoder still maps all eight guest comparison functions for real comparison samplers. Static samplers, dynamic heap entries and the border fallback share this decoder. Item 1 (the guest LOD fields) is being handled separately in the issue.

On one Windows 2025 WARP device with the Direct3D 12 Agility SDK 1.620.2 debug layer, I created four descriptors and read the device's info queue after each call. Restoring ALWAYS on the ordinary point sampler produced warning 1361 once. The fixed ordinary sampler, the border fallback, and an actual comparison sampler with ALWAYS produced zero instances. All four reported zero errors. Before/after info-queue measurements

  • Ran ctest --test-dir out/build/gpu-check-release --no-tests=error -R '^startup_(translated_sampler_bindings|sampler_comparison)$': 2/2 passed. Restoring the previous field to ALWAYS made each regression test fail for the ordinary descriptor.
  • Ran python -B tests/startup_sampler_heap_check.py draw <dxc> <offscreen_check> warp on Windows 2025. Readback passed with the debug layer enabled, zero errors and zero warnings in the ordinary heap draws. The fixture now reports a regression if warning 1361 appears. Native tests, WARP and mutation control
  • Repeated the draw on local Windows with WARP and a physical D3D12 adapter using the renderer built from bf9bf8bc. Both passed the readbacks and existing negative controls. The local system debug layer was unavailable; the warning counts above come from the hosted runs.

AI-assisted with Codex (GPT-6.2 Astra xhigh).

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 06:23 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2228) `RavenCurseBurg:startup/ordinary-sampler-comparison` → `main` · +8 −4 · 4 files · 2 commits · merged 2026-11-25 06:33 UTC Refs #2221, item 2. Set the ordinary translated sampler's comparison function to `NEVER`, as used by the D3D12 debug layer for a non-comparison filter. The decoder still maps all eight guest comparison functions for real comparison samplers. Static samplers, dynamic heap entries and the border fallback share this decoder. Item 1 (the guest LOD fields) is being handled separately in the issue. On one Windows 2025 WARP device with the Direct3D 12 Agility SDK 1.620.2 debug layer, I created four descriptors and read the device's info queue after each call. Restoring `ALWAYS` on the ordinary point sampler produced warning 1361 once. The fixed ordinary sampler, the border fallback, and an actual comparison sampler with `ALWAYS` produced zero instances. All four reported zero errors. [Before/after info-queue measurements](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45559975104) - Ran `ctest --test-dir out/build/gpu-check-release --no-tests=error -R '^startup_(translated_sampler_bindings|sampler_comparison)$'`: 2/2 passed. Restoring the previous field to `ALWAYS` made each regression test fail for the ordinary descriptor. - Ran `python -B tests/startup_sampler_heap_check.py draw <dxc> <offscreen_check> warp` on Windows 2025. Readback passed with the debug layer enabled, zero errors and zero warnings in the ordinary heap draws. The fixture now reports a regression if warning 1361 appears. [Native tests, WARP and mutation control](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45559657341) - Repeated the draw on local Windows with WARP and a physical D3D12 adapter using the renderer built from `bf9bf8bc`. Both passed the readbacks and existing negative controls. The local system debug layer was unavailable; the warning counts above come from the hosted runs. AI-assisted with Codex (GPT-6.2 Astra xhigh).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 00:07:39 +00:00
github manually merged commit 58ddee3d97 into gh-pr/2228/base 2026-11-27 00:07:42 +00:00
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 06:32 UTC · original

Added the explanation beside the assertion in 58ddee3d. The numeric prefix comes from offscreen_check when it prints the D3D12 info queue. The WARP draw passed again after the comment change.

The Windows 2025 sampler run built the implementation with MSVC, passed both native descriptor checks and the debug-layer WARP draw, and confirmed that restoring ordinary ALWAYS fails both descriptor checks. A separate WARP info-queue probe observed one message 1361 with the restored ordinary descriptor and zero with the fixed descriptor, fallback sampler and comparison ALWAYS control. The upstream run on the comment revision is underway.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 06:32 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2228#issuecomment-7154888102) Added the explanation beside the assertion in `58ddee3d`. The numeric prefix comes from `offscreen_check` when it prints the D3D12 info queue. The WARP draw passed again after the comment change. The [Windows 2025 sampler run](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45559657341) built the implementation with MSVC, passed both native descriptor checks and the debug-layer WARP draw, and confirmed that restoring ordinary ALWAYS fails both descriptor checks. A [separate WARP info-queue probe](https://github.com/RavenCurseBurg/Xbox2Windows/actions/runs/45559975104) observed one message 1361 with the restored ordinary descriptor and zero with the fixed descriptor, fallback sampler and comparison ALWAYS control. The [upstream run on the comment revision](https://github.com/R0Y00/Xbox2Windows/actions/runs/45560947101) is underway.
Author
Owner

@⁠tedin7 on GitHub · 2026-11-25 06:26 UTC · original · reviewed

Review of head bf9bf8bc0196147ab2ba6ce37b11423f570861aa.

Result: no P1, no P2.

Scope: translated_sampler_bindings.h now sets ComparisonFunc = NEVER for ordinary (non-comparison) samplers. The comparison branch still maps the 3-bit field with +1, which covers NEVER..ALWAYS. That matches D3D12_COMPARISON_FUNC. Static samplers, dynamic heap entries and border_sampler() all go through decode_sampler/dynamic_sampler, so one change covers all three. I checked for sibling sites with rg -n "COMPARISON_FUNC_ALWAYS|ComparisonFunc *= *" src tests. No other ordinary-sampler decoder in src sets ALWAYS. The remaining ALWAYS hits are depth/stencil state, which is unrelated.

Tests:

  • startup_sampler_comparison_check.cpp and startup_translated_sampler_bindings_check.cpp flip the expected value from 8 to 1 for static and dynamic descriptors. The latter also adds a border_sampler assertion.
  • startup_sampler_heap_check.py fails the draw run if D3D12 1361: appears on stderr. This is a real behavioural guard.

Commands executed locally in the review worktree:

  • git diff --stat origin/main...HEAD: 4 files, 7 insertions, 4 deletions.
  • python3 tests/docs_links_check.py: passed (412 links).
  • python3 tests/bidi_controls_check.py: passed (1505 files).
  • git diff --check origin/main...HEAD: clean.
  • python3 -I -m py_compile tests/startup_sampler_heap_check.py: OK.
  • gh pr checks: the Linux Python checks and the gfx1013 fixtures pass. The Windows build was still pending when I checked.

Not run here: the C++ tests need the D3D12 headers and a Windows build, and this host has neither. I did not run the mutation (restoring ALWAYS) locally. The PR body reports that mutation failing both C++ checks and the debug-layer warning, and the Windows CI job should confirm it.

Nits (non-blocking):

  • The D3D12 1361: string match in the heap check depends on the debug-layer message format. A short comment saying so would help the next reader.
  • The title and body are neutral and clean-room.

Please wait for the pending Windows CI job before merging.

AI-assisted; commands listed were executed locally.

**@⁠tedin7** on GitHub · 2026-11-25 06:26 UTC · [original](https://github.com/R0Y00/Xbox2Windows/pull/2228#pullrequestreview-6052823182) · **reviewed** Review of head `bf9bf8bc0196147ab2ba6ce37b11423f570861aa`. **Result: no P1, no P2.** Scope: `translated_sampler_bindings.h` now sets `ComparisonFunc = NEVER` for ordinary (non-comparison) samplers. The comparison branch still maps the 3-bit field with `+1`, which covers NEVER..ALWAYS. That matches `D3D12_COMPARISON_FUNC`. Static samplers, dynamic heap entries and `border_sampler()` all go through `decode_sampler`/`dynamic_sampler`, so one change covers all three. I checked for sibling sites with `rg -n "COMPARISON_FUNC_ALWAYS|ComparisonFunc *= *" src tests`. No other ordinary-sampler decoder in `src` sets `ALWAYS`. The remaining `ALWAYS` hits are depth/stencil state, which is unrelated. Tests: - `startup_sampler_comparison_check.cpp` and `startup_translated_sampler_bindings_check.cpp` flip the expected value from 8 to 1 for static and dynamic descriptors. The latter also adds a `border_sampler` assertion. - `startup_sampler_heap_check.py` fails the draw run if `D3D12 1361:` appears on stderr. This is a real behavioural guard. Commands executed locally in the review worktree: - `git diff --stat origin/main...HEAD`: 4 files, 7 insertions, 4 deletions. - `python3 tests/docs_links_check.py`: passed (412 links). - `python3 tests/bidi_controls_check.py`: passed (1505 files). - `git diff --check origin/main...HEAD`: clean. - `python3 -I -m py_compile tests/startup_sampler_heap_check.py`: OK. - `gh pr checks`: the Linux Python checks and the gfx1013 fixtures pass. The Windows build was still pending when I checked. Not run here: the C++ tests need the D3D12 headers and a Windows build, and this host has neither. I did not run the mutation (restoring `ALWAYS`) locally. The PR body reports that mutation failing both C++ checks and the debug-layer warning, and the Windows CI job should confirm it. Nits (non-blocking): - The `D3D12 1361:` string match in the heap check depends on the debug-layer message format. A short comment saying so would help the next reader. - The title and body are neutral and clean-room. Please wait for the pending Windows CI job before merging. AI-assisted; commands listed were executed locally.
This discussion has been locked. Commenting is limited to contributors.
No description provided.