d3d12_clear_test: report Vulkan driver NaN depth-clear canonicalization to 1.0 on AMD #307

Closed
Andretuta wants to merge 1 commit from upstream-pr/307 into main
Andretuta commented 2026-11-24 03:05:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T03:05:30Z.


Carried over from old PR 10042 by liamhob in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/10042, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
liamhob: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

What and why

On AMD Radeon RX 9070 XT (Windows 11, AMD driver 26.10.1, Vulkan 1.4), \d3d12_clear\ passes \1.5\ / -0.5\ depth clears and \ lags 0, but fails ^G NaN depth stays NaN:
\\
a NaN depth stays NaN (0,0): layer cleared 1, WARP nan
\\

Even with \VK_EXT_depth_range_unrestricted, AMD's Vulkan driver canonicalizes a \NaN\ depth clear value in \ kCmdClearDepthStencilImage\ / \ kCmdClearAttachments\ to \1.0f, whereas WARP stores the quiet NaN verbatim.

This detects when all texels of a \NaN\ depth clear are canonicalized to \1.0f\ by the Vulkan driver (while WARP stores \NaN), reports it as a driver difference, and still fails on partial/other mismatches or any regression in \Close(), \1.5/-0.5, or \ lags 0.

Verification

  • Windows 11 26300, MSVC 19.44, Ninja, AMD Radeon RX 9070 XT (driver 26.10.1, with #9857 applied to build):
    • \ctest -R ^d3d12_clear$: PASS (0.85 s).
    • \git diff --check: clean.
  • Synthetic test only; no game files. AI-assisted.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5465307114 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/307). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T03:05:30Z. --- > Carried over from **old PR 10042** by `liamhob` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/10042`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `liamhob`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ### What and why On AMD Radeon RX 9070 XT (Windows 11, AMD driver 26.10.1, Vulkan 1.4), \d3d12_clear\ passes \1.5\ / \-0.5\ depth clears and \ lags 0\, but fails \^G NaN depth stays NaN\: \\\ a NaN depth stays NaN (0,0): layer cleared 1, WARP nan \\\ Even with \VK_EXT_depth_range_unrestricted\, AMD's Vulkan driver canonicalizes a \NaN\ depth clear value in \ kCmdClearDepthStencilImage\ / \ kCmdClearAttachments\ to \1.0f\, whereas WARP stores the quiet NaN verbatim. This detects when all texels of a \NaN\ depth clear are canonicalized to \1.0f\ by the Vulkan driver (while WARP stores \NaN\), reports it as a driver difference, and still fails on partial/other mismatches or any regression in \Close()\, \1.5\/\-0.5\, or \ lags 0\. ### Verification - Windows 11 26300, MSVC 19.44, Ninja, AMD Radeon RX 9070 XT (driver 26.10.1, with `#9857` applied to build): - \ctest -R ^d3d12_clear$\: **PASS** (0.85 s). - \git diff --check\: clean. - Synthetic test only; no game files. AI-assisted.
LewisCodesWebsites commented 2026-11-24 13:22:02 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by LewisCodesWebsites on 2026-11-24T13:22:02Z.


Tested 26eedb7f7 on AMD Radeon 660M (RDNA2 iGPU), Adrenalin 32.0.21045.1000, Windows 11 26200: with this PR on main 21625bc, d3d12_clear passes (on main it fails on the NaN-depth rows, "layer cleared 1, WARP nan"). AI-assisted.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7132727655 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/307#issuecomment-7132727655). Originally posted by [LewisCodesWebsites](https://github.com/LewisCodesWebsites) on 2026-11-24T13:22:02Z. --- Tested 26eedb7f7 on AMD Radeon 660M (RDNA2 iGPU), Adrenalin 32.0.21045.1000, Windows 11 26200: with this PR on main 21625bc, `d3d12_clear` passes (on main it fails on the NaN-depth rows, "layer cleared 1, WARP nan"). AI-assisted.
Tauwni commented 2026-11-29 04:53:38 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Tauwni on 2026-11-29T04:53:38Z.


AMD RDNA4 complement, and a resolution of the conflict with current main. Radeon RX 9060 XT, driver 32.0.23033.1002 (Vulkan driverInfo 26.3.1), Windows 10 Pro 22H2 19045.7846, MSVC 14.44 RelWithDebInfo. MEASURED, 3 runs each, ctest -R "^d3d12_clear$":

  • main b6bf3aa0b: fails 3/3. First line: depth clear with NaN (0,0): layer cleared 1, expected nan. So RDNA4 canonicalizes the NaN depth clear to 1.0 too, as the RDNA2 660M above does.
  • This PR (26eedb7f7) no longer merges: main reworked check_depth_clear_edge_values (a want_layer expectation, clamped where depth is restricted). It conflicts in d3d12_clear_test.cpp.
  • Resolved merge: Tauwni/leonida rebase-307. It keeps main's want_layer logic and counts a texel as canonicalized only when want_layer is NaN and the layer wrote 1.0. It keeps this PR's all-or-nothing rule and messages. Your commit is unchanged inside the merge. Passes 3/3.

Feel free to take the resolution or redo it yourself. No PR from me.
Not checked by a second agent or human yet. AI-assisted: yes (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7250924069 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/307#issuecomment-7250924069). Originally posted by [Tauwni](https://github.com/Tauwni) on 2026-11-29T04:53:38Z. --- AMD RDNA4 complement, and a resolution of the conflict with current `main`. Radeon RX 9060 XT, driver 32.0.23033.1002 (Vulkan driverInfo 26.3.1), Windows 10 Pro 22H2 19045.7846, MSVC 14.44 RelWithDebInfo. MEASURED, 3 runs each, `ctest -R "^d3d12_clear$"`: - `main` `b6bf3aa0b`: fails 3/3. First line: `depth clear with NaN (0,0): layer cleared 1, expected nan`. So RDNA4 canonicalizes the NaN depth clear to 1.0 too, as the RDNA2 660M above does. - This PR (`26eedb7f7`) no longer merges: `main` reworked `check_depth_clear_edge_values` (a `want_layer` expectation, clamped where depth is restricted). It conflicts in `d3d12_clear_test.cpp`. - Resolved merge: [Tauwni/leonida `rebase-307`](https://github.com/Tauwni/leonida/commit/55cb919c7ef334f64a16b31d4192e23e43bd32ab). It keeps `main`'s `want_layer` logic and counts a texel as canonicalized only when `want_layer` is NaN and the layer wrote 1.0. It keeps this PR's all-or-nothing rule and messages. Your commit is unchanged inside the merge. Passes 3/3. Feel free to take the resolution or redo it yourself. No PR from me. Not checked by a second agent or human yet. AI-assisted: yes (Claude Code).
aslan2142 commented 2026-12-01 12:17:55 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:17:55Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310932800 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/307#issuecomment-7310932800). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:17:55Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 16:29:26 +00:00 (Migrated from github.com)

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


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:7317692796 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/307#issuecomment-7317692796). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:29:26Z. --- 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!307
No description provided.