d3d12_depth_resolve_test: the host's edge draw takes the standard 4x sample positions (TEST-DEPTH-RESOLVE-SAMPLE-POSITIONS) #1505

Closed
QemmHD wants to merge 1 commit from upstream-pr/1505 into main
QemmHD commented 2026-11-25 02:33:12 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by QemmHD on 2026-11-25T02:33:12Z.


Claimed in the coordination issue as: TEST-DEPTH-RESOLVE-SAMPLE-POSITIONS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7150863045)

What and why

d3d12_depth_resolve fails its 34 edge cases (TEST-848) on an RTX 4070 SUPER (NVIDIA 621.24, Windows 11). The layer is not at fault: it matches WARP 71/71, and the analytic standard 4x pattern byte for byte. The host reference is what's off. This PC's NVIDIA global profile has "Enable sample interleaving" (MFAA) on, and with it a native D3D12 4x target's default sample positions are not the standard pattern:

  • Before the first Present, all four samples of a pixel coincide, so MIN = MAX = AVERAGE everywhere and no pixel is partly covered.
  • After each Present, two other patterns alternate.

That was measured with a small D3D12-only program (no Vulkan, no Leonida). No PSO or resource setting changes it; only an explicit SetSamplePositions with the standard pattern does, and then the grid equals WARP. Vulkan on the same driver keeps the standard locations, and so does the layer.

This PR makes the edge cases set the standard 4x positions where the device has programmable sample positions, before the clears and through the resolve. The layer and WARP report none, so their results are unchanged. This is probably also why #67 lists d3d12_depth_resolve as a "known failure" on an RTX 5060 Ti.

Tested

Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja, RelWithDebInfo:

  • d3d12_depth_resolve exits 0. On the NVIDIA host, 74 of 97 cases now match (36 before; the rest are the cases the test already marks as host-dependent). WARP matches 71/71. It passes four repeated runs and under LEONIDA_VK_VALIDATION=1 with 0 validation errors, and in ctest.
  • A read-back of the planes with a debugger confirmed the host had no partial coverage before the change.
  • Not done: switching MFAA off in the driver to A/B the unmodified test, because that's the machine owner's setting. With MFAA off, the unmodified test should pass too.

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11

AI-assisted: yes

Checklist

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

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

🤖 Generated with Claude Code

https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5484038750 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1505). Originally posted by [QemmHD](https://github.com/QemmHD) on 2026-11-25T02:33:12Z. --- Claimed in the coordination issue as: TEST-DEPTH-RESOLVE-SAMPLE-POSITIONS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7150863045) ### What and why `d3d12_depth_resolve` fails its 34 edge cases (TEST-848) on an RTX 4070 SUPER (NVIDIA 621.24, Windows 11). The layer is not at fault: it matches WARP 71/71, and the analytic standard 4x pattern byte for byte. The **host reference** is what's off. This PC's NVIDIA global profile has "Enable sample interleaving" (MFAA) on, and with it a native D3D12 4x target's **default sample positions are not the standard pattern**: - **Before the first Present,** all four samples of a pixel coincide, so MIN = MAX = AVERAGE everywhere and no pixel is partly covered. - **After each Present,** two other patterns alternate. That was measured with a small D3D12-only program (no Vulkan, no Leonida). No PSO or resource setting changes it; only an explicit `SetSamplePositions` with the standard pattern does, and then the grid equals WARP. Vulkan on the same driver keeps the standard locations, and so does the layer. This PR makes the edge cases set the standard 4x positions where the device has programmable sample positions, before the clears and through the resolve. The layer and WARP report none, so their results are unchanged. This is probably also why #67 lists `d3d12_depth_resolve` as a "known failure" on an RTX 5060 Ti. ### Tested Windows 11, RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja, RelWithDebInfo: - `d3d12_depth_resolve` exits 0. On the NVIDIA host, 74 of 97 cases now match (36 before; the rest are the cases the test already marks as host-dependent). WARP matches 71/71. It passes four repeated runs and under `LEONIDA_VK_VALIDATION=1` with 0 validation errors, and in ctest. - A read-back of the planes with a debugger confirmed the host had no partial coverage before the change. - Not done: switching MFAA off in the driver to A/B the unmodified test, because that's the machine owner's setting. With MFAA off, the unmodified test should pass too. GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.24, Windows 11 AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. - [x] A new translator rule is in the contract table of `docs/design.md`. (n/a: test-only) AI-assisted (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
ytsodacan commented 2026-11-25 03:36:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ytsodacan on 2026-11-25T03:36:15Z.


[KEEP]

  • Test-only change in runtime/test/d3d12_depth_resolve_test.cpp: pins standard 4x sample positions via SetSamplePositions when programmable positions are supported. The diff is small and the reasoning is well documented.
  • CI is not settled: windows, macos, linux-gpu-tools, change-scope and no-game-data are all still pending. This test is Windows/D3D12 only, so the windows job matters most.
  • Verification is on a single NVIDIA host (RTX 4070 SUPER, MFAA on): 74 of 97 cases match, with the remaining cases already marked host-dependent. I could not check other vendors, and the PR notes MFAA-off A/B was not done.
  • No overlapping open PRs found. Likely MERGE once CI is green.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7152069257 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1505#issuecomment-7152069257). Originally posted by [ytsodacan](https://github.com/ytsodacan) on 2026-11-25T03:36:15Z. --- **[KEEP]** - Test-only change in `runtime/test/d3d12_depth_resolve_test.cpp`: pins standard 4x sample positions via `SetSamplePositions` when programmable positions are supported. The diff is small and the reasoning is well documented. - CI is not settled: `windows`, `macos`, `linux-gpu-tools`, `change-scope` and `no-game-data` are all still pending. This test is Windows/D3D12 only, so the `windows` job matters most. - Verification is on a single NVIDIA host (RTX 4070 SUPER, MFAA on): 74 of 97 cases match, with the remaining cases already marked host-dependent. I could not check other vendors, and the PR notes MFAA-off A/B was not done. - No overlapping open PRs found. Likely MERGE once CI is green.
OreoFR commented 2026-11-28 21:51:47 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T21:51:47Z.


Verified by OreoFR

  • Base: main c1ecf04ed + PR head 595f1bd42; green run in a merge package of 12 PRs, no new ctest failure vs main
  • Test: ctest -R ^d3d12_depth_resolve$
  • Red on main: OK
  • Green with the PR: OK
  • Verdict: NO RED (test-only PR; MFAA not active in the driver profile here, the fixed branch 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).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7246327887 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1505#issuecomment-7246327887). Originally posted by [OreoFR](https://github.com/OreoFR) on 2026-11-28T21:51:47Z. --- **Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `595f1bd42`; green run in a merge package of 12 PRs, no new ctest failure vs main - Test: `ctest -R ^d3d12_depth_resolve$` - Red on main: OK - Green with the PR: OK - Verdict: NO RED (test-only PR; MFAA not active in the driver profile here, the fixed branch 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 commented 2026-11-29 02:08:49 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-29T02:08:49Z.


Windows 11 + RTX 3090 + WARP Verification (595f1bd420 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 (driver 610.88, D3D12_FEATURE_D3D12_OPTIONS2.ProgrammableSamplePositionsTier = 2 TIER_2) + Microsoft WARP + VK_LAYER_KHRONOS_validation 1.4.363.1 (LEONIDA_VK_VALIDATION=1, LEONIDA_DEPTH_EDGE_VS_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.
  • Red -> Green:
    • Red (simulated NVIDIA MFAA coinciding 4x sample positions {{0,0},{0,0},{0,0},{0,0}} on main d3d12_depth_resolve_test.cpp): fails with rc=1 (depth/stencil resolves against WARP: 37 of 71 match — 34 edge resolves mismatch when sample positions shift off the D3D standard pattern).
    • Green (595f1bd420 + main 791899f652): pinning {{-2, -6}, {6, -2}, {-6, 2}, {2, 6}} (1/16 pixel) via ID3D12GraphicsCommandList1::SetSamplePositions on both list.p (before clears/draws) and list1.p (split resolve command list) passes both the simulated-MFAA override run and unmodified d3d12_depth_resolve_test.exe with rc=0:
      • depth/stencil resolves against NVIDIA GeForce RTX 3090: 57 of 97 match, 24 host quirks, 7 refusals alike
      • depth/stencil resolves against WARP: 71 of 71 match, 0 host quirks, 7 refusals alike
      • depth/stencil resolves: 128 host comparisons matched, 12 refusals kept the destination, 0 modes the device lacks were refused
      • 0 VUID- Vulkan validation errors.

AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7249239021 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1505#issuecomment-7249239021). Originally posted by [zmasi](https://github.com/zmasi) on 2026-11-29T02:08:49Z. --- ### Windows 11 + RTX 3090 + WARP Verification (`595f1bd420` 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** (driver `610.88`, `D3D12_FEATURE_D3D12_OPTIONS2.ProgrammableSamplePositionsTier = 2` `TIER_2`) + Microsoft WARP + `VK_LAYER_KHRONOS_validation` `1.4.363.1` (`LEONIDA_VK_VALIDATION=1`, `LEONIDA_DEPTH_EDGE_VS_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. - **Red -> Green**: - **Red (simulated NVIDIA MFAA coinciding 4x sample positions `{{0,0},{0,0},{0,0},{0,0}}` on `main` `d3d12_depth_resolve_test.cpp`)**: fails with `rc=1` (`depth/stencil resolves against WARP: 37 of 71 match` — `34` edge resolves mismatch when sample positions shift off the D3D standard pattern). - **Green (`595f1bd420` + `main` `791899f652`)**: pinning `{{-2, -6}, {6, -2}, {-6, 2}, {2, 6}}` (`1/16` pixel) via `ID3D12GraphicsCommandList1::SetSamplePositions` on both `list.p` (before clears/draws) and `list1.p` (split resolve command list) passes both the simulated-MFAA override run and unmodified `d3d12_depth_resolve_test.exe` with `rc=0`: - `depth/stencil resolves against NVIDIA GeForce RTX 3090: 57 of 97 match, 24 host quirks, 7 refusals alike` - `depth/stencil resolves against WARP: 71 of 71 match, 0 host quirks, 7 refusals alike` - `depth/stencil resolves: 128 host comparisons matched, 12 refusals kept the destination, 0 modes the device lacks were refused` - `0` `VUID-` Vulkan validation errors. AI-assisted.
TheGeogeo commented 2026-11-29 14:18:01 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-29T14:18:01Z.


Ready for testing: merges cleanly with main 3535eb5c4. Not in main yet: git cherry finds 1 commit(s) not there, and 0 of the 13 lines it adds are already present. No duplicate found: its claim TEST-848 appears in no other open pull request and in no main commit.

AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7257195396 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1505#issuecomment-7257195396). Originally posted by [TheGeogeo](https://github.com/TheGeogeo) on 2026-11-29T14:18:01Z. --- Ready for testing: merges cleanly with `main` `3535eb5c4`. Not in `main` yet: `git cherry` finds 1 commit(s) not there, and 0 of the 13 lines it adds are already present. No duplicate found: its claim `TEST-848` appears in no other open pull request and in no `main` commit. AI-assisted (Claude Code).
enlight3d commented 2026-11-29 15:41:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T15:41:17Z.


Independent run of #1505 on a native D3D12 host with MFAA off (driver settings untouched). The red needs MFAA forced on in the NVIDIA profile, so there is no red on this machine; green only.

  • PR head: 595f1bd420 (merge-base 3ff2a2adc)
  • main: bd643e46e7 (PR merged into it locally with git merge --no-ff, clean; only runtime/test/d3d12_depth_resolve_test.cpp touched, +17 lines)
  • Machine: Windows 11 Pro 10.0.26300, RTX 3090 24 GB, NVIDIA 621.40, MSVC 14.44, Vulkan SDK 1.4.363.1

Commands: vcvars64, VS cmake + ninja, cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON, cmake --build runtime/build -j 8 --target d3d12_depth_resolve_test (merged and main: plus --target gta6rt), then ctest -R "^d3d12_depth_resolve$" --output-on-failure. The test exe was also run directly to read its summary line.

  • Red: not reachable here. With the PR's change reverted (= plain main), the test also passes: ctest Passed, depth/stencil resolves against NVIDIA GeForce RTX 3090: 74 of 97 match, 15 host quirks, 7 refusals alike, WARP 71 of 71. Those are the same counts as with the PR, so with MFAA off the change is neutral, as the PR says ("with MFAA off the unmodified test should pass too"). It does not test the claim that MFAA moves the default samples; that needs MFAA on, which I did not change.
  • Is the new code active here? A small standalone probe (CheckFeatureSupport OPTIONS2) reports ProgrammableSamplePositionsTier = 2 on the RTX 3090, so pin_samples runs its SetSamplePositions here and does not change the result. The same probe reports tier 2 for WARP on this Windows build, so "WARP has none" does not hold here; the WARP result is 71 of 71 before and after.
  • Green at head: ctest d3d12_depth_resolve Passed (6.5 s), exit 0.
  • Green merged into main: Passed (6.9 s), exit 0, same counts (74 of 97 on the 3090, 71 of 71 on WARP).
  • gta6rt link check: dumpbin /imports of gta6rt.exe built from the merged tree and from plain main: 718 imports each, 0 new, 0 removed (the exe is byte-identical, the PR only touches a test source).
  • Not run: the game or gta6rt.
<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7258286642 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1505#issuecomment-7258286642). Originally posted by [enlight3d](https://github.com/enlight3d) on 2026-11-29T15:41:17Z. --- Independent run of #1505 on a native D3D12 host with MFAA off (driver settings untouched). The red needs MFAA forced on in the NVIDIA profile, so there is no red on this machine; green only. - PR head: 595f1bd4201beafba95da65da103968eab65784d (merge-base 3ff2a2adc) - main: bd643e46e784daf6bf3a45d09f0ec20e669c4ddb (PR merged into it locally with `git merge --no-ff`, clean; only `runtime/test/d3d12_depth_resolve_test.cpp` touched, +17 lines) - Machine: Windows 11 Pro 10.0.26300, RTX 3090 24 GB, NVIDIA 621.40, MSVC 14.44, Vulkan SDK 1.4.363.1 Commands: vcvars64, VS cmake + ninja, `cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ON`, `cmake --build runtime/build -j 8 --target d3d12_depth_resolve_test` (merged and main: plus `--target gta6rt`), then `ctest -R "^d3d12_depth_resolve$" --output-on-failure`. The test exe was also run directly to read its summary line. - Red: not reachable here. With the PR's change reverted (= plain main), the test also passes: ctest Passed, `depth/stencil resolves against NVIDIA GeForce RTX 3090: 74 of 97 match, 15 host quirks, 7 refusals alike`, WARP 71 of 71. Those are the same counts as with the PR, so with MFAA off the change is neutral, as the PR says ("with MFAA off the unmodified test should pass too"). It does not test the claim that MFAA moves the default samples; that needs MFAA on, which I did not change. - Is the new code active here? A small standalone probe (CheckFeatureSupport OPTIONS2) reports ProgrammableSamplePositionsTier = 2 on the RTX 3090, so `pin_samples` runs its `SetSamplePositions` here and does not change the result. The same probe reports tier 2 for WARP on this Windows build, so "WARP has none" does not hold here; the WARP result is 71 of 71 before and after. - Green at head: ctest d3d12_depth_resolve Passed (6.5 s), exit 0. - Green merged into main: Passed (6.9 s), exit 0, same counts (74 of 97 on the 3090, 71 of 71 on WARP). - gta6rt link check: `dumpbin /imports` of gta6rt.exe built from the merged tree and from plain main: 718 imports each, 0 new, 0 removed (the exe is byte-identical, the PR only touches a test source). - Not run: the game or gta6rt.
aslan2142 commented 2026-12-01 16:36:28 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:36:28Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317886155 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1505#issuecomment-7317886155). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:36:28Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

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
ProjectLeonida/mandy!1505
No description provided.