d3d12: CheckFeatureSupport refuses shader models past 6.9 and sets CAST_WITHIN_BIT_LAYOUT as the host does #118

Closed
Andretuta wants to merge 1 commit from upstream-pr/118 into main
Andretuta commented 2026-11-24 02:21:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:21:48Z.


Carried over from old PR 9852 by haayden in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9852, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
This branch conflicts with the current main and needs a rebase.
haayden: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

Stacked on #9719 (its commit 721526af3 is the first one here); review the second commit, 170f70ecd. If #9719 merges first this rebases to one commit.

Measured against the host runtime on an RTX 5070 Ti (NVIDIA 621.14) and on WARP, Windows 11, MSVC 14.44. Host and WARP agree; the layer differed:

call host / WARP layer before
CheckFeatureSupport(SHADER_MODEL) with HighestShaderModel 0x6a..0x100 E_INVALIDARG (0x69 accepted) S_OK, clamped to 6.0
FORMAT_SUPPORT D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT set on 90 formats: every member of a TYPELESS family, depth formats and plane views included; not on R11G11B10, A8, R9G9B9E5, B5G6R5, B5G5R5A1, B4G4R4A4, A4B4G4R4 never set (except XR_BIAS)

Fix: shader models above 6.9 are refused with E_INVALIDARG; a new cast_within_bit_layout() sets the bit for formats in a TYPELESS family.

Test. New d3d12_feature_support_parity_test (116 rows) compares the layer with the host (PROBE_WARP=1 for WARP; exits 77 without a Vulkan or host device).

  • base (#9719): 100 of 116 differ, on host and on WARP (10 shader-model rows, 90 cast rows).
  • this PR: 0 of 116, on both.
  • ^d3d12_ ctests: 73 pass, 4 skip, 2 fail; d3d12_vulkan_device and d3d12_depth_resolve fail the same way on main on this machine (#7125, #7905).

Looked at, not changed: R8G8_B8G8 / G8R8_G8B8 (host supports 1D/2D/3D/cube with gather; Vulkan's 4:2:2 formats need Y′CbCr conversion, which has no 3D, cube or gather; #4533 lists it); tiled MSAA quality on stencil-bearing depth formats (#4533); GPU start handle of a non-shader-visible heap (NVIDIA and WARP answer differently, so nothing to match).

No game data used. Claim: https://github.com/ProjectLeonida/Leonida/issues/9065#issuecomment-7115478274

AI-assisted: yes (Claude Code; I reviewed and re-ran the test on host and WARP).

<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464866965 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/118). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:21:48Z. --- > Carried over from **old PR 9852** by `haayden` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9852`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > This branch conflicts with the current `main` and needs a rebase. > `haayden`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): **Stacked on `#9719`** (its commit `721526af3` is the first one here); review the second commit, `170f70ecd`. If `#9719` merges first this rebases to one commit. Measured against the host runtime on an RTX 5070 Ti (NVIDIA 621.14) and on WARP, Windows 11, MSVC 14.44. Host and WARP agree; the layer differed: | call | host / WARP | layer before | |---|---|---| | `CheckFeatureSupport(SHADER_MODEL)` with HighestShaderModel 0x6a..0x100 | E_INVALIDARG (0x69 accepted) | S_OK, clamped to 6.0 | | `FORMAT_SUPPORT` `D3D12_FORMAT_SUPPORT1_CAST_WITHIN_BIT_LAYOUT` | set on 90 formats: every member of a TYPELESS family, depth formats and plane views included; not on R11G11B10, A8, R9G9B9E5, B5G6R5, B5G5R5A1, B4G4R4A4, A4B4G4R4 | never set (except XR_BIAS) | **Fix:** shader models above 6.9 are refused with E_INVALIDARG; a new `cast_within_bit_layout()` sets the bit for formats in a TYPELESS family. **Test.** New `d3d12_feature_support_parity_test` (116 rows) compares the layer with the host (`PROBE_WARP=1` for WARP; exits 77 without a Vulkan or host device). - base (`#9719`): 100 of 116 differ, on host and on WARP (10 shader-model rows, 90 cast rows). - this PR: 0 of 116, on both. - `^d3d12_` ctests: 73 pass, 4 skip, 2 fail; `d3d12_vulkan_device` and `d3d12_depth_resolve` fail the same way on main on this machine (`#7125`, `#7905`). **Looked at, not changed:** R8G8_B8G8 / G8R8_G8B8 (host supports 1D/2D/3D/cube with gather; Vulkan's 4:2:2 formats need Y′CbCr conversion, which has no 3D, cube or gather; `#4533` lists it); tiled MSAA quality on stencil-bearing depth formats (`#4533`); GPU start handle of a non-shader-visible heap (NVIDIA and WARP answer differently, so nothing to match). No game data used. Claim: https://github.com/ProjectLeonida/Leonida/issues/9065#issuecomment-7115478274 AI-assisted: yes (Claude Code; I reviewed and re-ran the test on host and WARP).
MoonEyes commented 2026-11-30 18:55:32 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-30T18:55:32Z.


The behavior remains relevant and is not in current main: shader-model requests above 6.0 are still clamped, and FORMAT_SUPPORT only has the XR_BIAS cast-bit special case. Your host/WARP report (0 differences across 116 rows) is useful evidence.\n\nNot merge-ready: this is still a draft, conflicts with main, all CI checks are cancelled, and I found no current claim in coordination issue #2570. The current docs/d3d12_vulkan.md §4.1 says requests above 6.0 are clamped, which conflicts with the measured E_INVALIDARG for 0x6a..0x100; please update that contract. Open PRs #732 and #1188 also touch runtime/shims/d3d12_vulkan_device.cpp, so rebase and preserve their changes. Then rerun the Windows build/CTest and the parity test against the host and WARP on the current diff. No merge until all criteria are satisfied.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7288573951 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/118#issuecomment-7288573951). Originally posted by [MoonEyes](https://github.com/MoonEyes) on 2026-11-30T18:55:32Z. --- The behavior remains relevant and is not in current main: shader-model requests above 6.0 are still clamped, and FORMAT_SUPPORT only has the XR_BIAS cast-bit special case. Your host/WARP report (0 differences across 116 rows) is useful evidence.\n\nNot merge-ready: this is still a draft, conflicts with main, all CI checks are cancelled, and I found no current claim in coordination issue #2570. The current docs/d3d12_vulkan.md §4.1 says requests above 6.0 are clamped, which conflicts with the measured E_INVALIDARG for 0x6a..0x100; please update that contract. Open PRs #732 and #1188 also touch runtime/shims/d3d12_vulkan_device.cpp, so rebase and preserve their changes. Then rerun the Windows build/CTest and the parity test against the host and WARP on the current diff. No merge until all criteria are satisfied.
aslan2142 commented 2026-12-01 12:09:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:09:15Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7310728560 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/118#issuecomment-7310728560). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:09:15Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 16:22:14 +00:00 (Migrated from github.com)

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


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:7317490925 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/118#issuecomment-7317490925). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:22:14Z. --- 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!118
No description provided.