Skip to content

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

Merged
aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
DadaCap:title-staged-no-host-copy
Nov 25, 2026
Merged

aslan2142 merged 1 commit into
ProjectLeonida:mainfrom
DadaCap:title-staged-no-host-copy

Conversation

@DadaCap

@DadaCap DadaCap commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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

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 0d80bc5: 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

…age copies (RT-TITLE-STAGED-NO-HOST-COPY)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ecox982745

Copy link
Copy Markdown

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.

@DadaCap

DadaCap commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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).

@madvillain91 madvillain91 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent NVIDIA Ampere data point on Windows 11 26H2 (26300.9711) at ea6d535 against main 384abe5 (PR base 98c2f77), 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.

@DadaCap

DadaCap commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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).

@Timon360SB

Copy link
Copy Markdown
Contributor

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.

@aslan2142
aslan2142 merged commit 24a29f8 into ProjectLeonida:main Nov 25, 2026
2 of 5 checks passed
@aslan2142

Copy link
Copy Markdown
Collaborator

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

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

@DadaCap

DadaCap commented Nov 25, 2026

Copy link
Copy Markdown
Contributor Author

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).

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.

5 participants