Skip to content

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

Open
robot00f wants to merge 3 commits into
ProjectLeonida:mainfrom
robot00f:fix/d3d12-gcl9-dynamic-state
Open

robot00f wants to merge 3 commits into
ProjectLeonida:mainfrom
robot00f:fix/d3d12-gcl9-dynamic-state

Conversation

@robot00f

Copy link
Copy Markdown
Contributor

Claim: #14 (comment) (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 d3d12_pso_validation_test: compare the DYNAMIC_* PSO flags with the host only where it reports them (TEST-WIN10-PSO-FLAGS) #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.

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)

@robot00f

Copy link
Copy Markdown
Contributor Author

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)

@github-actions github-actions Bot added the needs rebase Conflicts with the base branch: rebase it on main label Nov 25, 2026
@robot00f
robot00f force-pushed the fix/d3d12-gcl9-dynamic-state branch from 6be2413 to ef3528e Compare November 25, 2026 14:58
@robot00f

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (446574e / �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)

@robot00f
robot00f force-pushed the fix/d3d12-gcl9-dynamic-state branch 2 times, most recently from eba519f to 6ba1252 Compare November 26, 2026 04:41
@github-actions github-actions Bot added needs rebase Conflicts with the base branch: rebase it on main and removed needs rebase Conflicts with the base branch: rebase it on main labels Nov 26, 2026
robot00f and others added 3 commits November 27, 2026 03:03
…ost only where it reports them

On Windows 10 22H2 (19045) the in-box D3D12 runtime refuses
D3D12_PIPELINE_STATE_FLAG_DYNAMIC_DEPTH_BIAS and DYNAMIC_INDEX_BUFFER_STRIP_CUT with
E_INVALIDARG and reports OPTIONS16.DynamicDepthBiasSupported and
OPTIONS15.DynamicIndexBufferStripCutSupported as FALSE, so the test failed there:

  FAIL [gfx: Flags=DYNAMIC_DEPTH_BIAS]: layer 0x00000000 != host NVIDIA GeForce RTX 5060 Ti 0x80070057

Query both features on each host device and compare those four cases (gfx and compute) only
on hosts that report the feature, with a SKIP line otherwise. The layer-side expectation still
runs on every host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@robot00f
robot00f force-pushed the fix/d3d12-gcl9-dynamic-state branch from 6ba1252 to cc6597c Compare November 27, 2026 06:07
@github-actions github-actions Bot removed the needs rebase Conflicts with the base branch: rebase it on main label Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants