d3d12: preserve float DepthBias in RASTERIZER1 and RASTERIZER2 streams #806

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

@⁠kotekompotek on GitHub · 2026-11-24 14:02 UTC · original
kotekompotek:work/d3d12-rasterizer-float-depth-bias → main · +187 −16 · 5 files · 1 commits · open

Claimed in the coordination issue as: D3D-RASTERIZER-FLOAT-BIAS (#14)

What and why

  • Rebased onto current main.
  • Preserved FLOAT DepthBias in RASTERIZER1 and RASTERIZER2 pipeline streams (runtime/shims/d3d12_vulkan_device.cpp and runtime/src/depth24_fragment.h).
  • Updated runtime/test/d3d12_bundle_test.cpp (Vertex input layout order/formats, SubTopology triangle topology, CullMode = D3D12_CULL_MODE_NONE, 64x64 DXGI_FORMAT_D24_UNORM_S8_UINT depth buffer + GREATER depth test comparing 1.5f vs 0.0f for RASTERIZER1/RASTERIZER2), added depth24_bias_constant unit assertions in runtime/test/d3d12_d24_support_test.cpp, and synced docs/d3d12_vulkan.md.

Tested

  • Built d3d12_com_test and d3d12_d24_support_test and ran d3d12_com & d3d12_d24_support (2/2 Passed on NVIDIA GeForce GTX 1050).
  • Ran tests/test_ctest_registration.py (4/4 OK).
  • Note: d3d12_bundle_test was not compiled locally because glslangValidator is absent in this environment.

GPUs tested: NVIDIA GeForce GTX 1050 (driver 582.28, Windows)

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:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806) `kotekompotek:work/d3d12-rasterizer-float-depth-bias` → `main` · +187 −16 · 5 files · 1 commits · open Claimed in the coordination issue as: D3D-RASTERIZER-FLOAT-BIAS (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14) ### What and why - Rebased onto current `main`. - Preserved `FLOAT DepthBias` in `RASTERIZER1` and `RASTERIZER2` pipeline streams (`runtime/shims/d3d12_vulkan_device.cpp` and `runtime/src/depth24_fragment.h`). - Updated `runtime/test/d3d12_bundle_test.cpp` (`Vertex` input layout order/formats, `SubTopology` triangle topology, `CullMode = D3D12_CULL_MODE_NONE`, `64x64` `DXGI_FORMAT_D24_UNORM_S8_UINT` depth buffer + `GREATER` depth test comparing `1.5f` vs `0.0f` for `RASTERIZER1`/`RASTERIZER2`), added `depth24_bias_constant` unit assertions in `runtime/test/d3d12_d24_support_test.cpp`, and synced `docs/d3d12_vulkan.md`. ### Tested - Built `d3d12_com_test` and `d3d12_d24_support_test` and ran `d3d12_com` & `d3d12_d24_support` (`2/2 Passed` on NVIDIA GeForce GTX 1050). - Ran `tests/test_ctest_registration.py` (`4/4 OK`). - Note: `d3d12_bundle_test` was not compiled locally because `glslangValidator` is absent in this environment. GPUs tested: NVIDIA GeForce GTX 1050 (driver 582.28, Windows) 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:13 +00:00
Author
Owner

@⁠KernelSmoker on GitHub · 2026-11-24 14:04 UTC · original · reviewed

Linux review of the stream-to-rasterizer path only. The parser retains the original float for RASTERIZER1/2, and create_graphics uses it for both the D24 fragment-bias conversion and Vulkan rasterizer bias; legacy/base rasterizer descriptions still use their integer field. I found no issue in those paths by inspection.

I could not run d3d12_bundle_test on this Bazzite host: CMake builds that target only for Windows, and the local Vulkan device creation currently fails. The Windows hosted check is still queued, so this is not a test-pass report.

**@⁠KernelSmoker** on GitHub · 2026-11-24 14:04 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806#pullrequestreview-6040627183) · **reviewed** Linux review of the stream-to-rasterizer path only. The parser retains the original float for RASTERIZER1/2, and `create_graphics` uses it for both the D24 fragment-bias conversion and Vulkan rasterizer bias; legacy/base rasterizer descriptions still use their integer field. I found no issue in those paths by inspection. I could not run `d3d12_bundle_test` on this Bazzite host: CMake builds that target only for Windows, and the local Vulkan device creation currently fails. The Windows hosted check is still queued, so this is not a test-pass report.
Author
Owner

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

I was able to run d3d12_bundle_test on RTX 3060 / Linux / Wine with Vulkan validation enabled at 278cc0fa.

The new RASTERIZER2 test fails at line 802 because the pipeline stream omits D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY (primitive topology type not supported: 0). The merge-base test passes.

Additionally, the new test has no depth target or depth-bias assertion, so it wouldn't catch a regression to integer truncation even after fixing pipeline creation.

Independent depth-buffer readback probes confirmed that fractional and negative biases (+0.5, -0.5, -2.5) are preserved across D16_UNORM, D24_UNORM_S8_UINT and D32_FLOAT on HEAD, whereas baseline truncates them. No new Vulkan validation errors observed.

The runtime implementation looks good. Could the regression test include the topology subobject and verify biased depth readback or depth-test behavior?

**@⁠moffington** on GitHub · 2026-11-24 15:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806#issuecomment-7136735484) I was able to run `d3d12_bundle_test` on RTX 3060 / Linux / Wine with Vulkan validation enabled at `278cc0fa`. The new RASTERIZER2 test fails at line 802 because the pipeline stream omits `D3D12_PIPELINE_STATE_SUBOBJECT_TYPE_PRIMITIVE_TOPOLOGY` (`primitive topology type not supported: 0`). The merge-base test passes. Additionally, the new test has no depth target or depth-bias assertion, so it wouldn't catch a regression to integer truncation even after fixing pipeline creation. Independent depth-buffer readback probes confirmed that fractional and negative biases (+0.5, -0.5, -2.5) are preserved across D16_UNORM, D24_UNORM_S8_UINT and D32_FLOAT on HEAD, whereas baseline truncates them. No new Vulkan validation errors observed. The runtime implementation looks good. Could the regression test include the topology subobject and verify biased depth readback or depth-test behavior?
Author
Owner

@⁠Timon360SB on GitHub · 2026-11-24 16:27 UTC · original

Independent testing results

Reproduced the RASTERIZER2 pipeline creation failure
reported previously by @⁠moffington, this time on two
native Windows 11 systems with different NVIDIA GPU
architectures.

Tested revisions

  • BASE: f3e26be7c661e97eb4c70464e675a3b32dc149e3
  • HEAD: 278cc0fa6c010cd52ba6919adac90fb3ad165c23

Test environments

Component System 1 System 2
CPU AMD Ryzen 7 7800X3D AMD Ryzen 5 3600X
GPU NVIDIA GeForce RTX 5070 NVIDIA GeForce RTX 2060 SUPER
Architecture Blackwell Turing
VRAM 12227 MiB 8192 MiB
RAM (reported) 31.11 GiB 15.93 GiB
GPU driver 621.14 621.14
OS Windows 11 Pro (26200) Windows 11 Pro (28000)
Windows SDK 10.0.26100.0 10.0.28000.0
Vulkan SDK 1.4.363.0 1.4.363.0
MSVC 19.44.35230 19.44.35230
Resizable BAR Enabled Disabled

Test configuration

  • Build configuration: RelWithDebInfo
  • Build generator: Ninja Multi-Config
  • Build scope: selected targets
  • Vulkan validation: enabled
  • GPU-assisted validation: enabled
  • Synchronization validation: enabled
  • Repetitions: 3 per revision on each system
  • Total queue attempts: 3
  • Synthetic fixtures only

Both revisions compiled successfully on both systems.

CTest results

Initial attempt:

Test RTX 5070 BASE RTX 5070 HEAD RTX 2060 SUPER BASE RTX 2060 SUPER HEAD
d3d12_bundle 3/3 0/3 3/3 0/3
d3d12_com 3/3 3/3 3/3 3/3
d3d12_d24_support 3/3 3/3 3/3 3/3
d3d12_state_sweep 3/3 3/3 3/3 3/3
vk_sync_validation 3/3 3/3 3/3 3/3
Total PASS 15/15 12/15 15/15 12/15

Failure reproducibility

Two additional attempts were performed on both systems.

Successful BASE checkpoints were reused, while HEAD
tests were executed again. Reused BASE results are
not counted as independent executions.

Test RTX 5070 HEAD RTX 2060 SUPER HEAD
d3d12_bundle 0/9 0/9
d3d12_com 9/9 9/9
d3d12_d24_support 9/9 9/9
d3d12_state_sweep 9/9 9/9
vk_sync_validation 9/9 9/9
Total PASS 36/45 36/45

Actual executions, excluding reused checkpoints:

  • BASE: 30/30 PASS
  • HEAD: 72/90 PASS
  • Combined: 102/120 PASS
  • FAIL: 18
  • SKIP: 0

The d3d12_bundle failure reproduced in all 18 HEAD
executions across both hardware configurations.

RASTERIZER2 pipeline creation failure

All failing executions reported the same diagnostic:

**@⁠Timon360SB** on GitHub · 2026-11-24 16:27 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806#issuecomment-7137702878) ## Independent testing results Reproduced the RASTERIZER2 pipeline creation failure reported previously by @⁠moffington, this time on two native Windows 11 systems with different NVIDIA GPU architectures. ### Tested revisions - BASE: `f3e26be7c661e97eb4c70464e675a3b32dc149e3` - HEAD: `278cc0fa6c010cd52ba6919adac90fb3ad165c23` ### Test environments | Component | System 1 | System 2 | |---|---|---| | CPU | AMD Ryzen 7 7800X3D | AMD Ryzen 5 3600X | | GPU | NVIDIA GeForce RTX 5070 | NVIDIA GeForce RTX 2060 SUPER | | Architecture | Blackwell | Turing | | VRAM | 12227 MiB | 8192 MiB | | RAM (reported) | 31.11 GiB | 15.93 GiB | | GPU driver | 621.14 | 621.14 | | OS | Windows 11 Pro (26200) | Windows 11 Pro (28000) | | Windows SDK | 10.0.26100.0 | 10.0.28000.0 | | Vulkan SDK | 1.4.363.0 | 1.4.363.0 | | MSVC | 19.44.35230 | 19.44.35230 | | Resizable BAR | Enabled | Disabled | ### Test configuration - Build configuration: RelWithDebInfo - Build generator: Ninja Multi-Config - Build scope: selected targets - Vulkan validation: enabled - GPU-assisted validation: enabled - Synchronization validation: enabled - Repetitions: 3 per revision on each system - Total queue attempts: 3 - Synthetic fixtures only Both revisions compiled successfully on both systems. ### CTest results Initial attempt: | Test | RTX 5070 BASE | RTX 5070 HEAD | RTX 2060 SUPER BASE | RTX 2060 SUPER HEAD | |---|---:|---:|---:|---:| | `d3d12_bundle` | 3/3 | 0/3 | 3/3 | 0/3 | | `d3d12_com` | 3/3 | 3/3 | 3/3 | 3/3 | | `d3d12_d24_support` | 3/3 | 3/3 | 3/3 | 3/3 | | `d3d12_state_sweep` | 3/3 | 3/3 | 3/3 | 3/3 | | `vk_sync_validation` | 3/3 | 3/3 | 3/3 | 3/3 | | **Total PASS** | **15/15** | **12/15** | **15/15** | **12/15** | ### Failure reproducibility Two additional attempts were performed on both systems. Successful BASE checkpoints were reused, while HEAD tests were executed again. Reused BASE results are not counted as independent executions. | Test | RTX 5070 HEAD | RTX 2060 SUPER HEAD | |---|---:|---:| | `d3d12_bundle` | 0/9 | 0/9 | | `d3d12_com` | 9/9 | 9/9 | | `d3d12_d24_support` | 9/9 | 9/9 | | `d3d12_state_sweep` | 9/9 | 9/9 | | `vk_sync_validation` | 9/9 | 9/9 | | **Total PASS** | **36/45** | **36/45** | Actual executions, excluding reused checkpoints: - BASE: 30/30 PASS - HEAD: 72/90 PASS - Combined: 102/120 PASS - FAIL: 18 - SKIP: 0 The `d3d12_bundle` failure reproduced in all 18 HEAD executions across both hardware configurations. ### RASTERIZER2 pipeline creation failure All failing executions reported the same diagnostic:
Author
Owner

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

@⁠Timon360SB @⁠moffington Thanks for the detailed testing and catches — updated in dbc475a4f:

  • Updated runtime/test/d3d12_bundle_test.cpp: fixed the Vertex input layout order/formats, added SubTopology triangle topology, set CullMode = D3D12_CULL_MODE_NONE, and added a 64x64 DXGI_FORMAT_D24_UNORM_S8_UINT depth buffer + GREATER depth test comparing 1.5f vs 0.0f for both RASTERIZER1 and RASTERIZER2.
  • Added depth24_bias_constant unit assertions in runtime/test/d3d12_d24_support_test.cpp.
  • Claimed D3D-RASTERIZER-FLOAT-BIAS in coordination issue #14: #14

Locally verified:

  • d3d12_com & d3d12_d24_support: 2/2 Passed on NVIDIA GeForce GTX 1050
  • test_ctest_registration.py: 4/4 OK
  • Note: d3d12_bundle_test was not compiled locally because glslangValidator is absent in this environment.
**@⁠kotekompotek** on GitHub · 2026-11-24 18:05 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806#issuecomment-7140149919) @⁠Timon360SB @⁠moffington Thanks for the detailed testing and catches — updated in `dbc475a4f`: - Updated `runtime/test/d3d12_bundle_test.cpp`: fixed the `Vertex` input layout order/formats, added `SubTopology` triangle topology, set `CullMode = D3D12_CULL_MODE_NONE`, and added a `64x64` `DXGI_FORMAT_D24_UNORM_S8_UINT` depth buffer + `GREATER` depth test comparing `1.5f` vs `0.0f` for both `RASTERIZER1` and `RASTERIZER2`. - Added `depth24_bias_constant` unit assertions in `runtime/test/d3d12_d24_support_test.cpp`. - Claimed `D3D-RASTERIZER-FLOAT-BIAS` in coordination issue `#14`: https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14 Locally verified: - `d3d12_com` & `d3d12_d24_support`: `2/2 Passed` on NVIDIA GeForce GTX 1050 - `test_ctest_registration.py`: `4/4 OK` - Note: `d3d12_bundle_test` was not compiled locally because `glslangValidator` is absent in this environment.
Author
Owner

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

Rebased onto current main (42537e7b6) as ab87f836f. The stream parser and create_graphics now carry both StencilFaceMasks (per-face stencil, from main) and this PR's GraphicsStreamExtras (has_float_depth_bias/depth_bias), and Depth24Bias keeps the float constant together with main's levels field (packed16 fallback keeps its 65535.0f level count).

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 only the two pre-existing main failures on this machine (the CreateHeap invalid-argument column and the three CopyTextureRegion WARP-annotation rows — unrelated to this change). d3d12_bundle_test is not built here (no glslangValidator/llvm-mc).

AI-assisted.

**@⁠kotekompotek** on GitHub · 2026-11-25 06:39 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806#issuecomment-7155028766) Rebased onto current `main` (`42537e7b6`) as `ab87f836f`. The stream parser and `create_graphics` now carry both `StencilFaceMasks` (per-face stencil, from `main`) and this PR's `GraphicsStreamExtras` (`has_float_depth_bias`/`depth_bias`), and `Depth24Bias` keeps the float `constant` together with `main`'s `levels` field (packed16 fallback keeps its 65535.0f level count). 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 only the two pre-existing `main` failures on this machine (the `CreateHeap` invalid-argument column and the three `CopyTextureRegion` WARP-annotation rows — unrelated to this change). `d3d12_bundle_test` is not built here (no `glslangValidator`/`llvm-mc`). AI-assisted.
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 17:01 UTC · original

Note on the red jobs at this head: both failures are baseline, not this diff — linux-gpu-tools cs_imgatomic_ext (6/64 sint words, llvmpipe) and windows vk_xdxr_postbuild_readback (prints "skipped" but exits nonzero) fail identically on every PR rebased after ~15:00 UTC, including merged #808's own checks. Reported in #1608. Locally (GTX 1050, MSVC Debug) the tests this change touches pass.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/806#issuecomment-7168876124) Note on the red jobs at this head: both failures are baseline, not this diff — `linux-gpu-tools` `cs_imgatomic_ext` (6/64 sint words, llvmpipe) and `windows` `vk_xdxr_postbuild_readback` (prints "skipped" but exits nonzero) fail identically on every PR rebased after ~15:00 UTC, including merged #808's own checks. Reported in #1608. Locally (GTX 1050, MSVC Debug) the tests this change touches pass.
This pull request has changes conflicting with the target branch.
  • runtime/shims/d3d12_vulkan_device.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/806/head:github-bot/gh-806'
git switch 'github-bot/gh-806'

Merge

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