[PR #1182] d3d12: keep sparse tile mappings in queue order (D3D-SPARSE-TILE-WAIT-ORDER) #1216

Open
opened 2026-11-26 20:20:29 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1182
Author: @lixonik
Created: 11/24/2026
Status: 🔄 Open

Base: main ← Head: d3d-sparse-tile-wait-order


📝 Commits (1)

  • 47420b2 Keep sparse tile mappings in Vulkan queue order

📊 Changes

4 files changed (+315 additions, -46 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+3 -3)
📝 runtime/CMakeLists.txt (+8 -0)
📝 runtime/src/vulkan_backend.h (+109 -43)
➕ runtime/test/vk_sparse_queue_order_test.cpp (+195 -0)

📄 Description

Claimed in the coordination issue as D3D-SPARSE-TILE-WAIT-ORDER.

What and why

D3D12 tile updates and copies submitted Vulkan sparse binds immediately, even when an earlier operation on the same queue was held waiting for a fence. A remap could therefore reach the GPU ahead of that operation, and a mapping copy could read stale source mappings.

Stage both mapping operations in the same queue FIFO as held batches and signals. Resolve the current mappings when the operation is released. Keep the heap backing alive across the hold and verify that the registered resources are still the ones named when the operation was queued. A held mapping that generates no sparse work still submits its pending waits in order.

Tested

  • Mock Vulkan regression on Ubuntu with GCC. On main it sees sparse submissions before the fence signal. With the fix it checks FIFO ordering, the wait timeline between submissions, mapping and unmapping before a copy, a no-op copy with a pending wait, and removal and reuse of a resource ID.
  • Windows x64, MSVC 19.29, static CRT. All four selected CTest tests passed (vk_sparse_queue_order, vk_queue_constructor_oom, vk_buffer_registration_oom, vk_host_at_aliasing). Also compiled the Windows D3D12 command queue and device translation units with MSVC.
  • Full translator semantic suite passed (470 files, 6,141 tests). git diff --check and the game-data check passed.

GPUs tested: n/a (synthetic Vulkan calls).

AI-assisted.

Checklist

  • Based on current main.
  • One topic.
  • No game data, keys or decryption.
  • No translator rule change.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/1182 **Author:** [@lixonik](https://github.com/lixonik) **Created:** 11/24/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `d3d-sparse-tile-wait-order` --- ### 📝 Commits (1) - [`47420b2`](https://github.com/ubiquitarianism/leonida/commit/47420b299f6e0cbbc0f22ceeeaae4887e8288d34) Keep sparse tile mappings in Vulkan queue order ### 📊 Changes **4 files changed** (+315 additions, -46 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+3 -3) 📝 `runtime/CMakeLists.txt` (+8 -0) 📝 `runtime/src/vulkan_backend.h` (+109 -43) ➕ `runtime/test/vk_sparse_queue_order_test.cpp` (+195 -0) </details> ### 📄 Description Claimed in the coordination issue as [D3D-SPARSE-TILE-WAIT-ORDER](https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7142357825). ### What and why D3D12 tile updates and copies submitted Vulkan sparse binds immediately, even when an earlier operation on the same queue was held waiting for a fence. A remap could therefore reach the GPU ahead of that operation, and a mapping copy could read stale source mappings. Stage both mapping operations in the same queue FIFO as held batches and signals. Resolve the current mappings when the operation is released. Keep the heap backing alive across the hold and verify that the registered resources are still the ones named when the operation was queued. A held mapping that generates no sparse work still submits its pending waits in order. ### Tested - Mock Vulkan regression on Ubuntu with GCC. On main it sees sparse submissions before the fence signal. With the fix it checks FIFO ordering, the wait timeline between submissions, mapping and unmapping before a copy, a no-op copy with a pending wait, and removal and reuse of a resource ID. - Windows x64, MSVC 19.29, static CRT. All four selected CTest tests passed (`vk_sparse_queue_order`, `vk_queue_constructor_oom`, `vk_buffer_registration_oom`, `vk_host_at_aliasing`). Also compiled the Windows D3D12 command queue and device translation units with MSVC. - Full translator semantic suite passed (470 files, 6,141 tests). `git diff --check` and the game-data check passed. GPUs tested: n/a (synthetic Vulkan calls). AI-assisted. ### Checklist - [x] Based on current `main`. - [x] One topic. - [x] No game data, keys or decryption. - [x] No translator rule change. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
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.

Dependencies

No dependencies set

Reference
starred/leonida#1216
No description provided.