D3D-3D-VIEW-ARRAY-RANGE: use the single array layer for Vulkan 3D views #1860

Merged
lixonik merged 1 commit from upstream-pr/1860 into main 2026-11-25 22:02:37 +00:00
lixonik commented 2026-11-25 13:21:30 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-25T13:21:30Z.


Claimed in the coordination issue as: D3D-3D-VIEW-ARRAY-RANGE

What and why

A title-written GFX10 Texture3D descriptor can carry a nonzero BASE_ARRAY in the same word as its depth. The runtime used that field as Vulkan's baseArrayLayer. Both the sampled and storage image view creation paths now use array layer zero and a count of one for a 3D view. Mips, aspects, 2D array layers and the original descriptor bytes used as the bindless key are preserved.

In GFX10 SRV mode, hardware ignores the volume's BASE_ARRAY. In raw UAV mode it is a W-slice offset. The raw descriptor path refuses that offset rather than binding a whole-mip storage view in its place. The API path continues to use Vulkan's sliced-view extension for partial D3D12 Texture3D UAVs.

Runtime finding · Mesa's GFX10 descriptor builder · Vulkan image view valid usage

Tested

  • Built and ran gfx10_descriptors_test directly with MSVC. The new assertions cover sampled 3D T#s with nonzero BASE_ARRAY, recognition of a raw UAV W-slice offset, the mip range and 2D array layers. Restoring the old range mapping made the new 3D assertion fail.
  • Ran a synthetic Vulkan A/B test on lavapipe with Khronos Validation 1.3.204. A 33×33×33 storage-capable volume and nonzero BASE_ARRAY triggered the older layer's 01482 and 01483 VUIDs with the old range. The fixed range created the view with zero validation errors.
  • python -I -B scripts/run_semantic_tests.py tests/semantic passed 6,261 tests across 489 files.
  • Full Windows shim and game boot were outside these results. CMake requires Windows SDK 10.0.26100 or newer for the shim build.

GPUs tested: n/a (software Vulkan on lavapipe)

AI-assisted.

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5492146122 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1860). Originally posted by [lixonik](https://github.com/lixonik) on 2026-11-25T13:21:30Z. --- Claimed in the coordination issue as: [D3D-3D-VIEW-ARRAY-RANGE](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163394940) ### What and why A title-written GFX10 Texture3D descriptor can carry a nonzero `BASE_ARRAY` in the same word as its depth. The runtime used that field as Vulkan's `baseArrayLayer`. Both the sampled and storage image view creation paths now use array layer zero and a count of one for a 3D view. Mips, aspects, 2D array layers and the original descriptor bytes used as the bindless key are preserved. In GFX10 SRV mode, hardware ignores the volume's `BASE_ARRAY`. In raw UAV mode it is a W-slice offset. The raw descriptor path refuses that offset rather than binding a whole-mip storage view in its place. The API path continues to use Vulkan's sliced-view extension for partial D3D12 Texture3D UAVs. [Runtime finding](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7163255196) · [Mesa's GFX10 descriptor builder](https://chromium.googlesource.com/external/gitlab.freedesktop.org/mesa/mesa/+/418c4cfa6708a0e0b1175e72fb8fd27d3ca1615a/src/amd/common/ac_descriptors.c#533) · [Vulkan image view valid usage](https://docs.vulkan.org/refpages/latest/refpages/source/VkImageViewCreateInfo.html) ### Tested - Built and ran `gfx10_descriptors_test` directly with MSVC. The new assertions cover sampled 3D T#s with nonzero `BASE_ARRAY`, recognition of a raw UAV W-slice offset, the mip range and 2D array layers. Restoring the old range mapping made the new 3D assertion fail. - Ran a synthetic Vulkan A/B test on lavapipe with Khronos Validation 1.3.204. A 33×33×33 storage-capable volume and nonzero `BASE_ARRAY` triggered the older layer's 01482 and 01483 VUIDs with the old range. The fixed range created the view with zero validation errors. - `python -I -B scripts/run_semantic_tests.py tests/semantic` passed 6,261 tests across 489 files. - Full Windows shim and game boot were outside these results. CMake requires Windows SDK 10.0.26100 or newer for the shim build. GPUs tested: n/a (software Vulkan on lavapipe) AI-assisted. ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption.
madvillain91 commented 2026-11-25 13:47:42 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by madvillain91 on 2026-11-25T13:47:42Z.

Review: COMMENTED


Independent Windows 11 26H2 (26300.9711) check at 857314142 against main 384abe5b0, using VS 2022 Build Tools (MSVC 19.44.35230.0, RelWithDebInfo, Ninja), Vulkan SDK 1.4.363.0, and NVIDIA GeForce RTX 3070 Ti (Ampere, driver 617.14, Vulkan 1.4.351).

  • gfx10_descriptors_test: passed (verifies vulkan_subresource_range() clamps 3D views to baseArrayLayer=0, layerCount=1 while preserving array layers on 2D arrays, and has_hardware_volume_uav_slice_offset() flags non-zero hardware 3D UAV slice offsets).
  • d3d12_vulkan_device_test (LEONIDA_VK_VALIDATION=1): passed with 0 VUIDs.

Code review looks clean and matches Vulkan's VkImageViewCreateInfo 3D subresource-range rules. Not checked: retail boot or a live 3D UAV slice-offset draw. LGTM.

AI-assisted verification.

<!-- greyfinch-sync:ubiquitarianism/leonida:review:6058777608 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1860#pullrequestreview-6058777608). Originally posted by [madvillain91](https://github.com/madvillain91) on 2026-11-25T13:47:42Z. **Review:** COMMENTED --- Independent Windows 11 26H2 (26300.9711) check at 857314142 against main 384abe5b0, using VS 2022 Build Tools (MSVC 19.44.35230.0, RelWithDebInfo, Ninja), Vulkan SDK 1.4.363.0, and NVIDIA GeForce RTX 3070 Ti (Ampere, driver 617.14, Vulkan 1.4.351). - `gfx10_descriptors_test`: passed (verifies `vulkan_subresource_range()` clamps 3D views to `baseArrayLayer=0, layerCount=1` while preserving array layers on 2D arrays, and `has_hardware_volume_uav_slice_offset()` flags non-zero hardware 3D UAV slice offsets). - `d3d12_vulkan_device_test` (`LEONIDA_VK_VALIDATION=1`): passed with 0 VUIDs. Code review looks clean and matches Vulkan's `VkImageViewCreateInfo` 3D subresource-range rules. Not checked: retail boot or a live 3D UAV slice-offset draw. LGTM. AI-assisted verification.
ecox982745 commented 2026-11-25 13:47:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by ecox982745 on 2026-11-25T13:47:48Z.


Verified the Windows shim at 857314142 on an RTX 4090 (Windows 11, NVIDIA 616.64, MSVC). The standalone runtime bound both sampled descriptors with nonzero BASE_ARRAY and refused the raw sliced UAV.

I used a 33×33×33 R32_UINT volume with four mips and a sampled view covering mips 1–2. I copied its descriptor into a CPU-written console heap, changed the fields below, submitted a command list, and looked up each original eight-word key. The modified keys all had index zero before the heap was registered.

Console heap slot Bindless index after submission
Original sampled view, base 0 1
Sampled view, base 5 2
Sampled view, base 37 3
Raw UAV, slice offset 2 (WORD5[3:0] = 1) 0

The runtime logged the explicit unsupported-slice reason for the last slot. This probe checks native view registration and key identity. Separately, I translated the PR revision’s synthetic cs_texture_uav shader using LLVM 23.1.6. It passed SPIR-V validation and all 14 GPU storage-image cases passed readback, including 10 compared with D3D12 WARP. Those writes exercise the API-created views. I did not sample texels through the two modified raw sampled descriptors.

CTest also passed gfx10_descriptors (CPU), d3d12_texture_uav, and d3d12_view_slices. All inputs were synthetic. AI-assisted verification with OpenAI Codex.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7164302942 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1860#issuecomment-7164302942). Originally posted by [ecox982745](https://github.com/ecox982745) on 2026-11-25T13:47:48Z. --- Verified the Windows shim at `857314142` on an RTX 4090 (Windows 11, NVIDIA 616.64, MSVC). The standalone runtime bound both sampled descriptors with nonzero `BASE_ARRAY` and refused the raw sliced UAV. I used a 33×33×33 `R32_UINT` volume with four mips and a sampled view covering mips 1–2. I copied its descriptor into a CPU-written console heap, changed the fields below, submitted a command list, and looked up each original eight-word key. The modified keys all had index zero before the heap was registered. | Console heap slot | Bindless index after submission | | --- | ---: | | Original sampled view, base 0 | 1 | | Sampled view, base 5 | 2 | | Sampled view, base 37 | 3 | | Raw UAV, slice offset 2 (`WORD5[3:0] = 1`) | 0 | The runtime logged the explicit unsupported-slice reason for the last slot. This probe checks native view registration and key identity. Separately, I translated the PR revision’s synthetic `cs_texture_uav` shader using LLVM 23.1.6. It passed SPIR-V validation and all 14 GPU storage-image cases passed readback, including 10 compared with D3D12 WARP. Those writes exercise the API-created views. I did not sample texels through the two modified raw sampled descriptors. CTest also passed `gfx10_descriptors` (CPU), `d3d12_texture_uav`, and `d3d12_view_slices`. All inputs were synthetic. AI-assisted verification with OpenAI Codex.
aslan2142 commented 2026-11-25 22:02:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-25T22:02:40Z.


Merged, thanks! A 3D view now uses the single array layer Vulkan allows, instead of a nonzero baseArrayLayer.

  • Tested: the full Windows suite under Wine on lavapipe and RADV (gfx1036 iGPU), with this merged onto main 24d8af66a: the only pass-to-fail was xmem, the known first-run flake, which passed 5 of 5 on both devices when re-run alone.
  • Checked on main 6b843a4ad + 857314142: it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 3 changed files.

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

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7175863583 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/1860#issuecomment-7175863583). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-25T22:02:40Z. --- Merged, thanks! A 3D view now uses the single array layer Vulkan allows, instead of a nonzero `baseArrayLayer`. - **Tested:** the full Windows suite under Wine on lavapipe and RADV (gfx1036 iGPU), with this merged onto `main` `24d8af66a`: the only pass-to-fail was `xmem`, the known first-run flake, which passed 5 of 5 on both devices when re-run alone. - **Checked on `main` `6b843a4ad` + `857314142`:** it merges cleanly; the semantic suite passes (491 files, 6,312 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 3 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
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!1860
No description provided.