Skip to content

Runtime: support sparse tile mappings for reserved buffers (D3D-20 follow-up) - #987

Merged
ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
gabrielsteglich:feat/reserved-buffer-tile-mapping
Nov 22, 2026
Merged

ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
gabrielsteglich:feat/reserved-buffer-tile-mapping

Conversation

@gabrielsteglich

@gabrielsteglich gabrielsteglich commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Claimed in coordination issue #634 as the D3D-20 follow-up for sparse tile mappings in reserved buffers.

Depends on: #286 (merged).

Rebased on 4eb6155d3ac4f9d3fadb0d095c4ce13e76783615. The PR contains one tile-mapping commit.

What and why

  • Implement UpdateTileMappings and CopyTileMappings for reserved buffers, including sequential, NULL, SKIP, and single-tile reuse ranges.
  • Implement CopyTiles in both explicit directions for 64 KiB buffer tiles. Vulkan timeline semaphores order sparse binds against ordinary queue submissions, and in-flight unbinds retain the previous heap backing.
  • Heap limitation. On the RTX 3090 with NVIDIA driver 621.01, Vulkan excludes the host-visible arena memory type from sparse buffers. The runtime allocates dedicated device-local memory for a heap’s sparse tiles on this configuration. Such a heap supports either sparse tile mappings or CreatePlacedResource buffers.

Tested

Tested b17531d021b4ec7c81707f7393f392edde969d1c on an NVIDIA GeForce RTX 3090 with driver 621.01, Windows 11 build 26300, MSVC 19.44.35229, Windows SDK 10.0.28000.0, and Vulkan SDK 1.4.363.0. The full RelWithDebInfo build succeeded. Vulkan validation and synchronization validation were enabled for the targeted GPU runs.

  • d3d12_buffer_tiles passed eight consecutive runs. All 12 full 64 KiB tiles across three GPU readbacks matched native D3D12 on the same GPU, including aliasing, zeroes for unmapped tiles, SKIP, single-tile reuse, and remapping behind a queue fence. The replay rejected an out-of-bounds update and preserved the prior mappings.
  • vk_command_replay_test, vk_predicate_capture_test, and d3d12_indirect_rt_test passed without Vulkan validation errors. Both occlusion regressions and the CPU replay self-test also passed.
  • CTest reported 104 passes, six skips, one disabled test, and one failure. d3d12_compute passes after the base integrated its test fix. d3d12_draw attempted fence signal 21 after 30, then reported a bundle pixel mismatch and a pipeline-destruction validation error. The draw failure reproduced in three runs on both the PR and unmodified main at 4eb6155d. Upstream draw fix
  • An independent run on an AMD RDNA2 iGPU and an RTX 5070 passed the tile replay on the original 64d7b0b revision.

Checklist

  • All test inputs are synthetic. No game data, keys, or decryption are included.
  • Runtime-only change. The translator contract table does not apply.

AI-assisted implementation and testing.

@UlteriorMotive00

Copy link
Copy Markdown
Contributor

Tested 64d7b0b on AMD RDNA2 iGPU and RTX 5070: pass.

Windows 11 Home 10.0.26300, MSVC 14.44.35207, Windows SDK 10.0.26100, Vulkan SDK 1.4.363.0, Ninja RelWithDebInfo (scripts\build_runtime.ps1), LEONIDA_VK_VALIDATION=1, VK_LOADER_LAYERS_DISABLE=~implicit~. One PC, two GPUs, picked with VK_LOADER_DRIVERS_SELECT: AMD Radeon iGPU of a Ryzen 7 9800X3D (RDNA2, 1002:13C0, AMD 2026.04.17) and NVIDIA GeForce RTX 5070 (Blackwell, 617.42).

  • d3d12_buffer_tiles (ctest): passes on both GPUs with validation on, including the AMD iGPU's sparse binding path.
  • ctest: RTX 5070 34/34; AMD iGPU 33/34. The AMD failure is d3d12_vulkan_device at the base's OPTIONS19.SupportedSampleCountsWithNoOutputs mismatch (line 1765; since fixed on main), not this PR.

AI-assisted (Claude Code). No game files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants