[PR #815] d3d12: support hardware depth-bounds testing and OMSetDepthBounds #853

Open
opened 2026-11-26 20:19:16 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/815
Author: @kotekompotek
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: work/d3d12-depth-bounds-test


📝 Commits (1)

  • a635392 d3d12: support hardware depth-bounds testing and OMSetDepthBounds

📊 Changes

13 files changed (+142 additions, -18 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+7 -2)
📝 runtime/shims/d3d12_com.cpp (+32 -2)
📝 runtime/shims/d3d12_com.h (+3 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+20 -10)
📝 runtime/src/command_list.h (+2 -0)
📝 runtime/src/vulkan_backend.h (+2 -1)
📝 runtime/src/vulkan_replay.h (+10 -0)
📝 runtime/test/d3d12_bundle_forbidden_test.cpp (+3 -0)
📝 runtime/test/d3d12_close_parity_test.cpp (+35 -0)
📝 runtime/test/d3d12_com_test.cpp (+16 -1)
📝 runtime/test/d3d12_mesh_test.cpp (+9 -1)
📝 runtime/test/d3d12_vulkan_device_test.cpp (+2 -1)
📝 runtime/test/vk_test_device.h (+1 -0)

📄 Description

Claimed in the coordination issue as: D3D-DEPTH-BOUNDS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149)

What and why

  • Rebased onto current main.
  • Implemented hardware depth-bounds testing (DEPTH_STENCIL1/DEPTH_STENCIL2 DepthBoundsTestEnable, VK_DYNAMIC_STATE_DEPTH_BOUNDS, ID3D12GraphicsCommandList1::OMSetDepthBounds, OPTIONS2::DepthBoundsTestSupported).
  • Updated OMSetDepthBounds in runtime/shims/d3d12_com.cpp to support bundles via defer() and match D3D12 Close() == S_OK on <0, >1, min>max, and NaN (sanitized cleanly to Vulkan [0, 1] or empty [1, 0] in runtime/src/vulkan_replay.h).
  • Wired info.features.depthBounds = d.enabled.depthBounds in d3d12_mesh_test.cpp and d3d12_vulkan_device_test.cpp; expanded d3d12_com_test.cpp, d3d12_bundle_forbidden_test.cpp, d3d12_close_parity_test.cpp, and synced docs/d3d12_vulkan.md.

Tested

  • d3d12_com: Passed.
  • d3d12_bundle_forbidden: 11/11 vs host GTX 1050 & WARP (0 failures).
  • d3d12_close_parity: all 5 OMSetDepthBounds cases match WARP.
  • d3d12_vulkan_device (compare_feature_options): 32 feature queries, 0 mismatches.
  • d3d12_mesh_test.cpp compiled /W4, and test_ctest_registration.py + test_docs_*.py: OK.

GPUs tested: NVIDIA GeForce GTX 1050 (driver 582.28, Windows) & Microsoft Basic Render Driver (WARP)

AI-assisted: yes

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed.

🔄 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/815 **Author:** [@kotekompotek](https://github.com/kotekompotek) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `work/d3d12-depth-bounds-test` --- ### 📝 Commits (1) - [`a635392`](https://github.com/ubiquitarianism/leonida/commit/a635392c6b420ea690e45006b2c36711dccfefdb) d3d12: support hardware depth-bounds testing and OMSetDepthBounds ### 📊 Changes **13 files changed** (+142 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+7 -2) 📝 `runtime/shims/d3d12_com.cpp` (+32 -2) 📝 `runtime/shims/d3d12_com.h` (+3 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+20 -10) 📝 `runtime/src/command_list.h` (+2 -0) 📝 `runtime/src/vulkan_backend.h` (+2 -1) 📝 `runtime/src/vulkan_replay.h` (+10 -0) 📝 `runtime/test/d3d12_bundle_forbidden_test.cpp` (+3 -0) 📝 `runtime/test/d3d12_close_parity_test.cpp` (+35 -0) 📝 `runtime/test/d3d12_com_test.cpp` (+16 -1) 📝 `runtime/test/d3d12_mesh_test.cpp` (+9 -1) 📝 `runtime/test/d3d12_vulkan_device_test.cpp` (+2 -1) 📝 `runtime/test/vk_test_device.h` (+1 -0) </details> ### 📄 Description Claimed in the coordination issue as: D3D-DEPTH-BOUNDS (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7140050149) ### What and why - Rebased onto current `main`. - Implemented hardware depth-bounds testing (`DEPTH_STENCIL1`/`DEPTH_STENCIL2` `DepthBoundsTestEnable`, `VK_DYNAMIC_STATE_DEPTH_BOUNDS`, `ID3D12GraphicsCommandList1::OMSetDepthBounds`, `OPTIONS2::DepthBoundsTestSupported`). - Updated `OMSetDepthBounds` in `runtime/shims/d3d12_com.cpp` to support bundles via `defer()` and match D3D12 `Close() == S_OK` on `<0`, `>1`, `min>max`, and `NaN` (sanitized cleanly to Vulkan `[0, 1]` or empty `[1, 0]` in `runtime/src/vulkan_replay.h`). - Wired `info.features.depthBounds = d.enabled.depthBounds` in `d3d12_mesh_test.cpp` and `d3d12_vulkan_device_test.cpp`; expanded `d3d12_com_test.cpp`, `d3d12_bundle_forbidden_test.cpp`, `d3d12_close_parity_test.cpp`, and synced `docs/d3d12_vulkan.md`. ### Tested - `d3d12_com`: `Passed`. - `d3d12_bundle_forbidden`: `11/11` vs host GTX 1050 & WARP (`0 failures`). - `d3d12_close_parity`: all 5 `OMSetDepthBounds` cases match WARP. - `d3d12_vulkan_device` (`compare_feature_options`): `32 feature queries, 0 mismatches`. - `d3d12_mesh_test.cpp` compiled `/W4`, and `test_ctest_registration.py` + `test_docs_*.py`: `OK`. GPUs tested: NVIDIA GeForce GTX 1050 (driver 582.28, Windows) & Microsoft Basic Render Driver (WARP) AI-assisted: yes ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#853
No description provided.