startup: use NEVER for ordinary translated sampler filters #2220

Merged
RavenCurseBurg merged 2 commits from upstream-pr/2228 into main 2026-11-25 06:33:32 +00:00
RavenCurseBurg commented 2026-11-25 06:23:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T06:23:14Z.


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

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6598570704 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2228). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T06:23:14Z. --- 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).
upstream-sync closed this pull request 2026-11-25 07:01:07 +00:00
tedin7 commented 2026-11-25 07:01:07 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-25T06:26:55Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:review:6052823182 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2228#pullrequestreview-6052823182). Originally posted by [tedin7](https://github.com/tedin7) on 2026-11-25T06:26:55Z. **Review:** COMMENTED --- 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.
RavenCurseBurg commented 2026-11-25 07:01:14 +00:00 (Migrated from github.com)

Imported from R0Y00/Xbox2Windows. Originally posted by RavenCurseBurg on 2026-11-25T06:32:00Z.


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.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7154888102 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/pull/2228#issuecomment-7154888102). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T06:32:00Z. --- 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.
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!2220
No description provided.