d3d12: choose sparse-capable queues for sparse textures (D3D-SPARSE-IMAGE-QUEUE-FAMILY) #1164

Open
github-bot wants to merge 1 commit from github-bot/gh-1164 into main AGit
Owner

@⁠lixonik on GitHub · 2026-11-24 19:28 UTC · original
lixonik:d3d-sparse-image-queue-family → main · +30 −24 · 3 files · 1 commits · open

Claimed in the coordination issue as D3D-SPARSE-IMAGE-QUEUE-FAMILY.

What and why

Queue selection used sparse buffer residency as its gate, while the device can expose sparse 2D textures independently. With sparse textures and no sparse buffers, a D3D12 COPY or COMPUTE queue could keep a dedicated Vulkan queue without VK_QUEUE_SPARSE_BINDING_BIT. Tile mapping on that queue would then pass an invalid queue to vkQueueBindSparse.

Use the same sparse aliasing prerequisites for device initialization and queue selection. Apply the fallback when either sparse buffer or sparse 2D image residency is available, retaining dedicated queues that support sparse binding. Add a synthetic image-only case to the queue-family picker tests.

Tested

  • With the former buffer-only gate restored, the new image-only assertion fails. With the fix, the synthetic picker passes all seven layouts on Windows with MSVC and on Ubuntu with GCC.
  • Compiled the modified Windows runtime translation unit and vk_queue_test.cpp with MSVC.
  • The Ubuntu vk_queue_test also passed the CPU queue-slot checks. Its GPU portion reported skip because the local Ubuntu environment has no Vulkan loader.
  • Full translator semantic suite passed (470 files, 6,141 tests). Python compile checks and make_game.py --help passed.
  • git diff --check and scripts/check_no_game_data.py passed.

GPUs tested: n/a (CPU-only synthetic checks).

AI-assisted.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
  • No new translator rule.
**@⁠lixonik** on GitHub · 2026-11-24 19:28 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1164) `lixonik:d3d-sparse-image-queue-family` → `main` · +30 −24 · 3 files · 1 commits · open Claimed in the coordination issue as [D3D-SPARSE-IMAGE-QUEUE-FAMILY](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14). ### What and why Queue selection used sparse buffer residency as its gate, while the device can expose sparse 2D textures independently. With sparse textures and no sparse buffers, a D3D12 COPY or COMPUTE queue could keep a dedicated Vulkan queue without `VK_QUEUE_SPARSE_BINDING_BIT`. Tile mapping on that queue would then pass an invalid queue to `vkQueueBindSparse`. Use the same sparse aliasing prerequisites for device initialization and queue selection. Apply the fallback when either sparse buffer or sparse 2D image residency is available, retaining dedicated queues that support sparse binding. Add a synthetic image-only case to the queue-family picker tests. ### Tested - With the former buffer-only gate restored, the new image-only assertion fails. With the fix, the synthetic picker passes all seven layouts on Windows with MSVC and on Ubuntu with GCC. - Compiled the modified Windows runtime translation unit and `vk_queue_test.cpp` with MSVC. - The Ubuntu `vk_queue_test` also passed the CPU queue-slot checks. Its GPU portion reported skip because the local Ubuntu environment has no Vulkan loader. - Full translator semantic suite passed (470 files, 6,141 tests). Python compile checks and `make_game.py --help` passed. - `git diff --check` and `scripts/check_no_game_data.py` passed. GPUs tested: n/a (CPU-only synthetic checks). AI-assisted. ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys or decryption. - [x] No new translator rule.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:40:59 +00:00
Author
Owner

@⁠madhyn on GitHub · 2026-11-24 19:29 UTC · original

Tested fb50e0b14 on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan):

  • vk_queue (Linux): Passed (0.56 s)
  • d3d12_vulkan_device (Wine): Passed (7.65 s)

AI-assisted: yes

**@⁠madhyn** on GitHub · 2026-11-24 19:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1164#issuecomment-7142180935) Tested `fb50e0b14` on Arch Linux + Wine 11.22 + NVIDIA RTX 3060 Ti (595.58.03 / Vulkan): - `vk_queue` (Linux): **Passed** (0.56 s) - `d3d12_vulkan_device` (Wine): **Passed** (7.65 s) AI-assisted: yes
Author
Owner

@⁠abnalstlll-byte on GitHub · 2026-11-24 19:32 UTC · original · approved these changes

Reviewed and verified. Fixes Vulkan queue selection in runtime/shims/d3d12_vulkan_device.cpp to verify sparse binding capability when either sparse buffers OR sparse 2D textures are supported, ensuring COPY and COMPUTE queues passed to vkQueueBindSparse carry VK_QUEUE_SPARSE_BINDING_BIT. Verified via synthetic queue tests in vk_queue_test.cpp. 100% clean-room.

**@⁠abnalstlll-byte** on GitHub · 2026-11-24 19:32 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1164#pullrequestreview-6045990595) · **approved these changes** Reviewed and verified. Fixes Vulkan queue selection in `runtime/shims/d3d12_vulkan_device.cpp` to verify sparse binding capability when either sparse buffers OR sparse 2D textures are supported, ensuring COPY and COMPUTE queues passed to `vkQueueBindSparse` carry `VK_QUEUE_SPARSE_BINDING_BIT`. Verified via synthetic queue tests in `vk_queue_test.cpp`. 100% clean-room.
Author
Owner

@⁠Deedlyy on GitHub · 2026-11-24 20:11 UTC · original

Recommendation: [MERGE]

Reasoning: Queue selection now gates on the same sparse prerequisites as device init (sparse buffers or sparse images), so a sparse-texture-only device no longer gets a COPY/COMPUTE queue without SPARSE_BINDING. Small fix with a queue test. Verified on Linux/Wine + RTX 3060 Ti by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with main. Merge once the queued checks are green.

Impact level: 4/10

**@⁠Deedlyy** on GitHub · 2026-11-24 20:11 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1164#issuecomment-7143168231) **Recommendation:** [MERGE] **Reasoning:** Queue selection now gates on the same sparse prerequisites as device init (sparse buffers or sparse images), so a sparse-texture-only device no longer gets a COPY/COMPUTE queue without `SPARSE_BINDING`. Small fix with a queue test. Verified on Linux/Wine + RTX 3060 Ti by madhyn. CI (label, change-scope, no-game-data and the Runtime jobs) is still queued awaiting maintainer workflow approval, so nothing has run in CI yet; GitHub reports no merge conflict with `main`. Merge once the queued checks are green. **Impact level:** 4/10
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1164/head:github-bot/gh-1164'
git switch 'github-bot/gh-1164'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1164'
git switch 'github-bot/gh-1164'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1164'
git switch 'github-bot/gh-1164'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1164'
git switch 'main'
git merge --squash 'github-bot/gh-1164'
git switch 'main'
git merge --ff-only 'github-bot/gh-1164'
git switch 'main'
git merge 'github-bot/gh-1164'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.