Skip to content

d3d12_state_sweep_test: compare the per-face stencil cases only with a host that has OPTIONS14 (TEST-STATE-SWEEP-WIN10-STENCIL) - #1398

Open
qhukz13 wants to merge 2 commits into
ProjectLeonida:mainfrom
qhukz13:cont/state-sweep-win10
Open

qhukz13 wants to merge 2 commits into
ProjectLeonida:mainfrom
qhukz13:cont/state-sweep-win10

Conversation

@qhukz13

@qhukz13 qhukz13 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: TEST-STATE-SWEEP-WIN10-STENCIL (claim)

What and why

#878 added separate front and back stencil masks to the layer and 16 stencil per-face masks cases to
d3d12_state_sweep. Those cases build a pipeline state stream with D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2
(and half of them call ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef), which need
D3D12_FEATURE_D3D12_OPTIONS14.IndependentFrontAndBackStencilRefMaskSupported. Windows 10's in-box D3D12 does not
know OPTIONS14 (CheckFeatureSupport returns E_INVALIDARG) and refuses those pipelines, so on Windows 10 all 16
cases print the host refuses the pipeline (0x80070057), the layer accepts it MISMATCH and the test fails, although
the layer behaves as intended.

The test now asks the host for OPTIONS14. Where the query fails or reports FALSE, the 16 cases still run on the
layer (a layer failure is still a MISMATCH) and are printed as not comparable on this host, with the reason; they
count as skipped. A host that reports support compares them as before. The layer is not changed.

Tested

GeForce GTX 1050 Ti, NVIDIA 582.66, Windows 10 Pro 19045, MSVC RelWithDebInfo, ctest -R "^d3d12_state_sweep$":
fails on main (16 MISMATCH), passes 3 of 3 with this branch:

stencil per-face masks same, one ref, front-facing: not comparable on this host (host runtime lacks D3D12_FEATURE_D3D12_OPTIONS14, hr 0x80070057)
...
482 cases compared with NVIDIA GeForce GTX 1050 Ti, 0 differ; 16 skipped

The test always compares with the hardware adapter behind the Vulkan device (it does not read
LEONIDA_HOST_ADAPTER), so the supported path is not exercised on this machine; on a Windows 11 host that reports
OPTIONS14 the code path is the unchanged one.

GPUs tested: NVIDIA GeForce GTX 1050 Ti, driver 582.66, Windows 10 19045. No game files.

AI-assisted: yes (Claude Code, with Antigravity for the implementation and the runs)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md. (Test only.)

🤖 Generated with Claude Code

…ost lacks OPTIONS14

The 16 stencil per-face masks cases build a pipeline state stream with
D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL2 (and half also call
ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef), which require
D3D12_FEATURE_D3D12_OPTIONS14::IndependentFrontAndBackStencilRefMaskSupported.

On older in-box host runtimes such as Windows 10 (build 19045),
CheckFeatureSupport(D3D12_FEATURE_D3D12_OPTIONS14) fails with E_INVALIDARG
(0x80070057) and the host refuses those pipelines with E_INVALIDARG while
the layer accepts them on purpose. Query OPTIONS14 on the host device and,
when the query fails or reports FALSE, still run the cases on the layer and
report them as not comparable on this host instead of a MISMATCH. Hosts
that report support are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PierreEbele

Copy link
Copy Markdown
Contributor

Reviewed feb22b4: test-only change; on a host without OPTIONS14 (or reporting IndependentFrontAndBackStencilRefMaskSupported = FALSE) the 16 DEPTH_STENCIL2 cases still run on the layer but count as "not comparable" instead of MISMATCH. I could not run the test here (Windows-only sweep test; no GPU), so this is a code-reading review: the shims implement DEPTH_STENCIL2 per-face masks and ID3D12GraphicsCommandList8::OMSetFrontAndBackStencilRef, and the file is unchanged on main since the base. Nits: FALSE-reporting hosts also skip the identical-mask/single-ref cases, and a post-pipeline layer failure prints "pipeline 0x00000000".

AI-assisted review.

Recommendation: Merge

Address review nits on PR ProjectLeonida#1398:
- When CheckFeatureSupport(OPTIONS14) succeeds with IndependentFrontAndBackStencilRefMaskSupported == FALSE, only skip the 14 per-face cases that actually use differing front/back masks or OMSetFrontAndBackStencilRef (back_ref >= 0). The 2 identical-mask single-ref DEPTH_STENCIL2 cases ('same, one ref', front/back-facing) remain compared against the host. When OPTIONS14 itself fails, all 16 DEPTH_STENCIL2 cases stay skipped.
- Record failed_step and failed_hr in Result for every failing call in run(), and print them instead of always printing 'pipeline 0x00000000' when a post-pipeline step fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qhukz13

qhukz13 commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both nits are addressed in 8da0d91:

  • A host that knows OPTIONS14 but reports IndependentFrontAndBackStencilRefMaskSupported = FALSE now skips only the 14 cases that need independent faces (differing front/back masks, or OMSetFrontAndBackStencilRef). The two identical-mask single-ref DEPTH_STENCIL2 cases are compared with the host again. A host without OPTIONS14 at all still skips all 16. Non-stream cases are unaffected (their front/back fields keep the defaults).
  • run() records the failing step and its HRESULT for every call, so a layer failure prints e.g. the layer failed (CreateCommittedResource(depth) 0x8007000e) instead of pipeline 0x00000000.

Run on Windows 10 Pro 19045, GTX 1050 Ti, NVIDIA 582.66, MSVC RelWithDebInfo: d3d12_state_sweep passes 3/3 plain and 3/3 with LEONIDA_VK_VALIDATION=1 (no validation messages): 482 cases compared with the host, 0 differ, 16 skipped as not comparable (this host's runtime lacks OPTIONS14, 0x80070057). The FALSE-reporting branch is not reachable on this host, so it is checked by reading only.

@OreoFR

OreoFR commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Verified by OreoFR

  • Base: main c1ecf04ed + PR head 8da0d91fc; green run in a merge package of 12 PRs, no new ctest failure vs main
  • Test: ctest -R ^d3d12_state_sweep$
  • Red on main: OK
  • Green with the PR: OK
  • Verdict: NO RED (test-only PR; the RTX 4070 has OPTIONS14, the skip without OPTIONS14 is not exercised)
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

@zmasi

zmasi commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

Windows 11 + RTX 3090 Verification (8da0d91fcf merged with main 791899f652) — PASS

  • Environment: Windows 11 (10.0.26200), MSVC 19.44.35207 (/O2 /MD /EHsc /std:c++20 /W4 /permissive- /utf-8), NVIDIA GeForce RTX 3090 (610.88, OPTIONS14.IndependentFrontAndBackStencilRefMaskSupported = 1) + VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1, LEONIDA_SWEEP_VS_SPV and LEONIDA_SWEEP_PS_SPV enabled).
  • Merge & Hygiene: Clean git merge-tree onto main (791899f652) (0 conflicts); python -I scripts/check_no_game_data.py rc=0; 0 new /W4 warnings.
  • Native OPTIONS14 Host Run:
    • d3d12_state_sweep_test.exe passes with rc=0: 498 cases compared with NVIDIA GeForce RTX 3090, 0 differ; 0 skipped, 0 VUID- validation errors.
  • Red -> Green (simulated Windows 10 pre-OPTIONS14 host: OPTIONS14 -> E_INVALIDARG, DEPTH_STENCIL2 stream PSO -> E_INVALIDARG, ID3D12GraphicsCommandList8 -> E_NOINTERFACE):
    • Red (main d3d12_state_sweep_test.cpp): fails with rc=1 (498 cases compared with NVIDIA GeForce RTX 3090, 16 differ; 0 skipped — 16 MISMATCH failures).
    • Green (8da0d91fcf + main 791899f652): still executes run(ours.p, ...) across all 16 DEPTH_STENCIL2 / two-ref stencil cases (mine.ok == true, 0 VUID- errors), logs not comparable on this host (host runtime lacks D3D12_FEATURE_D3D12_OPTIONS14, hr 0x80070057), and exits rc=0 (482 cases compared with NVIDIA GeForce RTX 3090, 0 differ; 16 skipped).

AI-assisted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants