[PR #1894] d3d12: stage title textures when their format or usage rules out host copies #1908

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/1894
Author: @ecox982745
Created: 11/25/2026
Status: 🔄 Open

Base: main ← Head: ecox/title-staged-per-format


📝 Commits (3)

  • 14f04ce d3d12: stage title textures when the image cannot take host copies
  • 06ba2eb d3d12: stage title images when host transfer has no memory type
  • 2d258c8 d3d12: log the title staging fallback once per Vulkan format

📊 Changes

3 files changed (+128 additions, -23 deletions)

View changed files

📝 docs/d3d12_vulkan.md (+9 -5)
📝 runtime/shims/d3d12_vulkan_device.cpp (+27 -18)
📝 runtime/test/d3d12_existing_heap_test.cpp (+92 -0)

📄 Description

Claimed as RT-TITLE-STAGED-PER-FORMAT in the coordination issue. This addresses the format-specific follow-up from the #1827 merge note.

Depends on: #1827 (merged).

What and why

A Vulkan device can expose host image copy and still refuse it for a particular format or combination of image usages. In that case the runtime successfully created the image without host-transfer usage, but a subsequent title-texture refresh skipped its upload. Both a linear movie-plane fixture and a tiled compressed image returned incorrect bytes.

The runtime selects mandatory staging when the format, image usage or compatible memory types rule out host transfer. A GTX 1050 Ti reported no bindable memory type for a host-transfer R8 movie plane. Pascal hardware report A CPU-visible, single-sampled colour title image can use ordinary image memory and queue the upload when host transfer is unavailable. Images that can use either path retain the existing placement heuristic and host-backing retry. An allocation failure on an image that requires staging propagates normally.

Tested

Windows 11, NVIDIA GeForce RTX 4090 (616.64), MSVC 19.44. The test keeps host image copy enabled on the real device. A test shim masks the R8 format feature and separately rejects host-transfer usage in the BC1 image-support query.

  • On main 446574e76 with only the new test, d3d12_existing_heap failed both readbacks: the persistently mapped R8 plane and the four-mip, two-slice BC1 array.
  • At 14f04ce2d, both readbacks pass. All three existing heap CTests passed (default, write watch disabled, write watch enabled), including the unmasked controls.
  • At 06ba2eb2d, a test shim reproduced the Pascal driver's empty memory type mask for a 256×8 R8 image. The previous head failed the pixel check. All three existing-heap CTests passed on the RTX 4090 with the fix, both with and without Vulkan validation. RTX 4090 test details
  • At the same revision, @qhukz13 reran all three existing-heap tests on a physical GTX 1050 Ti, Windows 10, NVIDIA 582.66. Each test passed three times with Vulkan validation enabled and three times with it disabled (18/18). The tester reported no validation messages. Instrumenting the earlier revision showed an empty memory type mask for R8, RGBA8 and BC1 title images. GTX 1050 Ti results
  • At 2d258c8cd, the fallback logs the Vulkan format once per process for each affected format. The same three tests passed on the RTX 4090 with validation enabled and disabled (6/6). The shim produced exactly one format 9 (R8) fallback message in each test process.
  • CPU semantic suite: 6,288 tests across 489 files, zero failing files. Documentation links: 16 passed. Line-ending tests: 3 passed. The no-game-data check and git diff --check passed.

All texture inputs are synthetic. These tests exercise format-specific uploads and pixel readback on the reported GPUs.

AI-assisted: OpenAI Codex (gpt-6.2-astra).

Checklist

  • Based on current main and checked for a clean merge.
  • One topic.
  • No game data, keys or decryption.
  • No shader translator rule changed.

🔄 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/1894 **Author:** [@ecox982745](https://github.com/ecox982745) **Created:** 11/25/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ecox/title-staged-per-format` --- ### 📝 Commits (3) - [`14f04ce`](https://github.com/ubiquitarianism/leonida/commit/14f04ce2d26e185b880ab09c93f882adc7d4729d) d3d12: stage title textures when the image cannot take host copies - [`06ba2eb`](https://github.com/ubiquitarianism/leonida/commit/06ba2eb2de6459faf78bf11ef40f22ffec7526bc) d3d12: stage title images when host transfer has no memory type - [`2d258c8`](https://github.com/ubiquitarianism/leonida/commit/2d258c8cd4f9dda5c14be980884a97c7c40c7b03) d3d12: log the title staging fallback once per Vulkan format ### 📊 Changes **3 files changed** (+128 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `docs/d3d12_vulkan.md` (+9 -5) 📝 `runtime/shims/d3d12_vulkan_device.cpp` (+27 -18) 📝 `runtime/test/d3d12_existing_heap_test.cpp` (+92 -0) </details> ### 📄 Description Claimed as `RT-TITLE-STAGED-PER-FORMAT` in [the coordination issue](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7165771692). This addresses the format-specific follow-up from the [#1827 merge note](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7165579561). Depends on: #1827 (merged). ### What and why A Vulkan device can expose host image copy and still refuse it for a particular format or combination of image usages. In that case the runtime successfully created the image without host-transfer usage, but a subsequent title-texture refresh skipped its upload. Both a linear movie-plane fixture and a tiled compressed image returned incorrect bytes. The runtime selects mandatory staging when the format, image usage or compatible memory types rule out host transfer. A GTX 1050 Ti reported no bindable memory type for a host-transfer R8 movie plane. [Pascal hardware report](https://github.com/ubiquitarianism/leonida/pull/1894#issuecomment-7172992761) A CPU-visible, single-sampled colour title image can use ordinary image memory and queue the upload when host transfer is unavailable. Images that can use either path retain the existing placement heuristic and host-backing retry. An allocation failure on an image that requires staging propagates normally. ### Tested Windows 11, NVIDIA GeForce RTX 4090 (616.64), MSVC 19.44. The test keeps host image copy enabled on the real device. A test shim masks the R8 format feature and separately rejects host-transfer usage in the BC1 image-support query. - On main `446574e76` with only the new test, `d3d12_existing_heap` failed both readbacks: the persistently mapped R8 plane and the four-mip, two-slice BC1 array. - At `14f04ce2d`, both readbacks pass. All three existing heap CTests passed (default, write watch disabled, write watch enabled), including the unmasked controls. - At `06ba2eb2d`, a test shim reproduced the Pascal driver's empty memory type mask for a 256×8 R8 image. The previous head failed the pixel check. All three existing-heap CTests passed on the RTX 4090 with the fix, both with and without Vulkan validation. [RTX 4090 test details](https://github.com/ubiquitarianism/leonida/pull/1894#issuecomment-7173571345) - At the same revision, @qhukz13 reran all three existing-heap tests on a physical GTX 1050 Ti, Windows 10, NVIDIA 582.66. Each test passed three times with Vulkan validation enabled and three times with it disabled (18/18). The tester reported no validation messages. Instrumenting the earlier revision showed an empty memory type mask for R8, RGBA8 and BC1 title images. [GTX 1050 Ti results](https://github.com/ubiquitarianism/leonida/pull/1894#issuecomment-7174515492) - At `2d258c8cd`, the fallback logs the Vulkan format once per process for each affected format. The same three tests passed on the RTX 4090 with validation enabled and disabled (6/6). The shim produced exactly one format 9 (R8) fallback message in each test process. - CPU semantic suite: 6,288 tests across 489 files, zero failing files. Documentation links: 16 passed. Line-ending tests: 3 passed. The no-game-data check and `git diff --check` passed. All texture inputs are synthetic. These tests exercise format-specific uploads and pixel readback on the reported GPUs. AI-assisted: OpenAI Codex (`gpt-6.2-astra`). ### Checklist - [x] Based on current main and checked for a clean merge. - [x] One topic. - [x] No game data, keys or decryption. - No shader translator rule changed. --- <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#1908
No description provided.