d3d12: title images use the staged upload on a device without host image copies (RT-TITLE-STAGED-NO-HOST-COPY) #1827

Manually merged
github merged 1 commit from gh-pr/1827/head into gh-pr/1827/base 2026-11-26 10:07:24 +00:00
Owner

@⁠DadaCap on GitHub · 2026-11-25 12:41 UTC · original
DadaCap:title-staged-no-host-copy → main · +24 −5 · 3 files · 1 commits · merged 2026-11-25 14:37 UTC

RT-TITLE-STAGED-NO-HOST-COPY, claimed and found in #1608.

What

A title image (a streamed or placed texture of the title's) is filled from the title's memory by one of two paths: a host image copy, or the staged upload (TitleImageUpload). create_texture chose the staged path only for an image that could have used host copies (host_transfer_). Without VK_EXT_host_image_copy an image got neither: fill_title_texture returned early because host_copy_now() is false, and the texture stayed zero for the whole run.

Now, on a device without host copies, colour title images take the staged upload, linear placements (the movie planes) included. Devices with host copies behave as before. There is no memory type to compare with in this case, so any type the image allows is accepted.

Why

  • Any GPU or driver without the extension shows no title textures. Seen here with the extension switched off: the intro movie is a flat green frame (zero YUV planes), and the refresh log reads 107844 changed, 0.0 MiB filled.
  • It makes host_image_copy off a usable diagnostic (#1810), as QemmHD's runs suggest host image copies are involved in the world-start WRITE_INVALID. With this change and host copies off, the movie shows and a retail boot reached the first world frame (136 draws, 11,525 indirect draws, 2,118 dispatches) with no type 2 fault; the device is then lost at another place (details in #1608, n=1).

This pull request does not turn host copies off for anyone.

Tests

  • d3d12_existing_heap_test: the mapped plane and mapped BC array cases also run on a device made without host copies. Negative check: without the change to d3d12_vulkan_device.cpp the test fails.
  • RTX 5080, NVIDIA 621.24, Windows 11, VS 18 RelWithDebInfo, on main 0d80bc5df: d3d12_existing_heap (and its two write-watch variants), d3d12_vulkan_device, d3d12_xmem_placed, d3d12_subresource_copy, d3d12_m2_textured pass.
  • Not run: the whole ctest set, other GPUs, Linux.

AI-assisted (Claude Code).

🤖 Generated with Claude Code

**@⁠DadaCap** on GitHub · 2026-11-25 12:41 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827) `DadaCap:title-staged-no-host-copy` → `main` · +24 −5 · 3 files · 1 commits · merged 2026-11-25 14:37 UTC RT-TITLE-STAGED-NO-HOST-COPY, claimed and found in [#1608](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608). ## What A title image (a streamed or placed texture of the title's) is filled from the title's memory by one of two paths: a host image copy, or the staged upload (`TitleImageUpload`). `create_texture` chose the staged path only for an image that could have used host copies (`host_transfer_`). Without `VK_EXT_host_image_copy` an image got neither: `fill_title_texture` returned early because `host_copy_now()` is false, and the texture stayed zero for the whole run. Now, on a device without host copies, colour title images take the staged upload, linear placements (the movie planes) included. Devices with host copies behave as before. There is no memory type to compare with in this case, so any type the image allows is accepted. ## Why - Any GPU or driver without the extension shows no title textures. Seen here with the extension switched off: the intro movie is a flat green frame (zero YUV planes), and the refresh log reads `107844 changed, 0.0 MiB filled`. - It makes `host_image_copy` off a usable diagnostic (#1810), as QemmHD's runs suggest host image copies are involved in the world-start WRITE_INVALID. With this change and host copies off, the movie shows and a retail boot reached the first world frame (136 draws, 11,525 indirect draws, 2,118 dispatches) with no type 2 fault; the device is then lost at another place (details in #1608, n=1). This pull request does not turn host copies off for anyone. ## Tests - `d3d12_existing_heap_test`: the mapped plane and mapped BC array cases also run on a device made without host copies. Negative check: without the change to `d3d12_vulkan_device.cpp` the test fails. - RTX 5080, NVIDIA 621.24, Windows 11, VS 18 RelWithDebInfo, on `main` 0d80bc5df: `d3d12_existing_heap` (and its two write-watch variants), `d3d12_vulkan_device`, `d3d12_xmem_placed`, `d3d12_subresource_copy`, `d3d12_m2_textured` pass. - Not run: the whole `ctest` set, other GPUs, Linux. AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:21 +00:00
github manually merged commit ea6d535ff5 into gh-pr/1827/base 2026-11-26 10:07:24 +00:00
Author
Owner

@⁠ecox982745 on GitHub · 2026-11-25 12:47 UTC · original

Confirmed the staged upload on an RTX 4090 (Windows 11, NVIDIA 616.64) using GPU texture-to-buffer copies. I built the parent 0d80bc5df and PR ea6d535ff with MSVC. The card exposes host image copy, so I could set VulkanDeviceInfo.host_image_copy = false and run the enabled control on the same hardware.

Test configuration Initial upload After rewriting one mip After a submission with no writes
Parent, host copies disabled 0/21 — —
PR, host copies disabled 21/21 21/21 21/21
Parent and PR, host copies enabled (each) 21/21 21/21 21/21

Each count is the number of subresources whose GPU readback matched the expected bytes. On the PR, setting LEONIDA_TITLE_IMAGE_STAGING=0 with host copies disabled reproduced the 0/21 initial result. Restoring default staging passed all three submissions again in a fresh process.

The synthetic fixture extends check_mapped_bc_array to a 140×76 BC7 texture with three array slices and seven mips. It fills each subresource with a distinct byte pattern, then rewrites only mip 3 of slice 2 and notifies the runtime of the mapped write. Each submission uses CopyTextureRegion to copy all 21 subresources into a readback buffer, waits on a fence, and checks all 43,632 payload bytes, excluding row padding. This also checks that the other 20 subresources survive the sparse update.

The three existing heap CTests (default, write watch off, write watch on) passed on the PR. This run covers texture upload and readback. It did not exercise a retail boot or the world-start device loss. AI-assisted verification with OpenAI Codex.

**@⁠ecox982745** on GitHub · 2026-11-25 12:47 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7162864370) Confirmed the staged upload on an RTX 4090 (Windows 11, NVIDIA 616.64) using GPU texture-to-buffer copies. I built the parent `0d80bc5df` and PR `ea6d535ff` with MSVC. The card exposes host image copy, so I could set `VulkanDeviceInfo.host_image_copy = false` and run the enabled control on the same hardware. | Test configuration | Initial upload | After rewriting one mip | After a submission with no writes | | --- | ---: | ---: | ---: | | Parent, host copies disabled | 0/21 | — | — | | PR, host copies disabled | 21/21 | 21/21 | 21/21 | | Parent and PR, host copies enabled (each) | 21/21 | 21/21 | 21/21 | Each count is the number of subresources whose GPU readback matched the expected bytes. On the PR, setting `LEONIDA_TITLE_IMAGE_STAGING=0` with host copies disabled reproduced the 0/21 initial result. Restoring default staging passed all three submissions again in a fresh process. The synthetic fixture extends `check_mapped_bc_array` to a 140×76 BC7 texture with three array slices and seven mips. It fills each subresource with a distinct byte pattern, then rewrites only mip 3 of slice 2 and notifies the runtime of the mapped write. Each submission uses `CopyTextureRegion` to copy all 21 subresources into a readback buffer, waits on a fence, and checks all 43,632 payload bytes, excluding row padding. This also checks that the other 20 subresources survive the sparse update. The three existing heap CTests (default, write watch off, write watch on) passed on the PR. This run covers texture upload and readback. It did not exercise a retail boot or the world-start device loss. AI-assisted verification with OpenAI Codex.
Author
Owner

@⁠DadaCap on GitHub · 2026-11-25 12:59 UTC · original

Thank you for the GPU readback check: that covers the array, mip and sparse-rewrite cases that my two test cases do not. AI-assisted (Claude Code).

**@⁠DadaCap** on GitHub · 2026-11-25 12:59 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7163128177) Thank you for the GPU readback check: that covers the array, mip and sparse-rewrite cases that my two test cases do not. AI-assisted (Claude Code).
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-25 13:51 UTC · original · reviewed

Independent NVIDIA Ampere data point on Windows 11 26H2 (26300.9711) at ea6d535ff against main 384abe5b0 (PR base 98c2f7777), using VS 2022 Build Tools (MSVC 19.44.35230.0, RelWithDebInfo, Ninja), Vulkan SDK 1.4.363.0, and NVIDIA GeForce RTX 3070 Ti (driver 617.14, Vulkan 1.4.351; hostImageCopy = true, identicalMemoryTypeRequirements = false).

All targeted GPU tests passed with LEONIDA_VK_VALIDATION=1 and 0 VUIDs:

  • d3d12_existing_heap_test (including the new host_image_copy = false staged check_mapped_plane and check_mapped_bc_array paths): passed, 0 VUIDs
  • d3d12_existing_heap_test (LEONIDA_EXISTING_HEAP_WRITE_WATCH=0 and =1): 2/2 passed
  • d3d12_subresource_copy_test: passed, 0 VUIDs
  • d3d12_m2_textured_test: passed, 0 VUIDs

Not checked: retail boot or full ctest suite. LGTM.

AI-assisted verification.

**@⁠madvillain91** on GitHub · 2026-11-25 13:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#pullrequestreview-6058831528) · **reviewed** Independent NVIDIA Ampere data point on Windows 11 26H2 (26300.9711) at ea6d535ff against main 384abe5b0 (PR base 98c2f7777), using VS 2022 Build Tools (MSVC 19.44.35230.0, RelWithDebInfo, Ninja), Vulkan SDK 1.4.363.0, and NVIDIA GeForce RTX 3070 Ti (driver 617.14, Vulkan 1.4.351; `hostImageCopy = true`, `identicalMemoryTypeRequirements = false`). All targeted GPU tests passed with `LEONIDA_VK_VALIDATION=1` and 0 VUIDs: - `d3d12_existing_heap_test` (including the new `host_image_copy = false` staged `check_mapped_plane` and `check_mapped_bc_array` paths): passed, 0 VUIDs - `d3d12_existing_heap_test` (`LEONIDA_EXISTING_HEAP_WRITE_WATCH=0` and `=1`): 2/2 passed - `d3d12_subresource_copy_test`: passed, 0 VUIDs - `d3d12_m2_textured_test`: passed, 0 VUIDs Not checked: retail boot or full `ctest` suite. LGTM. AI-assisted verification.
Author
Owner

@⁠DadaCap on GitHub · 2026-11-25 13:55 UTC · original

Thank you @⁠madvillain91, the validation layer run is what I had not done: 0 VUIDs on Ampere for the staged paths is good to have. One note on the write-watch variants: the variable the tests read is LEONIDA_WRITE_WATCH (runtime/CMakeLists.txt); I find no LEONIDA_EXISTING_HEAP_WRITE_WATCH in the tree, so if that was the name used, both variants ran the default. ctest -R existing_heap sets it. AI-assisted (Claude Code).

**@⁠DadaCap** on GitHub · 2026-11-25 13:55 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7164482757) Thank you @⁠madvillain91, the validation layer run is what I had not done: 0 VUIDs on Ampere for the staged paths is good to have. One note on the write-watch variants: the variable the tests read is `LEONIDA_WRITE_WATCH` (`runtime/CMakeLists.txt`); I find no `LEONIDA_EXISTING_HEAP_WRITE_WATCH` in the tree, so if that was the name used, both variants ran the default. `ctest -R existing_heap` sets it. AI-assisted (Claude Code).
Author
Owner

@⁠Timon360SB on GitHub · 2026-11-25 14:30 UTC · original

Independent verification — Turing and Blackwell

  • Base: 0d80bc5df7c873f40965f34f185cb96913786765
  • Head: ea6d535ff5831c81bec75505bfc190142296579d

Environment

GPU Architecture Windows 11 build
RTX 5070 Blackwell 26200
RTX 2060 SUPER Turing 28000

NVIDIA 621.14, Vulkan SDK 1.4.363.0, MSVC 19.44.35230, Ninja RelWithDebInfo.

Three repetitions per GPU, revision and validation mode. Validated runs requested core, GPU-assisted and synchronization validation.

Results

Test Base Head
d3d12_existing_heap 12/12 12/12
d3d12_existing_heap_no_write_watch 12/12 12/12
d3d12_existing_heap_write_watch 12/12 12/12
d3d12_vulkan_device 12/12 12/12
d3d12_xmem_placed 12/12 12/12
d3d12_subresource_copy 12/12 12/12
d3d12_m2_textured 12/12 12/12
Total 84/84 84/84

168 executions: 168 passed, 0 failed, 0 skipped.

Findings

  • All three existing-heap variants passed, including the HEAD fixtures for mapped planes and BC1 arrays with host image copies disabled at the layer-device level.
  • No regressions in subresource copies or textured rendering.
  • No Vulkan validation errors found in the captured logs.

The results support the staged-upload fix and show no regressions in the selected tests on either GPU. No separate negative-control experiment or full-suite regression was performed.

Synthetic tests only. No game files used.
AI-assisted: yes.

**@⁠Timon360SB** on GitHub · 2026-11-25 14:30 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7165372991) ## Independent verification — Turing and Blackwell - **Base:** `0d80bc5df7c873f40965f34f185cb96913786765` - **Head:** `ea6d535ff5831c81bec75505bfc190142296579d` ### Environment | GPU | Architecture | Windows 11 build | |---|---|---| | RTX 5070 | Blackwell | 26200 | | RTX 2060 SUPER | Turing | 28000 | NVIDIA 621.14, Vulkan SDK 1.4.363.0, MSVC 19.44.35230, Ninja RelWithDebInfo. Three repetitions per GPU, revision and validation mode. Validated runs requested core, GPU-assisted and synchronization validation. ### Results | Test | Base | Head | |---|---:|---:| | `d3d12_existing_heap` | 12/12 | 12/12 | | `d3d12_existing_heap_no_write_watch` | 12/12 | 12/12 | | `d3d12_existing_heap_write_watch` | 12/12 | 12/12 | | `d3d12_vulkan_device` | 12/12 | 12/12 | | `d3d12_xmem_placed` | 12/12 | 12/12 | | `d3d12_subresource_copy` | 12/12 | 12/12 | | `d3d12_m2_textured` | 12/12 | 12/12 | | **Total** | **84/84** | **84/84** | 168 executions: 168 passed, 0 failed, 0 skipped. ### Findings - All three existing-heap variants passed, including the HEAD fixtures for mapped planes and BC1 arrays with host image copies disabled at the layer-device level. - No regressions in subresource copies or textured rendering. - No Vulkan validation errors found in the captured logs. The results support the staged-upload fix and show no regressions in the selected tests on either GPU. No separate negative-control experiment or full-suite regression was performed. Synthetic tests only. No game files used. AI-assisted: yes.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-25 14:38 UTC · original

Merged. Thank you, @⁠DadaCap, and thanks to the RTX 3070 Ti and RTX 4090 testers for the read-backs.

  • The new no-host-copy case fails without the device change and passes with it.
  • The host-copy path is unchanged; the staged path reuses TitleImageUpload with the same conversion and the same barriers, and staging memory stays bounded.
  • Windows suite under Wine (llvmpipe and an RDNA2 iGPU), together with #1732 and #1785 on current main: nothing goes from pass to fail; the title-image and texture tests pass on both.
  • Follow-up idea: a device with host copies that refuses them for one format still fills that format's title images with neither path.
  • Checked on main 71a769d7d + ea6d535ff: it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass; check_no_game_data.py is clean on the 3 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-25 14:38 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7165579561) Merged. Thank you, @⁠DadaCap, and thanks to the RTX 3070 Ti and RTX 4090 testers for the read-backs. - The new no-host-copy case fails without the device change and passes with it. - The host-copy path is unchanged; the staged path reuses `TitleImageUpload` with the same conversion and the same barriers, and staging memory stays bounded. - Windows suite under Wine (llvmpipe and an RDNA2 iGPU), together with #1732 and #1785 on current `main`: nothing goes from pass to fail; the title-image and texture tests pass on both. - Follow-up idea: a device with host copies that refuses them for one format still fills that format's title images with neither path. - **Checked on `main` `71a769d7d` + `ea6d535ff`:** it merges cleanly; the semantic suite passes (489 files, 6,288 tests, 0 files failed); the 14 docs and writer tests pass; `check_no_game_data.py` is clean on the 3 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
Author
Owner

@⁠DadaCap on GitHub · 2026-11-25 14:51 UTC · original

Thank you @⁠aslan2142, and everyone who tested. The follow-up you name is right: a device with host copies that refuses them for one format still fills that format's title images with neither path. I won't claim it now; whoever wants it can take it. AI-assisted (Claude Code).

**@⁠DadaCap** on GitHub · 2026-11-25 14:51 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1827#issuecomment-7165916012) Thank you @⁠aslan2142, and everyone who tested. The follow-up you name is right: a device with host copies that refuses them for one format still fills that format's title images with neither path. I won't claim it now; whoever wants it can take it. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No description provided.