[PR #2283] d3d12: support standard sparse tiles for typed 2D color textures #2288

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2283
Author: @timbot103
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: d3d-sparse-2d-color-formats


📝 Commits (1)

  • c11de71 d3d12: support standard sparse tiles for typed 2D color textures

📊 Changes

12 files changed (+887 additions, -31 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+17 -10)
📝 runtime/CMakeLists.txt (+9 -0)
📝 runtime/shims/d3d12_com.cpp (+9 -7)
📝 runtime/shims/d3d12_com.h (+1 -0)
📝 runtime/shims/d3d12_vulkan_device.cpp (+34 -10)
📝 runtime/src/command_list.h (+1 -1)
📝 runtime/src/vulkan_backend.h (+7 -1)
📝 runtime/src/vulkan_replay.h (+7 -2)
➕ runtime/test/d3d12_sparse_formats_fixture.h (+29 -0)
➕ runtime/test/d3d12_sparse_formats_mapping.cpp (+183 -0)
➕ runtime/test/d3d12_sparse_formats_test.cpp (+429 -0)
➕ runtime/test/d3d12_sparse_formats_transfer.cpp (+161 -0)

📄 Description

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.

🔄 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/2283 **Author:** [@timbot103](https://github.com/timbot103) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `d3d-sparse-2d-color-formats` --- ### 📝 Commits (1) - [`c11de71`](https://github.com/ubiquitarianism/leonida/commit/c11de71cece9123bbe02fcb885a42657fdae4889) d3d12: support standard sparse tiles for typed 2D color textures ### 📊 Changes **12 files changed** (+887 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+17 -10) 📝 `runtime/CMakeLists.txt` (+9 -0) 📝 `runtime/shims/d3d12_com.cpp` (+9 -7) 📝 `runtime/shims/d3d12_com.h` (+1 -0) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+34 -10) 📝 `runtime/src/command_list.h` (+1 -1) 📝 `runtime/src/vulkan_backend.h` (+7 -1) 📝 `runtime/src/vulkan_replay.h` (+7 -2) ➕ `runtime/test/d3d12_sparse_formats_fixture.h` (+29 -0) ➕ `runtime/test/d3d12_sparse_formats_mapping.cpp` (+183 -0) ➕ `runtime/test/d3d12_sparse_formats_test.cpp` (+429 -0) ➕ `runtime/test/d3d12_sparse_formats_transfer.cpp` (+161 -0) </details> ### 📄 Description 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. --- <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#2288
No description provided.