d3d12: support standard sparse tiles for typed 2D color textures #2283

Closed
timbot103 wants to merge 1 commit from upstream-pr/2283 into main
timbot103 commented 2026-11-26 12:34:13 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-26T12:34:13Z.


Claimed in the coordination issue as: D3D-SPARSE-2D-COLOR-FORMATS

What and why

Eligible reserved 2D textures can now map heap pages on 49 additional typed, uncompressed color formats. Previously only R8G8B8A8_UNORM could use real sparse backing. The runtime checks each Vulkan image for the D3D12 64 KiB tile shape, compatible device-local memory and a single tail-free color aspect. The scope is one mip, one array layer and one sample.

The resource records its tile shape and texel size after verifying that their product describes exactly one 64 KiB tile. CopyTiles uses the full tile row pitch at clipped edges and stages linear offsets that Vulkan cannot copy directly. Tile mapping copies use each image’s grid. The original RGBA8 behavior for small images is preserved.

Tested

  • d3d12_sparse_formats_test obtained real sparse backing in all 100 cases on each GPU (50 formats at exact and clipped dimensions). Native D3D12 WARP matched all 100 tilings and the visible transfer bytes for nine representative formats covering all five texel sizes.
  • Tested both transfer directions on DIRECT, COMPUTE and COPY queues. In each configuration, all 114 Vulkan submissions matched the visible bytes from 54 aligned native WARP submissions across the same three queue types. Coverage includes aligned and staged offsets for every texel size, edge padding, unmapped reads, typed aliases, cross-shape mapping copies and fence-ordered remapping. The same fixture linked against pristine main detected committed backing in all 98 newly supported cases.
  • Ran d3d12_sparse_formats_test, d3d12_texture_tiles_test, d3d12_buffer_tiles_test, d3d12_vulkan_device_test, vk_command_replay_test, resource_tiling_test and replay_copy_offset_test in all four GPU and validation configurations. All 28 invocations passed with zero Vulkan validation diagnostics. Validation-on GPU runs enabled Khronos synchronization validation. The two CPU tests were repeated in each configuration.
  • A separate synthetic shader probe checked BGRX, BGRA, B5G5R5A1 and native RGB9E5 through sparse SRVs. All 256 sampled texels per GPU matched. The runtime linked successfully. The changed-file and tracked-tree game-data scans passed.

GPUs tested: NVIDIA GeForce RTX 5080, driver 616.64, and AMD Radeon(TM) Graphics, driver 25.10.30.02, on Windows 11 Pro. Native D3D12 reference: Microsoft Basic Render Driver selected with EnumWarpAdapter.

AI-assisted: yes (Gemini, Codex, Claude)

Checklist

  • Based on current main (a73a57e13).
  • One topic, reserved 2D color textures with standard 64 KiB tiles.
  • No game data, keys or decryption.
  • Translator contract table is inapplicable to this runtime change.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5510101935 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/2283). Originally posted by [timbot103](https://github.com/timbot103) on 2026-11-26T12:34:13Z. --- Claimed in the coordination issue as: [D3D-SPARSE-2D-COLOR-FORMATS](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7188047784) ### What and why Eligible reserved 2D textures can now map heap pages on 49 additional typed, uncompressed color formats. Previously only `R8G8B8A8_UNORM` could use real sparse backing. The runtime checks each Vulkan image for the D3D12 64 KiB tile shape, compatible device-local memory and a single tail-free color aspect. The scope is one mip, one array layer and one sample. The resource records its tile shape and texel size after verifying that their product describes exactly one 64 KiB tile. `CopyTiles` uses the full tile row pitch at clipped edges and stages linear offsets that Vulkan cannot copy directly. Tile mapping copies use each image’s grid. The original RGBA8 behavior for small images is preserved. ### Tested - `d3d12_sparse_formats_test` obtained real sparse backing in all 100 cases on each GPU (50 formats at exact and clipped dimensions). Native D3D12 WARP matched all 100 tilings and the visible transfer bytes for nine representative formats covering all five texel sizes. - Tested both transfer directions on DIRECT, COMPUTE and COPY queues. In each configuration, all 114 Vulkan submissions matched the visible bytes from 54 aligned native WARP submissions across the same three queue types. Coverage includes aligned and staged offsets for every texel size, edge padding, unmapped reads, typed aliases, cross-shape mapping copies and fence-ordered remapping. The same fixture linked against pristine main detected committed backing in all 98 newly supported cases. - Ran `d3d12_sparse_formats_test`, `d3d12_texture_tiles_test`, `d3d12_buffer_tiles_test`, `d3d12_vulkan_device_test`, `vk_command_replay_test`, `resource_tiling_test` and `replay_copy_offset_test` in all four GPU and validation configurations. All 28 invocations passed with zero Vulkan validation diagnostics. Validation-on GPU runs enabled Khronos synchronization validation. The two CPU tests were repeated in each configuration. - A separate synthetic shader probe checked BGRX, BGRA, B5G5R5A1 and native RGB9E5 through sparse SRVs. All 256 sampled texels per GPU matched. The runtime linked successfully. The changed-file and tracked-tree game-data scans passed. GPUs tested: NVIDIA GeForce RTX 5080, driver 616.64, and AMD Radeon(TM) Graphics, driver 25.10.30.02, on Windows 11 Pro. Native D3D12 reference: Microsoft Basic Render Driver selected with `EnumWarpAdapter`. AI-assisted: yes (Gemini, Codex, Claude) ### Checklist - [x] Based on current `main` (`a73a57e13`). - [x] One topic, reserved 2D color textures with standard 64 KiB tiles. - [x] No game data, keys or decryption. - [x] Translator contract table is inapplicable to this runtime change.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
ProjectLeonida/mandy!2283
No description provided.