d3d12: choose sparse-capable queues for sparse textures (D3D-SPARSE-IMAGE-QUEUE-FAMILY) #1164
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1164"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-24T19:28:14Z.
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 tovkQueueBindSparse.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
vk_queue_test.cppwith MSVC.vk_queue_testalso passed the CPU queue-slot checks. Its GPU portion reported skip because the local Ubuntu environment has no Vulkan loader.make_game.py --helppassed.git diff --checkandscripts/check_no_game_data.pypassed.GPUs tested: n/a (CPU-only synthetic checks).
AI-assisted.
Checklist
main.Imported from ubiquitarianism/leonida. Originally posted by madhyn on 2026-11-24T19:29:50Z.
Tested
fb50e0b14on 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
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T19:32:52Z.
Review: APPROVED
Reviewed and verified. Fixes Vulkan queue selection in
runtime/shims/d3d12_vulkan_device.cppto verify sparse binding capability when either sparse buffers OR sparse 2D textures are supported, ensuring COPY and COMPUTE queues passed tovkQueueBindSparsecarryVK_QUEUE_SPARSE_BINDING_BIT. Verified via synthetic queue tests invk_queue_test.cpp. 100% clean-room.Imported from ubiquitarianism/leonida. Originally posted by Deedlyy on 2026-11-24T20:11:29Z.
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 withmain. Merge once the queued checks are green.Impact level: 4/10
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T23:57:22Z.
#1164 | head
fb50e0b14f(merged cleanly with mainba8b77b390— no conflicts on currentmain) |ctest --test-dir runtime/build -C RelWithDebInfo -R "^(vk_queue|d3d12_buffer_tiles|d3d12_texture_tiles|d3d12_sparse_queue_family_contract)$" --output-on-failure(LEONIDA_VK_VALIDATION=1) | red proof: restoring the buffer-only!features.sparseResidencyBuffergate inruntime/src/queue_families.hfailsvk_queueatline 150: image_only.direct == 0 && image_only.compute == 0 && image_only.copy == 0| green on PR+main:4/4CTests (vk_queue—7 layouts ok+validation errors: 0,d3d12_buffer_tiles—12 full tiles matchedvs native D3D12 Tier 4,d3d12_texture_tiles— all4gated remap/COPY-to-DIRECT handoff cases matched native D3D12,d3d12_sparse_queue_family_contract—3 COPY/COMPUTE sparse queue cases+VK API CONTRACT PASS) pass in7.04 son RTX 3090 with0Khronos validation errors;check_no_game_data.py0violations | Windows 11, MSVC 19.44, RTX 3090, Vulkan SDK 1.4.363.1 | AI-assisted: yesImported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T08:58:47Z.
Validation run of this pull request.
fb50e0b14f. main:54b2a81e95. Merged cleanly (git merge --no-edit --no-ff pr-1164, no conflicts); tested at the merge commit.cmake -S runtime -B runtime/build -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEONIDA_REQUIRE_VULKAN=ONcmake --build runtime/build --target gta6rt vk_queue_test d3d12_vulkan_device_test d3d12_sparse_queue_family_test -j 8ctest -R "^(vk_queue|d3d12_vulkan_device|d3d12_sparse_queue_family|d3d12_sparse_queue_family_contract)$" --output-on-failure -j1vk_queueprintsqueue family picker: 7 layouts ok. The last three are the tests that exercise the touchedd3d12_vulkan_device.cppandqueue_families.h.queue_families.handd3d12_vulkan_device.cpptaken back from main, the test kept:vk_queue_testdoes not build (sparse_capable_queue_familiestakes no 4 arguments). The signature changes, so this is only a build failure.!(features.sparseResidencyBuffer || features.sparseResidencyImage2D)replaced by!features.sparseResidencyBuffer).vk_queuefails:line 150: image_only.direct == 0 && image_only.compute == 0 && image_only.copy == 0, the new image-only case. This is the reason the PR gives.Imported from ubiquitarianism/leonida. Originally posted by enlight3d on 2026-11-29T18:22:34Z.
RUN #1164 | head
fb50e0b14f, merged cleanly with main4364a4fa61(local merge, not pushed)Commands (repository root, temporary worktree):
Green (merged): 4 of 4 passed, none skipped (
vk_queue,d3d12_vulkan_device,d3d12_sparse_queue_family,d3d12_sparse_queue_family_contract).Red, build kind:
queue_families.handd3d12_vulkan_device.cpptaken back from main, the test kept:vk_queue_testdoes not build (sparse_capable_queue_familiesdoes not take 4 arguments). The signature changes, so this alone is only a build failure.Red, behavioural kind (a mutation made for this run): new signature kept, the gate
!(features.sparseResidencyBuffer || features.sparseResidencyImage2D)replaced by!features.sparseResidencyBuffer.vk_queuethen fails at the new image-only case:line 150: image_only.direct == 0 && image_only.compute == 0 && image_only.copy == 0.Link: no new imports vs main (gta6rt.exe, 723 DLL!symbol entries on both, dumpbin /imports).
#2566: no conflict with #2566 (merge-tree of the two heads is clean).
Machine: RTX 3090 24 GB, NVIDIA 621.40, Windows 11 Pro 10.0.26300, MSVC 19.44, Vulkan SDK 1.4.363.1.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T19:00:16Z.
Merging. Head
fb50e0b14has red/green verdicts from reviewers other than the author (above), merges cleanly withmainf7a4e75bf, does not force a rebase of #2566, and carries a claim ID. Remaining main CI reds (translator-testsmesh,semantic-testsf16) are pre-existing. Merged by MoonEyes.AI-assisted (Claude Code).