d3d12: support hardware depth-bounds testing and OMSetDepthBounds #815

Open
github-bot wants to merge 1 commit from github-bot/gh-815 into main AGit
Owner

@⁠kotekompotek on GitHub · 2026-11-24 14:09 UTC · original
kotekompotek:work/d3d12-depth-bounds-test → main · +142 −18 · 13 files · 1 commits · open

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

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.
**@⁠kotekompotek** on GitHub · 2026-11-24 14:09 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815) `kotekompotek:work/d3d12-depth-bounds-test` → `main` · +142 −18 · 13 files · 1 commits · open Claimed in the coordination issue as: D3D-DEPTH-BOUNDS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:22:42 +00:00
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:18 UTC · original · approved these changes

Clean-Room Peer Review for PR #815 (d3d12: support hardware depth-bounds testing and OMSetDepthBounds)

Comprehensive technical evaluation of D3D12 <-> Vulkan dynamic depth-bounds translation:

  • API Specification Parity:
    • GraphicsCommandList::OMSetDepthBounds strictly adheres to ID3D12GraphicsCommandList1 spec.
    • Correctly rejects command bundles (D3D12_COMMAND_LIST_TYPE_BUNDLE) via check(false).
    • Rigorous range validation: !(min >= 0.0f && max <= 1.0f && min <= max) guards against inverted or out-of-range bounds, including NaN values.
    • State reset (
      eset_state) restores default [0.0f, 1.0f] range on pipeline recycling.
  • Vulkan Backend Replay Integration:
    • prepare_draw guards against unsupported depth-bounds test requests if k.set_depth_bounds function pointer is absent.
    • emit accurately binds dynamic state via k.set_depth_bounds(command_buffer, draw->min_depth_bounds, draw->max_depth_bounds).
  • Test Suite Verification:

untime/test/d3d12_com_test.cpp: Verified retrieval and storage of dynamic depth bounds [0.25f, 0.75f].

untime/test/d3d12_mesh_test.cpp: Dynamic capability query against D3D12_FEATURE_D3D12_OPTIONS2::DepthBoundsTestSupported.

untime/test/d3d12_vulkan_device_test.cpp: Local invariant checks updated.

  • Clean-room verification: Zero game data, strict C++20 compliance, clean MSVC/Clang compatibility.

LGTM! Excellent implementation and test coverage. Approved.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:18 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#pullrequestreview-6040859130) · **approved these changes** ### Clean-Room Peer Review for PR #815 (d3d12: support hardware depth-bounds testing and OMSetDepthBounds) Comprehensive technical evaluation of D3D12 <-> Vulkan dynamic depth-bounds translation: - **API Specification Parity**: - GraphicsCommandList::OMSetDepthBounds strictly adheres to ID3D12GraphicsCommandList1 spec. - Correctly rejects command bundles (D3D12_COMMAND_LIST_TYPE_BUNDLE) via check(false). - Rigorous range validation: !(min >= 0.0f && max <= 1.0f && min <= max) guards against inverted or out-of-range bounds, including NaN values. - State reset ( eset_state) restores default [0.0f, 1.0f] range on pipeline recycling. - **Vulkan Backend Replay Integration**: - prepare_draw guards against unsupported depth-bounds test requests if k.set_depth_bounds function pointer is absent. - emit accurately binds dynamic state via k.set_depth_bounds(command_buffer, draw->min_depth_bounds, draw->max_depth_bounds). - **Test Suite Verification**: - untime/test/d3d12_com_test.cpp: Verified retrieval and storage of dynamic depth bounds [0.25f, 0.75f]. - untime/test/d3d12_mesh_test.cpp: Dynamic capability query against D3D12_FEATURE_D3D12_OPTIONS2::DepthBoundsTestSupported. - untime/test/d3d12_vulkan_device_test.cpp: Local invariant checks updated. - **Clean-room verification**: Zero game data, strict C++20 compliance, clean MSVC/Clang compatibility. LGTM! Excellent implementation and test coverage. Approved.
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 14:26 UTC · original · approved these changes

Clean-room verified (zero game data). Complete implementation of D3D12 depth-bounds testing: OPTIONS2 feature query, ID3D12GraphicsCommandList1::OMSetDepthBounds, dynamic state wiring in Vulkan context via depthBounds / vkCmdSetDepthBounds, and comprehensive tests.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 14:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#pullrequestreview-6041015607) · **approved these changes** Clean-room verified (zero game data). Complete implementation of D3D12 depth-bounds testing: OPTIONS2 feature query, ID3D12GraphicsCommandList1::OMSetDepthBounds, dynamic state wiring in Vulkan context via depthBounds / vkCmdSetDepthBounds, and comprehensive tests.
Author
Owner

@⁠moffington on GitHub · 2026-11-24 15:37 UTC · original

Reviewed 2f9bee487 on RTX 3060 / Linux / Wine 11.20 with Vulkan validation enabled.

All five focused regression tests passed on baseline and HEAD. Independent pixel readback also confirmed correct depth-bounds clipping, default bounds, ClearState reset, pipeline switching, and no-DSV draws. Feature-disabled handling worked as expected.

Found two API compatibility issues:

No draw-time or pipeline-creation Vulkan validation errors observed. Native Windows parity was not tested.

**@⁠moffington** on GitHub · 2026-11-24 15:37 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7136339246) Reviewed `2f9bee487` on RTX 3060 / Linux / Wine 11.20 with Vulkan validation enabled. All five focused regression tests passed on baseline and HEAD. Independent pixel readback also confirmed correct depth-bounds clipping, default bounds, ClearState reset, pipeline switching, and no-DSV draws. Feature-disabled handling worked as expected. Found two API compatibility issues: - `OMSetDepthBounds` rejects bundle command lists, causing `Close()` to return `E_INVALIDARG`. Microsoft's [[command list restrictions](https://learn.microsoft.com/en-us/windows/win32/direct3d12/recording-command-lists-and-bundles#command-list-api-restrictions)](https://learn.microsoft.com/en-us/windows/win32/direct3d12/recording-command-lists-and-bundles#command-list-api-restrictions) explicitly permit this operation in bundles. Could this use `defer(...)` like `OMSetStencilRef`? - NaN bounds also cause `Close()` to return `E_INVALIDARG`, whereas the [[OMSetDepthBounds documentation](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist1-omsetdepthbounds)](https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist1-omsetdepthbounds) specifies that NaN values silently convert to zero. No draw-time or pipeline-creation Vulkan validation errors observed. Native Windows parity was not tested.
Author
Owner

@⁠Sangonapou on GitHub · 2026-11-24 15:45 UTC · original

Tested 2f9bee48 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: the three tests pass, but the depth-bounds path itself is not reached on this GPU

Built at this head with scripts\build_runtime.ps1 (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0); llvm-mc 23.1.6, SPIRV-Tools 2026.4. No game files.

  • d3d12_com, d3d12_mesh, d3d12_vulkan_device (ctest, verbose): all pass, e.g. COM list/queue/fence: 16 colour, depth and stencil texels matched and DispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels.
  • But in d3d12_mesh the runtime logs depth-bounds testing needs depthBounds, which the device lacks; enabled 1, i.e. the DepthBoundsTestEnable PSO is refused (d3d12_vulkan_device.cpp:3853, !features.depthBounds). This GPU does support it: vulkaninfo reports depthBounds = true. So the test passes through its "not supported" branch here and the enabled path (vkCmdSetDepthBounds, OMSetDepthBounds) is never exercised on capable hardware.
  • This is the native Windows run @⁠moffington noted as untested above. Under Wine their pixel readback confirmed real depth-bounds clipping, so the difference looks like which features the native device enables, not the replay itself.
  • My guess, not checked further: enable.depthBounds = chosen_features.depthBounds (:9812) is in the standalone device's creation, while the device these tests run on is created without depthBounds in its enabled features, so device_.info.features.depthBounds stays false. Happy to rerun once that is sorted out.
**@⁠Sangonapou** on GitHub · 2026-11-24 15:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7136563517) Tested 2f9bee48 on NVIDIA GeForce RTX 3080 Ti Laptop (Ampere), NVIDIA 621.24, Vulkan 1.4.357, Windows 11 Pro (build 26300), native Windows: the three tests pass, but the depth-bounds path itself is not reached on this GPU Built at this head with `scripts\build_runtime.ps1` (MSVC 19.51, VS Build Tools 2026, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0); `llvm-mc` 23.1.6, SPIRV-Tools 2026.4. No game files. - `d3d12_com`, `d3d12_mesh`, `d3d12_vulkan_device` (ctest, verbose): all pass, e.g. `COM list/queue/fence: 16 colour, depth and stencil texels matched` and `DispatchMesh over X, Y and Z and a stream VS draw matched all 4096 pixels`. - But in `d3d12_mesh` the runtime logs `depth-bounds testing needs depthBounds, which the device lacks; enabled 1`, i.e. the `DepthBoundsTestEnable` PSO is refused (`d3d12_vulkan_device.cpp:3853`, `!features.depthBounds`). This GPU does support it: `vulkaninfo` reports `depthBounds = true`. So the test passes through its "not supported" branch here and the enabled path (`vkCmdSetDepthBounds`, `OMSetDepthBounds`) is never exercised on capable hardware. - This is the native Windows run @⁠moffington noted as untested above. Under Wine their pixel readback confirmed real depth-bounds clipping, so the difference looks like which features the native device enables, not the replay itself. - My guess, not checked further: `enable.depthBounds = chosen_features.depthBounds` (`:9812`) is in the standalone device's creation, while the device these tests run on is created without `depthBounds` in its enabled features, so `device_.info.features.depthBounds` stays false. Happy to rerun once that is sorted out.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-24 18:07 UTC · original

@⁠moffington @⁠Sangonapou Thanks for the thorough review and WARP/bundle parity findings — addressed in b3ca7b584:

  • 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 docs/d3d12_vulkan.md.
  • Claimed D3D-DEPTH-BOUNDS in coordination issue #14: #14

Locally verified:

  • 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
**@⁠kotekompotek** on GitHub · 2026-11-24 18:07 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7140187835) @⁠moffington @⁠Sangonapou Thanks for the thorough review and WARP/bundle parity findings — addressed in `b3ca7b584`: - 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 `docs/d3d12_vulkan.md`. - Claimed `D3D-DEPTH-BOUNDS` in coordination issue `#14`: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 Locally verified: - `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`
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 02:08 UTC · original

@⁠kotekompotek: a data point on why this matters. fxceless/victory-fork (a VIctory fork that renders gameplay on an RTX 4070) just landed the same thing in its commit c96b4f2 ("The depth bounds test works"): pipelines with depth bounds created from a DEPTH_STENCIL1 stream, and the title's OMSetDepthBounds reaching the host list. Before that, those draws passed at every depth. Their note says the first gameplay room is now lit by its lamp for the first time.

On main the layer still reports DepthBoundsTestSupported = FALSE and refuses PSOs that enable it (d3d12_vulkan_device.cpp around 6317/6328, logged by d3d12_xs_pso_stream.cpp), so this PR is on the lighting path. It now conflicts with main (after #984). If you rebase it, I'll test the new head on Windows 11 / MSVC / RTX 4070 SUPER, where depthBounds is supported, so the path Sangonapou couldn't reach on the 3080 Ti Laptop should run here, and I'll post the results.

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

**@⁠QemmHD** on GitHub · 2026-11-25 02:08 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7150362068) @⁠kotekompotek: a data point on why this matters. fxceless/victory-fork (a VIctory fork that renders gameplay on an RTX 4070) just landed the same thing in its commit c96b4f2 ("The depth bounds test works"): pipelines with depth bounds created from a DEPTH_STENCIL1 stream, and the title's `OMSetDepthBounds` reaching the host list. Before that, those draws passed at every depth. Their note says the first gameplay room is now lit by its lamp for the first time. On `main` the layer still reports `DepthBoundsTestSupported = FALSE` and refuses PSOs that enable it (`d3d12_vulkan_device.cpp` around 6317/6328, logged by `d3d12_xs_pso_stream.cpp`), so this PR is on the lighting path. It now conflicts with main (after #984). If you rebase it, I'll test the new head on Windows 11 / MSVC / RTX 4070 SUPER, where `depthBounds` is supported, so the path Sangonapou couldn't reach on the 3080 Ti Laptop should run here, and I'll post the results. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 03:12 UTC · original · edited 2026-11-25 04:27 UTC

Retail data point for this PR: on main 3ff2a2adc (native Windows 11, RTX 4070 SUPER), a 300 s boot to a first-run consent page logs 224 CreatePipelineState refusals for depth bounds, the most common PSO failure in the run. So every one of those draws is missing on main today. When you rebase, I'll A/B it on the same boot (refusal count, captures, and whether anything new appears on screen) and post the result here.

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

**@⁠QemmHD** on GitHub · 2026-11-25 03:12 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7151689239) · edited 2026-11-25 04:27 UTC Retail data point for this PR: on main 3ff2a2adc (native Windows 11, RTX 4070 SUPER), a 300 s boot to a first-run consent page logs **224 CreatePipelineState refusals for depth bounds**, the most common PSO failure in the run. So every one of those draws is missing on main today. When you rebase, I'll A/B it on the same boot (refusal count, captures, and whether anything new appears on screen) and post the result here. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 06:39 UTC · original

Rebased onto current main (42537e7b6) as efea97331 — the conflict after #984 is resolved. The head now carries both sides: multiViewport + VK_DYNAMIC_STATE_*_WITH_COUNT and the stencil per-face masks from main, plus this PR's depthBounds feature gate, VK_DYNAMIC_STATE_DEPTH_BOUNDS and OMSetDepthBounds on direct lists and bundles. create_graphics now takes both the stream's StencilFaceMasks and the new GraphicsStreamExtras (depth-bounds flag), so a DEPTH_STENCIL1/2 stream no longer refuses DepthBoundsTestEnable — it is refused only when the device lacks VkPhysicalDeviceFeatures::depthBounds.

Verified locally on Windows / MSVC Debug (GTX 1050, driver 582.28): pso_stream, d3d12_com, d3d12_d24_support pass; d3d12_vulkan_device and d3d12_close_parity build clean and show the same two pre-existing main failures on this machine (the CreateHeap invalid-argument column on the GTX 1050 and the three CopyTextureRegion WARP-annotation rows — unrelated to this change). d3d12_mesh_test is not built here (no glslangValidator).

The head is ready for your RTX 4070 SUPER run — depthBounds is enabled there, so the 224-refusal path you logged should now take the hardware test.

AI-assisted.

**@⁠kotekompotek** on GitHub · 2026-11-25 06:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7155026992) Rebased onto current `main` (`42537e7b6`) as `efea97331` — the conflict after #984 is resolved. The head now carries both sides: `multiViewport` + `VK_DYNAMIC_STATE_*_WITH_COUNT` and the stencil per-face masks from `main`, plus this PR's `depthBounds` feature gate, `VK_DYNAMIC_STATE_DEPTH_BOUNDS` and `OMSetDepthBounds` on direct lists and bundles. `create_graphics` now takes both the stream's `StencilFaceMasks` and the new `GraphicsStreamExtras` (depth-bounds flag), so a DEPTH_STENCIL1/2 stream no longer refuses `DepthBoundsTestEnable` — it is refused only when the device lacks `VkPhysicalDeviceFeatures::depthBounds`. Verified locally on Windows / MSVC Debug (GTX 1050, driver 582.28): `pso_stream`, `d3d12_com`, `d3d12_d24_support` pass; `d3d12_vulkan_device` and `d3d12_close_parity` build clean and show the same two pre-existing `main` failures on this machine (the `CreateHeap` invalid-argument column on the GTX 1050 and the three `CopyTextureRegion` WARP-annotation rows — unrelated to this change). `d3d12_mesh_test` is not built here (no `glslangValidator`). The head is ready for your RTX 4070 SUPER run — `depthBounds` is enabled there, so the 224-refusal path you logged should now take the hardware test. AI-assisted.
Author
Owner

@⁠djrolfes on GitHub · 2026-11-25 07:34 UTC · original

Independent integration review while preparing an RTX 3070 Ti / Linux Wine test of exact efea97331 on main 42537e7b6 (+ separately owned startup fixes): the patch cherry-picks cleanly, but main’s on-demand console-stream realization looks like a missed propagation path. In runtime/shims/d3d12_vulkan_device.cpp, PipelineState::prepare at line ~7059 parses the retained stream and calls create_graphics(stream.graphics, &stream.ms, &stream.as) without stream.extras (or back_stencil). Your eager CreatePipelineState path does pass &stream.extras, so DepthBoundsTestEnable appears to be lost specifically when a pending console stream is realized. This is a code-path observation, not yet a GPU measurement.

I am preserving the exact patch in a separate local test tree and will check the focused synthetic path before retail use; not duplicating implementation ownership. The current runtime probes log 224 depth-bounds stream refusals without this PR, so the feature is relevant beyond conformance. No raw game-derived data included. AI-assisted.

**@⁠djrolfes** on GitHub · 2026-11-25 07:34 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7156015786) Independent integration review while preparing an RTX 3070 Ti / Linux Wine test of exact efea97331 on main 42537e7b6 (+ separately owned startup fixes): the patch cherry-picks cleanly, but main’s on-demand console-stream realization looks like a missed propagation path. In runtime/shims/d3d12_vulkan_device.cpp, PipelineState::prepare at line ~7059 parses the retained stream and calls create_graphics(stream.graphics, &stream.ms, &stream.as) without stream.extras (or back_stencil). Your eager CreatePipelineState path does pass &stream.extras, so DepthBoundsTestEnable appears to be lost specifically when a pending console stream is realized. This is a code-path observation, not yet a GPU measurement. I am preserving the exact patch in a separate local test tree and will check the focused synthetic path before retail use; not duplicating implementation ownership. The current runtime probes log 224 depth-bounds stream refusals without this PR, so the feature is relevant beyond conformance. No raw game-derived data included. AI-assisted.
Author
Owner

@⁠QemmHD on GitHub · 2026-11-25 07:46 UTC · original

Real-boot A/B of this PR at efea97331 on Windows 11, RTX 4070 SUPER (NVIDIA 621.24). The tree also had #1558, and slot 57's native factory was turned off so that pipelines go through the stream path (the configuration that draws the pages correctly, see #939). Same shaders and settings with and without the PR.

  • Main doesn't already cover this. On main c7e82e26e, CheckFeatureSupport(OPTIONS2) still reports DepthBoundsTestSupported = FALSE, and CreatePipelineState refuses every stream with the depth-bounds test on ("depth-bounds tests are not supported yet; stream subobject 21"): 225 refusals per boot, 3 of 3 runs. They only disappear when the slot 57 factory builds those pipelines instead, opaque, which is the picture regression on #939.
  • With this PR: 0 depth-bounds refusals; successful stream pipelines go from 81,267 to 81,491 (+224, exactly the refused ones). Draws recorded in about 220 s go from 21,208-25,296 without it to 39,327 with it, and presents from 2,984-3,329 to 4,723. No new failure; the boot ends at the same later stop with or without it. Peak 19.5 GB private, 10.5 of 12 GB VRAM.
  • Not measured: no OMSetDepthBounds call appears before that stop, so the dynamic bounds stay at their defaults in this phase, and the screens that would use these pipelines visibly aren't reached yet. So this confirms it works and causes no regression, not a visual result.

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

**@⁠QemmHD** on GitHub · 2026-11-25 07:46 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7156228005) Real-boot A/B of this PR at efea97331 on Windows 11, RTX 4070 SUPER (NVIDIA 621.24). The tree also had #1558, and slot 57's native factory was turned off so that pipelines go through the stream path (the configuration that draws the pages correctly, see #939). Same shaders and settings with and without the PR. - **Main doesn't already cover this.** On main c7e82e26e, `CheckFeatureSupport(OPTIONS2)` still reports DepthBoundsTestSupported = FALSE, and `CreatePipelineState` refuses every stream with the depth-bounds test on ("depth-bounds tests are not supported yet; stream subobject 21"): **225 refusals per boot, 3 of 3 runs**. They only disappear when the slot 57 factory builds those pipelines instead, opaque, which is the picture regression on #939. - **With this PR:** 0 depth-bounds refusals; successful stream pipelines go from 81,267 to 81,491 (+224, exactly the refused ones). Draws recorded in about 220 s go from 21,208-25,296 without it to 39,327 with it, and presents from 2,984-3,329 to 4,723. No new failure; the boot ends at the same later stop with or without it. Peak 19.5 GB private, 10.5 of 12 GB VRAM. - **Not measured:** no `OMSetDepthBounds` call appears before that stop, so the dynamic bounds stay at their defaults in this phase, and the screens that would use these pipelines visibly aren't reached yet. So this confirms it works and causes no regression, not a visual result. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠thiefyzheng on GitHub · 2026-11-25 08:33 UTC · original

@⁠djrolfes — picked up your finding as RT-DEPTHBOUNDS-STREAM-EXTRAS (claimed on #1608): #1695, branched from this PR's head efea9733 and Depends on: #815. It passes stream.back_masks?&stream.back_stencil:nullptr, &stream.extras at the resolve_type call site, and mixes those fields into the console path's pipeline cache key (prepare_console_stream hashed only the plain D3D12_DEPTH_STENCIL_DESC, so two console PSOs differing only in depth bounds — or back-face masks — collided). A regression test in d3d12_mesh_test draws a DEPTH_STENCIL1 DepthBoundsTestEnable stream through the lazy path inside OMSetDepthBounds(0,1) / (0.5,1).

Not compiled or GPU-confirmed on the author host; your RTX 3070 Ti / Wine plan would cover exactly the missing run when convenient.

@⁠kotekompotek — welcome to fold #1695 into #815 directly instead of a stacked PR; say the word and I drop the branch. AI-assisted.

**@⁠thiefyzheng** on GitHub · 2026-11-25 08:33 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7157183854) @⁠djrolfes — picked up your finding as RT-DEPTHBOUNDS-STREAM-EXTRAS (claimed on #1608): #1695, branched from this PR's head `efea9733` and `Depends on: #815`. It passes `stream.back_masks?&stream.back_stencil:nullptr, &stream.extras` at the `resolve_type` call site, and mixes those fields into the console path's pipeline cache key (`prepare_console_stream` hashed only the plain `D3D12_DEPTH_STENCIL_DESC`, so two console PSOs differing only in depth bounds — or back-face masks — collided). A regression test in `d3d12_mesh_test` draws a DEPTH_STENCIL1 `DepthBoundsTestEnable` stream through the lazy path inside `OMSetDepthBounds(0,1)` / `(0.5,1)`. Not compiled or GPU-confirmed on the author host; your RTX 3070 Ti / Wine plan would cover exactly the missing run when convenient. @⁠kotekompotek — welcome to fold #1695 into #815 directly instead of a stacked PR; say the word and I drop the branch. AI-assisted.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 09:40 UTC · original

Status at efea97331: the two conformance gaps @⁠moffington reported are both in — OMSetDepthBounds records through defer(...) so bundles accept it, and NaN/out-of-range bounds are accepted at record time and clamped inside Vulkan's 0..1 domain at replay (d3d12_com.cpp:929 comment covers both). Thanks @⁠QemmHD for the 225-refusals A/B on the RTX 4070 SUPER and @⁠Sangonapou for the 3080 Ti run — the "depthBounds not enabled on the test device" path is real, it's why the enabled branch only shows on capable hardware.

@⁠thiefyzheng thanks for picking up @⁠djrolfes's console-stream finding. I'd keep #1695 stacked with Depends on: #815 rather than folding it in: this head is what @⁠QemmHD just A/B-tested, and a stacked PR keeps the cache-key/extras fix reviewable on its own. If a maintainer would rather have one PR I'll fold it in.

**@⁠kotekompotek** on GitHub · 2026-11-25 09:40 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7158645441) Status at `efea97331`: the two conformance gaps @⁠moffington reported are both in — `OMSetDepthBounds` records through `defer(...)` so bundles accept it, and NaN/out-of-range bounds are accepted at record time and clamped inside Vulkan's 0..1 domain at replay (`d3d12_com.cpp:929` comment covers both). Thanks @⁠QemmHD for the 225-refusals A/B on the RTX 4070 SUPER and @⁠Sangonapou for the 3080 Ti run — the "depthBounds not enabled on the test device" path is real, it's why the enabled branch only shows on capable hardware. @⁠thiefyzheng thanks for picking up @⁠djrolfes's console-stream finding. I'd keep #1695 stacked with `Depends on: #815` rather than folding it in: this head is what @⁠QemmHD just A/B-tested, and a stacked PR keeps the cache-key/extras fix reviewable on its own. If a maintainer would rather have one PR I'll fold it in.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 14:24 UTC · original

Rebased onto current main (71a769d7d, post-#1671/#1691/#1703) — a635392c6. One conflict in d3d12_com.cpp record_mesh_draw: kept both the new min/max_depth_bounds_ Draw fields and main's note_direct_heap_indexing(graphics_.layout).

Local run on this box (GTX 1050, driver 582.28, Windows 11, Debug): d3d12_com PASS. Two failures in the run are baseline-on-this-host, not this change:

  • d3d12_vulkan_device heap_mismatches: this host's D3D12 runtime refuses every CreateHeap — handled by #1721.
  • d3d12_close_parity: three CopyTextureRegion upload rows (offset 16, offset 4, row pitch 260) marked stricter now match WARP on current main — main's own table entries, my diff only adds the five OMSetDepthBounds cases (all match WARP, incl. NaN and out-of-range).

@⁠djrolfes the conflict was mechanical; your lazy-path finding is covered separately by @⁠thiefyzheng's #1695 stacked on this PR.

**@⁠kotekompotek** on GitHub · 2026-11-25 14:24 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/815#issuecomment-7165237050) Rebased onto current main (71a769d7d, post-#1671/#1691/#1703) — `a635392c6`. One conflict in `d3d12_com.cpp` record_mesh_draw: kept both the new `min/max_depth_bounds_` Draw fields and main's `note_direct_heap_indexing(graphics_.layout)`. Local run on this box (GTX 1050, driver 582.28, Windows 11, Debug): `d3d12_com` PASS. Two failures in the run are baseline-on-this-host, not this change: - `d3d12_vulkan_device` `heap_mismatches`: this host's D3D12 runtime refuses every CreateHeap — handled by #1721. - `d3d12_close_parity`: three `CopyTextureRegion upload` rows (offset 16, offset 4, row pitch 260) marked `stricter` now match WARP on current main — main's own table entries, my diff only adds the five `OMSetDepthBounds` cases (all match WARP, incl. NaN and out-of-range). @⁠djrolfes the conflict was mechanical; your lazy-path finding is covered separately by @⁠thiefyzheng's #1695 stacked on this PR.
This pull request has changes conflicting with the target branch.
  • runtime/shims/d3d12_com.cpp
  • runtime/shims/d3d12_com.h
  • runtime/shims/d3d12_vulkan_device.cpp
  • runtime/src/vulkan_backend.h
  • runtime/src/vulkan_replay.h
  • runtime/test/d3d12_mesh_test.cpp
  • runtime/test/d3d12_vulkan_device_test.cpp
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/815/head:github-bot/gh-815'
git switch 'github-bot/gh-815'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-815'
git switch 'github-bot/gh-815'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-815'
git switch 'github-bot/gh-815'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-815'
git switch 'main'
git merge --squash 'github-bot/gh-815'
git switch 'main'
git merge --ff-only 'github-bot/gh-815'
git switch 'main'
git merge 'github-bot/gh-815'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.