D3D-78: Support Texture1D, Texture1DArray and Texture3D UAVs #213

Manually merged
github merged 4 commits from gh-pr/213/head into gh-pr/213/base 2026-11-26 08:49:01 +00:00
Owner

@⁠Andretuta on GitHub · 2026-11-24 02:45 UTC · original
ubiquitarianism:old-pr/9948 → main · +2375 −394 · 35 files · 4 commits · merged 2026-11-25 02:33 UTC

Carried over from old PR 9948 by guimsolutions in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/9948, 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.
guimsolutions: 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):

Summary

D3D-78, assigned to @guimsolutions. Adds default and explicit Texture1D, Texture1DArray, and Texture3D UAVs to CreateUnorderedAccessView.

Rebased onto upstream main at f847748cc76bd3777f9c070c4034eb2fc1c04e64, retaining the two linear D3D-78 commits. D3D-63 is already in main (c7d5f8e8). The rebased translator keeps upstream A16 2D mip addresses and typed 3D mip loads and uses the existing W-slice guard only for tagged UAVs. The Vulkan harness keeps upstream geometry and push-constant-tail support. The descriptor refusal test now starts its read-only resource in COMMON to comply with upstream resource-state validation.

Implementation

  • Validate resource dimensions, formats, mips, and layer ranges. Texture1D uses storage bindings 17ÔÇô19; storage-only Texture1DArray uses 26ÔÇô28 (float, UINT, SINT). Default 1D-array UAVs cover the full array, but 1D-array SRVs remain unsupported. Upstream multisample SRV bindings 20ÔÇô25 are unchanged. Bindless sizing and the pipeline checker account for Vulkan descriptor limits, including update-after-bind limits.
  • Keep Vulkan array layers at {0, 1} for 3D UAVs. Partial W ranges require VkImageViewSlicedCreateInfoEXT, imageSlicedViewOf3D, and robustImageAccess; otherwise the runtime writes a null descriptor rather than exposing the entire mip. Tagged descriptors carry FirstWSlice and effective WSize. Storage coordinates use relative Z; float/UINT/SINT sampled loads rebase Z and return zero outside the range or at nonzero view-relative LOD. Untagged SRVs keep their original coordinates and LOD.
  • Preserve SHADER-151 typed sampled aliases and the separate coherent storage-load path. A tagged R32_UINT volume UAV whose descriptor SGPR group also feeds volume atomics uses the formatted storage view for load-after-atomic visibility in the same dispatch. Other sampled loads keep upstream visibility rules. 3D stores and atomics cannot write to the shared fallback on a lookup miss.
  • Check formatless writes for the actual view format and formatless reads for storage-only 1D arrays. The synthetic regression leaves the legacy shaderStorageImage{Read,Write}WithoutFormat device bits disabled to exercise Vulkan 1.3's per-format path. Emulated RGB9E5 retains its logical sampled format and R32_UINT backing; generic operations that would need unsupported repacking or unpacking take the safe fallback.
  • Keep compatible whole-mip CPU clears usable without bindless. Reject partial 3D clears and unsafe 1D/3D format reinterpretation; packed RGB9E5 clears retain bit-exact backing and existing upstream 2D typed attachment clears are unchanged.

Validation for 476ad95f

Windows: RTX 4090 (NVIDIA 621.01) and Intel UHD 770 (32.0.101.7088). GPU checks used the Khronos validation layer and synchronization validation.

Check Result
CMake/Ninja and CTest Build passed. RTX 4090: 134 passed, 8 skipped, 1 disabled. UHD 770: 131 passed, 9 skipped, 1 disabled, 2 baseline failures.
--filter cs_texture_uav Passed on both GPUs in standard and LEONIDA_PC_TAIL_UBO=1 modes: 14 cases (10 compared with WARP) on RTX 4090 and 10 cases (8 compared with WARP) on UHD 770. Intel lacks sliced 3D views; rejection of unsupported partial views was verified. No validation errors in the UAV readback test.
Full GPU runner (LEONIDA_W64_EMULATE=1) RTX 4090: 186 passed, 15 skipped, spirv-val 206/206. UHD 770: 168 passed, 33 skipped, spirv-val 205/205 translated. No failed GPU checks; each adapter adds two passing cases over exact upstream with unchanged skip counts.
Direct Vulkan regressions Packed RGB9E5 backing and #782 double-copy replay passed on both GPUs without validation errors; the synchronization self-test confirmed the layer was active. vk_pipeline_check compiled compute and geometry fixtures in both push-constant modes on both GPUs.
Python and CLI 806 passed, 10 skipped across the focused suites; 7,322 semantic tests run with one upstream expected failure (test_all_nan_keeps_src0) and no unexpected failures. compileall and make_game.py --help passed.

On exact upstream f847748c, UHD 770 reproduced the same CTest failures: d3d12_descriptor (lod_mismatches == 0, line 2659) and d3d12_subgroup (fragment_default, line 611). The Intel fallback still cannot translate ps_ij_computed without PerVertexKHR; every translated module passed validation. CTest skips reflect missing game-derived fixtures, unavailable adapter features, or opt-in validation (run separately); GameInput was disabled without SDL3. Other GPU skips reflect unsupported features or fixtures covered by separate tests. Python skips reflect missing synthetic DXBC fixtures or POSIX-only tests.

The requested scripts/run_gpu_tests.py integration is included: --filter cs_texture_uav dispatches the Windows differential test, and the full runner also exercises cs_imgload_mip. Runner unit tests cover pass, fail, missing executables, translation failure, and stale SPIR-V.

The regression creates and copies descriptors through the D3D12 shim, then dispatches a Vulkan compute pipeline with Leonida's real bindless set 0; this is not an end-to-end D3D12 Dispatch test. Coverage includes UINT/FLOAT and typeless views, nonzero mips, invalid descriptors, preservation of neighboring layers and slices, coexistence with a typed 3D SRV, dynamic image_load_mip, and active/inactive add and compare-and-swap with glc.

In a separate earlier native D3D12 probe, the RTX 4090 and UHD 770 clipped writes to the selected W range. WARP 10.0.26100.9818 rebased the view but wrote past a finite WSize under overdispatch. The oracle therefore compares in-range writes; Vulkan preservation of neighboring slices is checked independently.

Project compliance and AI disclosure

Only independently written synthetic fixtures were used. No proprietary game data, game shaders, keys, or protected content were used or included. AI-assisted implementation and review using OpenCode; validation is recorded above.

Previous contribution: #773

**@⁠Andretuta** on GitHub · 2026-11-24 02:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/213) `ubiquitarianism:old-pr/9948` → `main` · +2375 −394 · 35 files · 4 commits · merged 2026-11-25 02:33 UTC > Carried over from **old PR 9948** by `guimsolutions` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/9948`, 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. > `guimsolutions`: 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): ## Summary D3D-78, [assigned to `@guimsolutions`](https://github.com/ItsNotRexed/Leonida/issues/313#issuecomment-7072436551). Adds default and explicit `Texture1D`, `Texture1DArray`, and `Texture3D` UAVs to `CreateUnorderedAccessView`. Rebased onto upstream `main` at `f847748cc76bd3777f9c070c4034eb2fc1c04e64`, retaining the two linear D3D-78 commits. D3D-63 is already in `main` (`c7d5f8e8`). The rebased translator keeps upstream A16 2D mip addresses and typed 3D mip loads and uses the existing W-slice guard only for tagged UAVs. The Vulkan harness keeps upstream geometry and push-constant-tail support. The descriptor refusal test now starts its read-only resource in `COMMON` to comply with upstream resource-state validation. ## Implementation - Validate resource dimensions, formats, mips, and layer ranges. `Texture1D` uses storage bindings **17ÔÇô19**; storage-only `Texture1DArray` uses **26ÔÇô28** (float, UINT, SINT). Default 1D-array UAVs cover the full array, but 1D-array SRVs remain unsupported. Upstream multisample SRV bindings **20ÔÇô25** are unchanged. Bindless sizing and the pipeline checker account for Vulkan descriptor limits, including update-after-bind limits. - Keep Vulkan array layers at `{0, 1}` for 3D UAVs. Partial W ranges require `VkImageViewSlicedCreateInfoEXT`, `imageSlicedViewOf3D`, and `robustImageAccess`; otherwise the runtime writes a null descriptor rather than exposing the entire mip. Tagged descriptors carry `FirstWSlice` and effective `WSize`. Storage coordinates use relative Z; float/UINT/SINT sampled loads rebase Z and return zero outside the range or at nonzero view-relative LOD. Untagged SRVs keep their original coordinates and LOD. - Preserve SHADER-151 typed sampled aliases and the separate coherent storage-load path. A tagged `R32_UINT` volume UAV whose descriptor SGPR group also feeds volume atomics uses the formatted storage view for load-after-atomic visibility in the same dispatch. Other sampled loads keep upstream visibility rules. 3D stores and atomics cannot write to the shared fallback on a lookup miss. - Check formatless writes for the actual view format and formatless reads for storage-only 1D arrays. The synthetic regression leaves the legacy `shaderStorageImage{Read,Write}WithoutFormat` device bits disabled to exercise Vulkan 1.3's per-format path. Emulated RGB9E5 retains its logical sampled format and `R32_UINT` backing; generic operations that would need unsupported repacking or unpacking take the safe fallback. - Keep compatible whole-mip CPU clears usable without bindless. Reject partial 3D clears and unsafe 1D/3D format reinterpretation; packed RGB9E5 clears retain bit-exact backing and existing upstream 2D typed attachment clears are unchanged. ## Validation for `476ad95f` Windows: RTX 4090 (NVIDIA 621.01) and Intel UHD 770 (32.0.101.7088). GPU checks used the Khronos validation layer and synchronization validation. | Check | Result | | --- | --- | | CMake/Ninja and CTest | Build passed. RTX 4090: **134 passed, 8 skipped, 1 disabled**. UHD 770: **131 passed, 9 skipped, 1 disabled, 2 baseline failures**. | | `--filter cs_texture_uav` | Passed on both GPUs in standard and `LEONIDA_PC_TAIL_UBO=1` modes: **14** cases (**10** compared with WARP) on RTX 4090 and **10** cases (**8** compared with WARP) on UHD 770. Intel lacks sliced 3D views; rejection of unsupported partial views was verified. No validation errors in the UAV readback test. | | Full GPU runner (`LEONIDA_W64_EMULATE=1`) | RTX 4090: **186 passed, 15 skipped**, `spirv-val` **206/206**. UHD 770: **168 passed, 33 skipped**, `spirv-val` **205/205 translated**. No failed GPU checks; each adapter adds two passing cases over exact upstream with unchanged skip counts. | | Direct Vulkan regressions | Packed RGB9E5 backing and `#782` double-copy replay passed on both GPUs without validation errors; the synchronization self-test confirmed the layer was active. `vk_pipeline_check` compiled compute and geometry fixtures in both push-constant modes on both GPUs. | | Python and CLI | **806 passed, 10 skipped** across the focused suites; **7,322 semantic tests run** with one upstream expected failure (`test_all_nan_keeps_src0`) and no unexpected failures. `compileall` and `make_game.py --help` passed. | On exact upstream `f847748c`, UHD 770 reproduced the same CTest failures: `d3d12_descriptor` (`lod_mismatches == 0`, line 2659) and `d3d12_subgroup` (`fragment_default`, line 611). The Intel fallback still cannot translate `ps_ij_computed` without `PerVertexKHR`; every translated module passed validation. CTest skips reflect missing game-derived fixtures, unavailable adapter features, or opt-in validation (run separately); GameInput was disabled without SDL3. Other GPU skips reflect unsupported features or fixtures covered by separate tests. Python skips reflect missing synthetic DXBC fixtures or POSIX-only tests. The requested `scripts/run_gpu_tests.py` integration is included: `--filter cs_texture_uav` dispatches the Windows differential test, and the full runner also exercises `cs_imgload_mip`. Runner unit tests cover pass, fail, missing executables, translation failure, and stale SPIR-V. The regression creates and copies descriptors through the D3D12 shim, then dispatches a Vulkan compute pipeline with Leonida's real bindless set 0; this is not an end-to-end D3D12 `Dispatch` test. Coverage includes UINT/FLOAT and typeless views, nonzero mips, invalid descriptors, preservation of neighboring layers and slices, coexistence with a typed 3D SRV, dynamic `image_load_mip`, and active/inactive add and compare-and-swap with `glc`. In a separate earlier native D3D12 probe, the RTX 4090 and UHD 770 clipped writes to the selected W range. WARP `10.0.26100.9818` rebased the view but wrote past a finite `WSize` under overdispatch. The oracle therefore compares in-range writes; Vulkan preservation of neighboring slices is checked independently. ## Project compliance and AI disclosure Only independently written synthetic fixtures were used. No proprietary game data, game shaders, keys, or protected content were used or included. AI-assisted implementation and review using OpenCode; validation is recorded above. Previous contribution: `#773`
D3D-78: keep storage-only 1D-array bindings separate from upstream multisample SRVs. Validate typed views and W ranges; use sliced storage views with tagged coordinates, typed loads, stores and R32_UINT atomics. Keep clears safe and align the existing descriptor, RGB9E5 and shader regressions with the runtime contract.

Reconstructs bf9201c8 and the implementation portions of the original branch through a56b8589. D3D-63 resource creation already comes from upstream c7d5f8e8.
Register the descriptor smoke test with CTest and run synthetic dispatches against the real bindless set and WARP. Cover sliced-volume atomics, typed mip loads, and runner failure/skip handling; document the ABI, limits, and test procedure.

Reconstructs 6429d472, 8dc50af2, and the test and documentation resolutions through a56b8589.
Coherent 1D and 3D loads and all 1D-array loads can issue OpImageRead on Unknown-format storage views. Require both per-format access bits before registering the view or writing its descriptor, while preserving the formatted RGB9E5 exception.

AI-assisted. Verified the synthetic UAV readback and format refusals with Vulkan validation on RTX 4090 (621.01) and UHD 770 (101.7088).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 08:48:59 +00:00
github manually merged commit 33f4a5aede into gh-pr/213/base 2026-11-26 08:49:01 +00:00
Author
Owner

@⁠cobrabm12 on GitHub · 2026-11-24 09:17 UTC · original

I ran an independent whole-mip Texture3D UAV test on the PR head at 33f4a5aed, using an RX 7600 XT, RADV 26.2.5 and Wine 11.21. All 12 views registered a bindless entry. GPU clear and readback matched all 2,034 texels across two mips in RG16_FLOAT, RGBA16_FLOAT, R32_UINT, R8_UINT, R11G11B10_FLOAT and RGBA8_UNORM. Mip zero used an explicit full WSize and mip one used UINT_MAX. The test forwards the actual robustImageAccess feature from the Vulkan harness.

Only the synthetic test file was changed on this PR head. The result covers whole-volume clear and readback. Shader dispatch and partial-depth views were outside this test. Test patch and reproduction instructions. AI-assisted with Codex.

**@⁠cobrabm12** on GitHub · 2026-11-24 09:17 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/213#issuecomment-7127220544) I ran an independent whole-mip Texture3D UAV test on the PR head at 33f4a5aed, using an RX 7600 XT, RADV 26.2.5 and Wine 11.21. All 12 views registered a bindless entry. GPU clear and readback matched all 2,034 texels across two mips in RG16_FLOAT, RGBA16_FLOAT, R32_UINT, R8_UINT, R11G11B10_FLOAT and RGBA8_UNORM. Mip zero used an explicit full WSize and mip one used UINT_MAX. The test forwards the actual robustImageAccess feature from the Vulkan harness. Only the synthetic test file was changed on this PR head. The result covers whole-volume clear and readback. Shader dispatch and partial-depth views were outside this test. [Test patch and reproduction instructions](https://gist.github.com/cobrabm12/8ed85dc667d8c392341f04c79e7ed403/d9b4cd73e969c1a96b3fdcae53b97878d0564496). AI-assisted with Codex.
This discussion has been locked. Commenting is limited to contributors.
No description provided.