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

Manually merged
github merged 1 commit from gh-pr/1860/head into gh-pr/1860/base 2026-11-26 10:08:59 +00:00
Owner

@⁠lixonik on GitHub · 2026-11-25 13:21 UTC · original
lixonik:fix/title-3d-view-array-range → main · +35 −6 · 3 files · 1 commits · merged 2026-11-25 22:02 UTC

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.
**@⁠lixonik** on GitHub · 2026-11-25 13:21 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1860) `lixonik:fix/title-3d-view-array-range` → `main` · +35 −6 · 3 files · 1 commits · merged 2026-11-25 22:02 UTC Claimed in the coordination issue as: [D3D-3D-VIEW-ARRAY-RANGE](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) ### 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://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) · [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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:08:59 +00:00
github manually merged commit 857314142c into gh-pr/1860/base 2026-11-26 10:08:59 +00:00
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-25 13:47 UTC · original · reviewed

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.

**@⁠madvillain91** on GitHub · 2026-11-25 13:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1860#pullrequestreview-6058777608) · **reviewed** 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.
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-25 13:47 UTC · original

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.

**@⁠ecox982745** on GitHub · 2026-11-25 13:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1860#issuecomment-7164302942) 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.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 22:02 UTC · original

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).

**@⁠aslan2142** on GitHub · 2026-11-25 22:02 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1860#issuecomment-7175863583) 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).
This discussion has been locked. Commenting is limited to contributors.
No description provided.