[PR #1222] d3d12_vulkan_device_test: resource flags 0x200 and 0x400 go by the host's tight-alignment support (TEST-DEVICE-FLAGS-TIGHT-ALIGNMENT) #1254

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

📋 Pull Request Information

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

Base: main ← Head: fix/device-test-resource-flag-hosts


📝 Commits (1)

  • 8c73655 d3d12_vulkan_device_test: resource flags 0x200 and 0x400 go by the host's tight-alignment support (TEST-DEVICE-FLAGS-TIGHT-ALIGNMENT)

📊 Changes

1 file changed (+54 additions, -7 deletions)

View changed files

📝 runtime/test/d3d12_vulkan_device_test.cpp (+54 -7)

📄 Description

Claimed in the coordination issue as: TEST-DEVICE-FLAGS-TIGHT-ALIGNMENT

What and why

d3d12_vulkan_device fails on my PC at argument_mismatches <= 0 after these three lines of compare_invalid_arguments, and everything else in the test matches the host:

invalid arguments committed: resource flag 0x200 on a buffer: ours 0x80070057, host 0x00000000
invalid arguments committed: resource flag 0x400 on a buffer: ours 0x00000000, host 0x80070057
invalid arguments committed: resource flag 0x400 on a texture: ours 0x00000000, host 0x80070057

I first reported this as an Intel host quirk (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142087413). That was wrong for this PC: the Intel Iris Xe, the RTX 4060 Laptop and WARP all answer the same, so it is the D3D12 runtime, D3D12Core.dll 10.0.26100.5074 (Windows 11 24H2, build 26100.6584).

What the flags are, from Microsoft's public headers and specification:

  • 0x400 is D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT. It first appears in DirectX-Headers v1.618.1 together with D3D12_FEATURE_D3D12_TIGHT_ALIGNMENT (54, one D3D12_TIGHT_ALIGNMENT_TIER); the Windows SDK 10.0.26100 header has neither. DirectX-Specs (d3d/D3D12TightPlacedResourceAlignment.md) lists E_INVALIDARG for the flag when the feature is reported as D3D12_TIGHT_ALIGNMENT_TIER_NOT_SUPPORTED.
  • 0x200 is D3D12_RESOURCE_FLAG_VIDEO_PROCESS_3DLUT_ONLY, named in DirectX-Headers from v1.620.1 on.

What hosts answer. The newer runtimes are the D3D12Core.dll of Microsoft's Agility SDK (NuGet Microsoft.Direct3D.D3D12 1.618.5 and 1.620.2), loaded by a probe and by a local build of this test that opts into them:

Host runtime Adapter Feature 54 0x400, buffer and texture 0x200, buffer
10.0.26100.5074 (in the box) Iris Xe, RTX 4060, WARP E_INVALIDARG refused accepted
1.618.5 and 1.620.2 RTX 4060 Laptop (NVIDIA 621.40) TIER_1 accepted refused
1.618.5 and 1.620.2 Iris Xe (Intel 32.0.101.7092), WARP NOT_SUPPORTED refused refused
The layer E_INVALIDARG accepted refused
  • All of these runtimes have ID3D12Device11 to ID3D12Device14. So ID3D12Device11 on the host, the condition commit 31d279823 gave the two 0x400 cases, does not tell whether the host accepts the flag: the runtime has to know the flag and the driver has to report TIER_1.
  • With the debug layer on, 10.0.26100.5074 says D3D12_RESOURCE_DESC::Flags has unrecognized bits. The value is 0x400, and the unrecognized bits are 0x400.
  • The newer runtimes refuse 0x200 on a buffer because Flags can only have D3D12_RESOURCE_FLAG_VIDEO_PROCESS_3DLUT_ONLY set when D3D12_RESOURCE_DESC::Dimension is D3D12_RESOURCE_DIMENSION_TEXTURE3D (their debug layer), and accept it on a 3D texture. 10.0.26100.5074 accepts it on a buffer and on 2D and 3D textures. The 0x200 case had no condition at all.

The layer's answers to the three cases are those of a newer runtime on a driver with tight alignment, and this pull request does not change the layer.

The change, in runtime/test/d3d12_vulkan_device_test.cpp only:

  • host_tight_alignment: the host answers feature 54 with a tier above NOT_SUPPORTED. The two 0x400 cases are compared on such a host, instead of on one with ID3D12Device11. Windows 10 and Windows 11 23H2, which the old condition was written for, refuse the flag, so they cannot report TIER_1 and stay not comparable.
  • host_knows_tight_alignment: the host answers feature 54 at all, which makes its runtime 1.618 or newer. The 0x200 case is compared on such a host. On an older host the case is now held to the recorded answer instead of the host's; on Windows 10 and 23H2 the two are the same (the case had no condition and the test passed there).
  • Case::recorded: the layer's answer for a case, checked where the host is not comparable. The three cases have one (E_INVALIDARG, S_OK, S_OK). Until now a host that was not comparable checked nothing for a case, and one that happens to answer as a wrong layer does would have hidden it; the first negative control below is that situation.
  • The comment about the five ID3D12Device11 cases now says three.

Tested

main 58be9cdf8 (built at 6293c1c4f; runtime/ is identical between the two), MSVC Build Tools 2026, Ninja, RelWithDebInfo, Windows SDK 10.0.26100.0. The test takes the layer's own adapter as its host, so each line is layer and host on the same GPU unless it says WARP.

Host runtime 10.0.26100.5074 (in the box):

  • Before, LEONIDA_VK_DEVICE=iris and =4060: exit 1, the three lines above, on both.
  • After, on both: exit 0, and the three cases print not comparable on this host (ours ..., host ...). The same with LEONIDA_HOST_ADAPTER=warp.
  • Negative control 1, the layer's answers flipped (committed_resource_refusal takes 0x200 and not 0x400, exactly as this host answers): exit 1 on both GPUs with ours 0x00000000, recorded 0x80070057 (host 0x00000000, not comparable) for 0x200 and ours 0x80070057, recorded 0x00000000 (host 0x80070057, not comparable) for the two 0x400 cases. Without recorded this run passes.
  • Negative control 2, the two host conditions forced to true: exit 1 on both GPUs with the three original lines.

Host runtime 1.618.5 (the test built locally with D3D12SDKVersion / D3D12SDKPath exports appended; not part of this pull request). Every run on this runtime also prints two lines that this change neither causes nor touches, resource flag RAYTRACING_ACCELERATION_STRUCTURE on a buffer / on a texture: ours 0x00000000, host 0x80070057 (the newer runtime wants ALLOW_UNORDERED_ACCESS with that flag), so the exit code is 1 throughout. That is a separate matter and not part of this change. For the three cases of this pull request:

  • Before: on the RTX 4060 (TIER_1) they agree with the host. On the Iris Xe and with WARP as host (NOT_SUPPORTED) the two 0x400 cases fail, ours 0x00000000, host 0x80070057. So the old condition also fails on a current runtime wherever the driver has no tight alignment.
  • After: on the RTX 4060 the three cases are compared and equal (no line). On the Iris Xe and with WARP as host the two 0x400 cases print not comparable, and 0x200 is compared and equal.
  • Negative control on the compared path, the layer's answers flipped as above: on the RTX 4060 the three cases fail as compared cases (0x200 on a buffer: ours 0x00000000, host 0x80070057, 0x400 ...: ours 0x80070057, host 0x00000000 twice); on the Iris Xe 0x200 fails as a compared case and the two 0x400 cases through recorded.

Host runtime 1.620.2: the probe gets the same answers as on 1.618.5 for the three cases on all three adapters. The test itself stops earlier there, at allocation_mismatches (among others a resource flag 0x1000 that this runtime accepts), which is also unrelated to this change.

  • python -I scripts/check_no_game_data.py runtime/test/d3d12_vulkan_device_test.cpp: clean.
  • Not run: the whole ctest (only this test was built), an up-to-date in-box Windows 11 runtime, Windows 10, Windows 11 23H2, AMD, Linux and Wine (the comparison is skipped without a Microsoft host).

GPUs tested: Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 build 26100.6584; NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 621.40, Windows 11 build 26100.6584

AI-assisted: yes (Claude Code)

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. (not a translator change)

🤖 Generated with Claude Code


🔄 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/1222 **Author:** [@MalexAson](https://github.com/MalexAson) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/device-test-resource-flag-hosts` --- ### 📝 Commits (1) - [`8c73655`](https://github.com/ubiquitarianism/leonida/commit/8c73655a93d9ab9b3cb49334328b1f7611ccbd94) d3d12_vulkan_device_test: resource flags 0x200 and 0x400 go by the host's tight-alignment support (TEST-DEVICE-FLAGS-TIGHT-ALIGNMENT) ### 📊 Changes **1 file changed** (+54 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/d3d12_vulkan_device_test.cpp` (+54 -7) </details> ### 📄 Description Claimed in the coordination issue as: TEST-DEVICE-FLAGS-TIGHT-ALIGNMENT ### What and why `d3d12_vulkan_device` fails on my PC at `argument_mismatches <= 0` after these three lines of `compare_invalid_arguments`, and everything else in the test matches the host: invalid arguments committed: resource flag 0x200 on a buffer: ours 0x80070057, host 0x00000000 invalid arguments committed: resource flag 0x400 on a buffer: ours 0x00000000, host 0x80070057 invalid arguments committed: resource flag 0x400 on a texture: ours 0x00000000, host 0x80070057 I first reported this as an Intel host quirk (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142087413). That was wrong for this PC: the Intel Iris Xe, the RTX 4060 Laptop and WARP all answer the same, so it is the D3D12 runtime, `D3D12Core.dll` 10.0.26100.5074 (Windows 11 24H2, build 26100.6584). What the flags are, from Microsoft's public headers and specification: - 0x400 is `D3D12_RESOURCE_FLAG_USE_TIGHT_ALIGNMENT`. It first appears in DirectX-Headers v1.618.1 together with `D3D12_FEATURE_D3D12_TIGHT_ALIGNMENT` (54, one `D3D12_TIGHT_ALIGNMENT_TIER`); the Windows SDK 10.0.26100 header has neither. DirectX-Specs (`d3d/D3D12TightPlacedResourceAlignment.md`) lists `E_INVALIDARG` for the flag when the feature is reported as `D3D12_TIGHT_ALIGNMENT_TIER_NOT_SUPPORTED`. - 0x200 is `D3D12_RESOURCE_FLAG_VIDEO_PROCESS_3DLUT_ONLY`, named in DirectX-Headers from v1.620.1 on. What hosts answer. The newer runtimes are the `D3D12Core.dll` of Microsoft's Agility SDK (NuGet `Microsoft.Direct3D.D3D12` 1.618.5 and 1.620.2), loaded by a probe and by a local build of this test that opts into them: | Host runtime | Adapter | Feature 54 | 0x400, buffer and texture | 0x200, buffer | |---|---|---|---|---| | 10.0.26100.5074 (in the box) | Iris Xe, RTX 4060, WARP | `E_INVALIDARG` | refused | accepted | | 1.618.5 and 1.620.2 | RTX 4060 Laptop (NVIDIA 621.40) | `TIER_1` | accepted | refused | | 1.618.5 and 1.620.2 | Iris Xe (Intel 32.0.101.7092), WARP | `NOT_SUPPORTED` | refused | refused | | The layer | | `E_INVALIDARG` | accepted | refused | - All of these runtimes have `ID3D12Device11` to `ID3D12Device14`. So `ID3D12Device11` on the host, the condition commit 31d279823 gave the two 0x400 cases, does not tell whether the host accepts the flag: the runtime has to know the flag and the driver has to report `TIER_1`. - With the debug layer on, 10.0.26100.5074 says `D3D12_RESOURCE_DESC::Flags has unrecognized bits. The value is 0x400, and the unrecognized bits are 0x400.` - The newer runtimes refuse 0x200 on a buffer because `Flags can only have D3D12_RESOURCE_FLAG_VIDEO_PROCESS_3DLUT_ONLY set when D3D12_RESOURCE_DESC::Dimension is D3D12_RESOURCE_DIMENSION_TEXTURE3D` (their debug layer), and accept it on a 3D texture. 10.0.26100.5074 accepts it on a buffer and on 2D and 3D textures. The 0x200 case had no condition at all. The layer's answers to the three cases are those of a newer runtime on a driver with tight alignment, and this pull request does not change the layer. The change, in `runtime/test/d3d12_vulkan_device_test.cpp` only: - `host_tight_alignment`: the host answers feature 54 with a tier above `NOT_SUPPORTED`. The two 0x400 cases are compared on such a host, instead of on one with `ID3D12Device11`. Windows 10 and Windows 11 23H2, which the old condition was written for, refuse the flag, so they cannot report `TIER_1` and stay not comparable. - `host_knows_tight_alignment`: the host answers feature 54 at all, which makes its runtime 1.618 or newer. The 0x200 case is compared on such a host. On an older host the case is now held to the recorded answer instead of the host's; on Windows 10 and 23H2 the two are the same (the case had no condition and the test passed there). - `Case::recorded`: the layer's answer for a case, checked where the host is not comparable. The three cases have one (`E_INVALIDARG`, `S_OK`, `S_OK`). Until now a host that was not comparable checked nothing for a case, and one that happens to answer as a wrong layer does would have hidden it; the first negative control below is that situation. - The comment about the five `ID3D12Device11` cases now says three. ### Tested `main` 58be9cdf8 (built at 6293c1c4f; `runtime/` is identical between the two), MSVC Build Tools 2026, Ninja, RelWithDebInfo, Windows SDK 10.0.26100.0. The test takes the layer's own adapter as its host, so each line is layer and host on the same GPU unless it says WARP. Host runtime 10.0.26100.5074 (in the box): - Before, `LEONIDA_VK_DEVICE=iris` and `=4060`: exit 1, the three lines above, on both. - After, on both: exit 0, and the three cases print `not comparable on this host (ours ..., host ...)`. The same with `LEONIDA_HOST_ADAPTER=warp`. - Negative control 1, the layer's answers flipped (`committed_resource_refusal` takes 0x200 and not 0x400, exactly as this host answers): exit 1 on both GPUs with `ours 0x00000000, recorded 0x80070057 (host 0x00000000, not comparable)` for 0x200 and `ours 0x80070057, recorded 0x00000000 (host 0x80070057, not comparable)` for the two 0x400 cases. Without `recorded` this run passes. - Negative control 2, the two host conditions forced to true: exit 1 on both GPUs with the three original lines. Host runtime 1.618.5 (the test built locally with `D3D12SDKVersion` / `D3D12SDKPath` exports appended; not part of this pull request). Every run on this runtime also prints two lines that this change neither causes nor touches, `resource flag RAYTRACING_ACCELERATION_STRUCTURE on a buffer` / `on a texture: ours 0x00000000, host 0x80070057` (the newer runtime wants `ALLOW_UNORDERED_ACCESS` with that flag), so the exit code is 1 throughout. That is a separate matter and not part of this change. For the three cases of this pull request: - Before: on the RTX 4060 (`TIER_1`) they agree with the host. On the Iris Xe and with WARP as host (`NOT_SUPPORTED`) the two 0x400 cases fail, `ours 0x00000000, host 0x80070057`. So the old condition also fails on a current runtime wherever the driver has no tight alignment. - After: on the RTX 4060 the three cases are compared and equal (no line). On the Iris Xe and with WARP as host the two 0x400 cases print `not comparable`, and 0x200 is compared and equal. - Negative control on the compared path, the layer's answers flipped as above: on the RTX 4060 the three cases fail as compared cases (`0x200 on a buffer: ours 0x00000000, host 0x80070057`, `0x400 ...: ours 0x80070057, host 0x00000000` twice); on the Iris Xe 0x200 fails as a compared case and the two 0x400 cases through `recorded`. Host runtime 1.620.2: the probe gets the same answers as on 1.618.5 for the three cases on all three adapters. The test itself stops earlier there, at `allocation_mismatches` (among others a resource flag 0x1000 that this runtime accepts), which is also unrelated to this change. - `python -I scripts/check_no_game_data.py runtime/test/d3d12_vulkan_device_test.cpp`: clean. - Not run: the whole `ctest` (only this test was built), an up-to-date in-box Windows 11 runtime, Windows 10, Windows 11 23H2, AMD, Linux and Wine (the comparison is skipped without a Microsoft host). GPUs tested: Intel Iris Xe (Raptor Lake-P, 8086:a7a0), Intel 32.0.101.7092, Windows 11 build 26100.6584; NVIDIA GeForce RTX 4060 Laptop GPU, NVIDIA 621.40, Windows 11 build 26100.6584 AI-assisted: yes (Claude Code) ### 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. (not a translator change) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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#1254
No description provided.