d3d12: GCL9 RSSetDepthBias and IASetIndexBufferStripCutValue, the DYNAMIC_* PSO flags #1377

Closed
robot00f wants to merge 3 commits from upstream-pr/1377 into main
robot00f commented 2026-11-24 22:56:06 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-24T22:56:06Z.


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)
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5481718476 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1377). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-24T22:56:06Z. --- 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)
robot00f commented 2026-11-25 03:24:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-25T03:24:45Z.


Rebased onto current main (b07b9ecb), dropping the four unrelated GPU-PASCAL4GB-WIN base commits (#1076) and resolving the #984 conflicts in runtime/shims/d3d12_com.cpp (graphics_user_data()) and runtime/shims/d3d12_vulkan_device.cpp (resolve_type(true) / native_owner_ forwarding and packed16_fallback scale).

Re-verified 3/3 on NVIDIA GeForce GTX 1050 Ti (driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045): d3d12_gcl8, d3d12_trace, d3d12_draw, d3d12_pso_validation, and d3d12_depth24_draw all pass (check_no_game_data.py exit 0).

AI-assisted: yes (Antigravity)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7151889615 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1377#issuecomment-7151889615). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-25T03:24:45Z. --- Rebased onto current `main` (`b07b9ecb`), dropping the four unrelated `GPU-PASCAL4GB-WIN` base commits (`#1076`) and resolving the `#984` conflicts in `runtime/shims/d3d12_com.cpp` (`graphics_user_data()`) and `runtime/shims/d3d12_vulkan_device.cpp` (`resolve_type(true)` / `native_owner_` forwarding and `packed16_fallback` scale). Re-verified 3/3 on NVIDIA GeForce GTX 1050 Ti (driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045): `d3d12_gcl8`, `d3d12_trace`, `d3d12_draw`, `d3d12_pso_validation`, and `d3d12_depth24_draw` all pass (`check_no_game_data.py` exit 0). AI-assisted: yes (Antigravity)
robot00f commented 2026-11-25 15:16:37 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by robot00f on 2026-11-25T15:16:37Z.


Rebased onto current main (446574e7 / 0f3d399, resolving the DispatchMesh
ote_direct_heap_indexing adjacency from #1232 in
untime/shims/d3d12_com.cpp) and re-verified 3/3 on NVIDIA GeForce GTX 1050 Ti (driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045): d3d12_gcl8, d3d12_trace, d3d12_depth24_draw, d3d12_draw, and d3d12_pso_validation all pass.

AI-assisted: yes (Antigravity)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7166583970 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1377#issuecomment-7166583970). Originally posted by [robot00f](https://github.com/robot00f) on 2026-11-25T15:16:37Z. --- Rebased onto current main (446574e7 / 0f3d399, resolving the DispatchMesh ote_direct_heap_indexing adjacency from #1232 in untime/shims/d3d12_com.cpp) and re-verified 3/3 on NVIDIA GeForce GTX 1050 Ti (driver 582.28, Vulkan 1.4.312, Windows 10 Pro 10.0.19045): d3d12_gcl8, d3d12_trace, d3d12_depth24_draw, d3d12_draw, and d3d12_pso_validation all pass. AI-assisted: yes (Antigravity)
MoonEyes commented 2026-11-28 18:00:17 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T18:00:17Z.


Hi @robot00f, thanks for this pull request. It currently conflicts with main (conflicting file(s): runtime/shims/d3d12_com.h, runtime/shims/d3d12_vulkan_device.cpp), so it carries the needs rebase label. CONTRIBUTING.md asks authors to rebase their branch on main; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7243453663 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1377#issuecomment-7243453663). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-28T18:00:17Z. --- Hi @robot00f, thanks for this pull request. It currently conflicts with `main` (conflicting file(s): `runtime/shims/d3d12_com.h`, `runtime/shims/d3d12_vulkan_device.cpp`), so it carries the `needs rebase` label. CONTRIBUTING.md asks authors to rebase their branch on `main`; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here. AI-assisted (Claude Code, Claude Opus 5.5).
aslan2142 commented 2026-12-01 16:35:05 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:35:05Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7317847829 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/1377#issuecomment-7317847829). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:35:05Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!1377
No description provided.