[PR #516] [MERGED] d3d12: use legal Vulkan depth clear values (D3D-CLEAR-DEPTH-RANGE) #564

Closed
opened 2026-11-26 20:18:18 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/516
Author: @sodove
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD

Base: main ← Head: fix/d3d12-clear-depth-range


📝 Commits (2)

  • 673dd15 d3d12: use legal Vulkan depth clear values (D3D-CLEAR-DEPTH-RANGE)
  • 86b069f docs: record observed D3D12 depth clear semantics

📊 Changes

8 files changed (+57 additions, -21 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+5 -0)
📝 runtime/CMakeLists.txt (+2 -1)
📝 runtime/shims/d3d12_com.h (+1 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+3 -0)
📝 runtime/src/vulkan_backend.h (+5 -0)
📝 runtime/src/vulkan_replay.h (+8 -4)
📝 runtime/test/d3d12_clear_test.cpp (+26 -16)
📝 runtime/test/vk_test_device.h (+7 -0)

📄 Description

Claimed in the coordination issue as: D3D-CLEAR-DEPTH-RANGE (#14)

What and why

This addresses the depth-clear half of #506. Both full and rectangle clears currently pass unrestricted float depth values to Vulkan on devices that did not enable VK_EXT_depth_range_unrestricted, triggering VUID-VkClearDepthStencilValue-depth-00022.

Enable the extension on standalone devices that advertise it and carry the enabled capability through caller-owned device info to replay. With the extension, float depth clears can preserve the requested value. Without it, replay clamps depth to [0, 1] and uses 0 for NaN. The existing D16 and emulated D24 conversions still apply. The new restricted-depth CTest covers a device created without the extension even on hardware that supports it.

The edge-value test overlaps with #307, which addresses AMD drivers that canonicalize NaN. The mesh query issue in #506 is separate.

Tested

Windows 11 26100.7623, MSVC 19.44.35220 Release, Vulkan validation layer 1.4.369 with LEONIDA_VK_VALIDATION=1.

  • On main c023a365, d3d12_clear reports four instances of the VUID. With the fix, it passes with no validation errors, with 232 full and rectangle readbacks matching WARP and the float edge cases matching bit for bit.
  • d3d12_clear_restricted_depth fails before the fix and passes after it. It checks the finite out-of-range and NaN cases for full and rectangle clears, plus a zero-flag no-op.
  • vk_command_replay and d3d12_depth_view_format_support also pass. Four targeted tests in total.

GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 610.74, Windows 11.

AI-assisted: yes (OpenAI Codex).

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption. All tests use synthetic fixtures.
  • New translator rule (not applicable).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/516 **Author:** [@sodove](https://github.com/sodove) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@QemmHD](https://github.com/QemmHD) **Base:** `main` ← **Head:** `fix/d3d12-clear-depth-range` --- ### 📝 Commits (2) - [`673dd15`](https://github.com/ubiquitarianism/leonida/commit/673dd15d0ed6cf41428d1931601a69e9f2233ee1) d3d12: use legal Vulkan depth clear values (D3D-CLEAR-DEPTH-RANGE) - [`86b069f`](https://github.com/ubiquitarianism/leonida/commit/86b069f1d953d3422435b08e9fd9302e3de9104c) docs: record observed D3D12 depth clear semantics ### 📊 Changes **8 files changed** (+57 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+5 -0) 📝 `runtime/CMakeLists.txt` (+2 -1) 📝 `runtime/shims/d3d12_com.h` (+1 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+3 -0) 📝 `runtime/src/vulkan_backend.h` (+5 -0) 📝 `runtime/src/vulkan_replay.h` (+8 -4) 📝 `runtime/test/d3d12_clear_test.cpp` (+26 -16) 📝 `runtime/test/vk_test_device.h` (+7 -0) </details> ### 📄 Description Claimed in the coordination issue as: D3D-CLEAR-DEPTH-RANGE ([#14](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7124229097)) ### What and why This addresses the depth-clear half of #506. Both full and rectangle clears currently pass unrestricted float depth values to Vulkan on devices that did not enable VK_EXT_depth_range_unrestricted, triggering VUID-VkClearDepthStencilValue-depth-00022. Enable the extension on standalone devices that advertise it and carry the enabled capability through caller-owned device info to replay. With the extension, float depth clears can preserve the requested value. Without it, replay clamps depth to [0, 1] and uses 0 for NaN. The existing D16 and emulated D24 conversions still apply. The new restricted-depth CTest covers a device created without the extension even on hardware that supports it. The edge-value test overlaps with #307, which addresses AMD drivers that canonicalize NaN. The mesh query issue in #506 is separate. ### Tested Windows 11 26100.7623, MSVC 19.44.35220 Release, Vulkan validation layer 1.4.369 with LEONIDA_VK_VALIDATION=1. - On main c023a365, d3d12_clear reports four instances of the VUID. With the fix, it passes with no validation errors, with 232 full and rectangle readbacks matching WARP and the float edge cases matching bit for bit. - d3d12_clear_restricted_depth fails before the fix and passes after it. It checks the finite out-of-range and NaN cases for full and rectangle clears, plus a zero-flag no-op. - vk_command_replay and d3d12_depth_view_format_support also pass. Four targeted tests in total. GPUs tested: NVIDIA GeForce RTX 5070 Ti, driver 610.74, Windows 11. AI-assisted: yes (OpenAI Codex). ### Checklist - [x] Based on current main. - [x] One topic. - [x] No game data, keys or decryption. All tests use synthetic fixtures. - [ ] New translator rule (not applicable). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:18 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#564
No description provided.