mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:25:53 +01:00
[PR #469] [CLOSED] d3d12/vulkan: implement hardware depth-bounds testing (D3D-DEPTH-BOUNDS) #520
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#520
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/469
Author: @jujumoneylol
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:pr/d3d12-depth-bounds📝 Commits (1)
b75e451d3d12/vulkan: implement hardware depth-bounds testing (DEPTH_STENCIL1/2 + OMSetDepthBounds)📊 Changes
12 files changed (+605 additions, -36 deletions)
View changed files
📝
runtime/CMakeLists.txt(+9 -0)📝
runtime/shims/d3d12_com.cpp(+18 -0)📝
runtime/shims/d3d12_com.h(+1 -1)📝
runtime/shims/d3d12_vulkan_device.cpp(+31 -30)📝
runtime/src/command_list.h(+2 -0)📝
runtime/src/vulkan_backend.h(+4 -3)📝
runtime/src/vulkan_replay.h(+12 -0)➕
runtime/test/d3d12_depth_bounds_test.cpp(+503 -0)📝
runtime/test/d3d12_mesh_test.cpp(+7 -1)📝
runtime/test/d3d12_vulkan_device_test.cpp(+16 -1)📝
runtime/test/replay_cpu_bench.cpp(+1 -0)📝
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-7123223139)
What and why
Implements hardware depth-bounds testing end-to-end in the D3D12 → Vulkan runtime, clearing one of the live frame-loop PSO stream refusals recorded in
docs/retail_boot_intel_host.mdsection 3 (depth-bounds stream subobject):VkPhysicalDeviceFeatures::depthBoundswhere advertised by the GPU increate_vulkan_device_standalone(runtime/shims/d3d12_vulkan_device.cpp) andvktest::Device(runtime/test/vk_test_device.h), exposing it throughVulkanDeviceInfo::features.depthBounds.D3D12_FEATURE_DATA_D3D12_OPTIONS2::DepthBoundsTestSupported = state_.info.features.depthBounds ? TRUE : FALSEinstead of hardcodedFALSE.DEPTH_STENCIL1/DEPTH_STENCIL2):parse_pipeline_streamrecordsDepthBoundsTestEnablefromD3D12_PIPELINE_STATE_SUBOBJECT_TYPE_DEPTH_STENCIL1andDEPTH_STENCIL2instead of unconditionally returningE_NOTIMPL.PipelineState::create_graphicsenablesVkPipelineDepthStencilStateCreateInfo::depthBoundsTestEnable, refuses withE_NOTIMPLonly whenVulkanDeviceInfo::features.depthBoundsis false, and appendsVK_DYNAMIC_STATE_DEPTH_BOUNDSto the dynamic state list (for both regular and mesh PSOs) when enabled.OMSetDepthBounds→vkCmdSetDepthBounds):ID3D12GraphicsCommandList1::OMSetDepthBounds(Min, Max)inruntime/shims/d3d12_com.cpp(defaults to[0.0f, 1.0f]on create/reset, refused in bundles per D3D12 spec), carries(depth_bounds_min, depth_bounds_max)onleonida::Drawfor both vertex and mesh draws, and replaysvkCmdSetDepthBounds(clamped to[0.0f, 1.0f]/ NaN-safe for Vulkan spec compliance) inruntime/src/vulkan_replay.h.runtime/test/d3d12_depth_bounds_test.cpp(in-memory SPIR-V 1.3 fullscreen VS + solid PS, no external shader compiler needed) verifying feature reporting, feature-offE_NOTIMPLrefusal, bundle refusal, and 8 live GPU draw cases compared pixel-for-pixel against the host Windows D3D12 runtime on the same adapter.d3d12_vulkan_device_test(OPTIONS2.DepthBoundsTestSupportedinvariant + toggle test),d3d12_mesh_test(DepthBoundsTestEnablefollowsvk.enabled.depthBounds), andreplay_cpu_bench.Tested
d3d12_depth_bounds_test,d3d12_vulkan_device_test, andreplay_cpu_benchwith MSVC 19.44 (vcvars64) + Ninja on top ofmain8f481cf16.d3d12_depth_bounds_test: ALL 8 CASES PASSED (EXACT MATCH vs host D3D12) on NVIDIA GeForce GTX 1650 (DepthBoundsTestSupported=TRUE), matching host pixels bit-for-bit across default[0.0, 1.0],[0.25, 0.75]pass,[0.6, 0.9]reject,[0.1, 0.4]reject,[0.5, 0.5]inclusive boundary pass,DEPTH_STENCIL2pass/reject, andReset()restoring[0.0, 1.0], plus feature-offE_NOTIMPLand bundle refusal checks.d3d12_vulkan_device_test: PASSED (including newOPTIONS2.DepthBoundsTestSupportedhost parity and toggle check).py -3.13 -I scripts/check_no_game_data.pyon all 12 touched files: clean.GPUs tested: NVIDIA GeForce GTX 1650 Mobile 4 GB (driver 592.00, Vulkan 1.4.325, Windows 11 26200)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a — D3D12 → Vulkan runtime only)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.