[PR #1377] d3d12: GCL9 RSSetDepthBias and IASetIndexBufferStripCutValue, the DYNAMIC_* PSO flags #1407

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

📋 Pull Request Information

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

Base: main ← Head: fix/d3d12-gcl9-dynamic-state


📝 Commits (3)

  • dd04e55 d3d12: GCL9 RSSetDepthBias and IASetIndexBufferStripCutValue, the DYNAMIC_* PSO flags
  • 4f21de6 d3d12_pso_validation_test: compare the DYNAMIC_* PSO flags with the host only where it reports them
  • 6ba1252 d3d12_pso_validation_test: the layer answers both dynamic-state features

📊 Changes

12 files changed (+341 additions, -54 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+15 -5)
📝 runtime/CMakeLists.txt (+1 -1)
📝 runtime/shims/d3d12_com.cpp (+72 -5)
📝 runtime/shims/d3d12_com.h (+16 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+50 -9)
📝 runtime/src/command_list.h (+6 -0)
📝 runtime/src/vulkan_backend.h (+5 -3)
📝 runtime/src/vulkan_replay.h (+19 -3)
📝 runtime/test/d3d12_depth24_draw_test.cpp (+42 -5)
📝 runtime/test/d3d12_draw_test.cpp (+26 -6)
📝 runtime/test/d3d12_gcl8_test.cpp (+34 -6)
📝 runtime/test/d3d12_pso_validation_test.cpp (+55 -11)

📄 Description

Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146203524 (ID D3D12-DYNAMIC-DEPTH-BIAS)
Depends on: #967 (its commit is the first one here, carried for the test file)

The layer accepted both DYNAMIC_* pipeline flags as known bits (kKnownPipelineStateFlags = 0xF) while reporting both features FALSE and implementing neither setter, so a title that used them got a PSO whose bias never changed. #967's note called that a separate decision; this is the implementation.

What

  • GCL9. The command list now derives from ID3D12GraphicsCommandList9 (generated stub regenerated for that interface, IID added to the QueryInterface chain) and implements its two methods: RSSetDepthBias(float constant, float clamp, float slope) and IASetIndexBufferStripCutValue(value). Both record list state, deferred into bundles like the other state setters, and Reset returns them to their defaults. IASetIndexBufferStripCutValue takes only the three defined values; anything else invalidates the list, so Close reports it.
  • Seeded from the pipeline. SetPipelineState copies the PSO's rasterizer bias and IBStripCutValue into that state, as D3D12 does, so a draw before any setter behaves as it did.
  • Applied only where the PSO asks. A pipeline carrying DYNAMIC_DEPTH_BIAS gets VK_DYNAMIC_STATE_DEPTH_BIAS and the draw carries the values; replay issues vkCmdSetDepthBias. A pipeline carrying DYNAMIC_INDEX_BUFFER_STRIP_CUT takes the cut value from the draw instead of the pipeline. Pipelines without the flags are unchanged.
  • Feature answers. OPTIONS16.DynamicDepthBiasSupported and OPTIONS15.DynamicIndexBufferStripCutSupported now report TRUE, which is the other half of #967's note.
  • Caveat, logged, not silent: on D24_UNORM_S8_UINT stored as D32_SFLOAT_S8_UINT the pixel stage carries the bias itself (src/depth24_fragment.h), so such a pipeline keeps the PSO's bias and does not follow RSSetDepthBias. Fixing that needs the values in a per-draw uniform, which is a follow-up.

Tested

Windows 10 Pro 22H2 (10.0.19045), VS 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, NVIDIA GeForce GTX 1050 Ti (582.28) and WARP. No game files.

  • d3d12_gcl8_test now covers GCL9: QueryInterface for the IID, both methods at their SDK slots (82, 83) with the values read back, the Reset defaults, the invalid-value E_INVALIDARG, and the refcount. CPU only, 3/3.
  • d3d12_depth24_draw_test: three dynamic cases on the stored-depth path. Pipeline bias 5 with a list bias of 0 stores the unbiased code (the pipeline's value is ignored); list bias 3 and -5 store codes 3 and 5 steps off the unbiased one (the list's value is applied). The two biased ones are the known native-D24 r inexactness this test already reports for the static ones.
  • d3d12_draw_test: two dynamic strip-cut passes (0xFFFF over R16_UINT, 0xFFFFFFFF over R32_UINT, on a pipeline holding DISABLED) match the PSO-driven passes pixel for pixel, 4096/4096 each.
  • d3d12_pso_validation: passes 2/2, with #967's gate skipping the host comparison on this host (it reports both features FALSE) and a new layer-side case asserting both feature answers.
  • ctest -R over the seven touched and neighbouring tests with --repeat until-fail:2: 7/7. Full suite: the same five reproduced host differences plus d3d12_close_parity and root_signature_oracle (both covered elsewhere, #989 and the finding posted for #1353); nothing new from here.
  • check_no_game_data.py on every touched file: 0. tests/test_docs_links.py and tests/test_docs_table_rows.py: OK. d3d12_gcl8_test still runs without a GPU, as before.

Not tested: Windows 11, so the #967 branch that compares against a host which accepts the flags; and no title PSO was run.

GPUs tested: NVIDIA GeForce GTX 1050 Ti, driver 582.28, Windows 10 22H2

AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption (CONTRIBUTING.md).
  • A new translator rule is in the contract table of docs/design.md. (n/a: no translator change)

🔄 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/1377 **Author:** [@robot00f](https://github.com/robot00f) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/d3d12-gcl9-dynamic-state` --- ### 📝 Commits (3) - [`dd04e55`](https://github.com/ubiquitarianism/leonida/commit/dd04e555feb61c557b514d2e15774f05294e008e) d3d12: GCL9 RSSetDepthBias and IASetIndexBufferStripCutValue, the DYNAMIC_* PSO flags - [`4f21de6`](https://github.com/ubiquitarianism/leonida/commit/4f21de665bfcdc2bc3b25b80b918db49def547b8) d3d12_pso_validation_test: compare the DYNAMIC_* PSO flags with the host only where it reports them - [`6ba1252`](https://github.com/ubiquitarianism/leonida/commit/6ba125228a7a7c257bb8abb1c4e2468b14fc5ec9) d3d12_pso_validation_test: the layer answers both dynamic-state features ### 📊 Changes **12 files changed** (+341 additions, -54 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+15 -5) 📝 `runtime/CMakeLists.txt` (+1 -1) 📝 `runtime/shims/d3d12_com.cpp` (+72 -5) 📝 `runtime/shims/d3d12_com.h` (+16 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+50 -9) 📝 `runtime/src/command_list.h` (+6 -0) 📝 `runtime/src/vulkan_backend.h` (+5 -3) 📝 `runtime/src/vulkan_replay.h` (+19 -3) 📝 `runtime/test/d3d12_depth24_draw_test.cpp` (+42 -5) 📝 `runtime/test/d3d12_draw_test.cpp` (+26 -6) 📝 `runtime/test/d3d12_gcl8_test.cpp` (+34 -6) 📝 `runtime/test/d3d12_pso_validation_test.cpp` (+55 -11) </details> ### 📄 Description Claim: https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7146203524 (ID `D3D12-DYNAMIC-DEPTH-BIAS`) Depends on: #967 (its commit is the first one here, carried for the test file) The layer accepted both `DYNAMIC_*` pipeline flags as known bits (`kKnownPipelineStateFlags = 0xF`) while reporting both features FALSE and implementing neither setter, so a title that used them got a PSO whose bias never changed. #967's note called that a separate decision; this is the implementation. ### What - **GCL9.** The command list now derives from `ID3D12GraphicsCommandList9` (generated stub regenerated for that interface, IID added to the `QueryInterface` chain) and implements its two methods: `RSSetDepthBias(float constant, float clamp, float slope)` and `IASetIndexBufferStripCutValue(value)`. Both record list state, deferred into bundles like the other state setters, and `Reset` returns them to their defaults. `IASetIndexBufferStripCutValue` takes only the three defined values; anything else invalidates the list, so `Close` reports it. - **Seeded from the pipeline.** `SetPipelineState` copies the PSO's rasterizer bias and `IBStripCutValue` into that state, as D3D12 does, so a draw before any setter behaves as it did. - **Applied only where the PSO asks.** A pipeline carrying `DYNAMIC_DEPTH_BIAS` gets `VK_DYNAMIC_STATE_DEPTH_BIAS` and the draw carries the values; replay issues `vkCmdSetDepthBias`. A pipeline carrying `DYNAMIC_INDEX_BUFFER_STRIP_CUT` takes the cut value from the draw instead of the pipeline. Pipelines without the flags are unchanged. - **Feature answers.** `OPTIONS16.DynamicDepthBiasSupported` and `OPTIONS15.DynamicIndexBufferStripCutSupported` now report TRUE, which is the other half of #967's note. - **Caveat, logged, not silent:** on `D24_UNORM_S8_UINT` stored as `D32_SFLOAT_S8_UINT` the pixel stage carries the bias itself (`src/depth24_fragment.h`), so such a pipeline keeps the PSO's bias and does not follow `RSSetDepthBias`. Fixing that needs the values in a per-draw uniform, which is a follow-up. ### Tested Windows 10 Pro 22H2 (10.0.19045), VS 2022 RelWithDebInfo, Vulkan SDK 1.4.363.0, NVIDIA GeForce GTX 1050 Ti (582.28) and WARP. No game files. - `d3d12_gcl8_test` now covers GCL9: `QueryInterface` for the IID, both methods at their SDK slots (82, 83) with the values read back, the `Reset` defaults, the invalid-value `E_INVALIDARG`, and the refcount. CPU only, 3/3. - `d3d12_depth24_draw_test`: three dynamic cases on the stored-depth path. Pipeline bias 5 with a list bias of 0 stores the unbiased code (the pipeline's value is ignored); list bias 3 and -5 store codes 3 and 5 steps off the unbiased one (the list's value is applied). The two biased ones are the known native-D24 `r` inexactness this test already reports for the static ones. - `d3d12_draw_test`: two dynamic strip-cut passes (0xFFFF over `R16_UINT`, 0xFFFFFFFF over `R32_UINT`, on a pipeline holding DISABLED) match the PSO-driven passes pixel for pixel, 4096/4096 each. - `d3d12_pso_validation`: passes 2/2, with #967's gate skipping the host comparison on this host (it reports both features FALSE) and a new layer-side case asserting both feature answers. - `ctest -R` over the seven touched and neighbouring tests with `--repeat until-fail:2`: 7/7. Full suite: the same five reproduced host differences plus `d3d12_close_parity` and `root_signature_oracle` (both covered elsewhere, #989 and the finding posted for #1353); nothing new from here. - `check_no_game_data.py` on every touched file: 0. `tests/test_docs_links.py` and `tests/test_docs_table_rows.py`: OK. `d3d12_gcl8_test` still runs without a GPU, as before. Not tested: Windows 11, so the #967 branch that compares against a host which accepts the flags; and no title PSO was run. GPUs tested: NVIDIA GeForce GTX 1050 Ti, driver 582.28, Windows 10 22H2 AI-assisted: yes (OpenCode, DeepSeek V4.1 Flash) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption (CONTRIBUTING.md). - [x] A new translator rule is in the contract table of docs/design.md. (n/a: no translator change) --- <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#1407
No description provided.