runtime: fall back to staging copies when a HOST_TRANSFER image has no memory type (TEST-995) #37

Closed
Andretuta wants to merge 3 commits from upstream-pr/37 into main
Andretuta commented 2026-11-24 02:04:58 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by Andretuta on 2026-11-24T02:04:58Z.


Carried over from old PR 4682 by ray3242 in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch old-pr/4682, exactly that PR's last commit. All carried-over PRs are listed in #17.
Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it.
ray3242: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one.


Original description (mentions and #N references are disabled; the numbers refer to the old repository):

��Item: TEST-995 �^C�� claim: https://github.com/ItsNotRexed/Leonida/issues/4571#issuecomment-7091273076 (found by me in #4420).

Depends on: #5000 (the known pre-existing tier-1 heap_mismatches assertion in d3d12_vulkan_device_test is fixed there; this PR's own fallback path is complete without it).

Head 310fa807 is based on 0db7fed5 and is not rebased onto the current main 561b65a8 (merge base 0db7fed5, 1815 commits behind); it remains mergeable. The body had a cp1252 round-trip mangling; rewritten as UTF-8. I will rebase when a maintainer asks rather than force-push a branch that reviewers have already validated at this head.

What and why

On NVIDIA Pascal (GTX 1060 / 582.78, GTX 1050 Ti / 560.94 and 582.78), a texture in a CPU-visible heap advertises VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT, vkCreateImage succeeds, but vkGetImageMemoryRequirements returns memoryTypeBits = 0 (no memory type at all). CreateCommittedResource then returned E_OUTOFMEMORY. The Vulkan SDK 1.4.363 validation layer reports nothing.

runtime/shims/d3d12_vulkan_device.cpp now recreates such an unbound image without VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT (re-checking format support first) and continues on the staging-copy path. A failed vkCreateImage leaves image_ null so the destructor cannot free an undefined handle. The retry loop also handles an allocation/bind failure with the same fallback, and log_once reports which branch fired.

With @gustavorafaelschmidt's go-ahead, the permanent test-only force_host_transfer_retry path from their #3077 commit is included here (commit authored by them, 4469dbca), so both d3d12_subresource_copy_test and d3d12_vulkan_device_test run their CPU copies through three paths: normal host copy, explicit staging, and forced no-memory-type. The tier-1 heap/WARP changes in #3077 are deliberately not ported �^C�� they belong to D3D-504 (#5000).

Tested

Windows 11, NVIDIA GeForce GTX 1060 6GB, driver 582.78, Vulkan 1.4.312 / headers 1.4.363, MSVC 19.44 + Ninja, RelWithDebInfo:

  • d3d12_subresource_copy_test: OK �^C�� three paths, 109 compared steps each, 0 mismatches.
  • d3d12_vulkan_device_test: three CPU-copy paths matched; the only failure is the known pre-existing tier-1 heap_mismatches assert (D3D-504), fixed by #5000. git diff --check clean.

Independent confirmations on this PR:

  • @shdann: fault injection of both branches (pass on head, fail on base);
  • @Codejustcode12 (GTX 1050 Ti / 560.94): natural empty mask on formats 37/133/98, all three paths 0 mismatches, no VUIDs, and main + #4682 + #5000 green on Pascal;
  • @thehollowedone (RTX 3080 Ti / 621.35) and @Krashgamer (RTX 3080 / 610.88): all three paths matched native D3D12, no VUIDs; Krashgamer's negative control (restoring main's E_OUTOFMEMORY) makes both executables fail.

AI-assisted (OpenCode). Synthetic fixtures only; no game data.

  • @auswhalen999-debug (GTX 1070 8 GB / driver 581.80, Windows 11, clang-cl 23.1.6, head 310fa807 merged with main 8f208d09a): clean main reproduces #4420 on this card; this PR gives 109/109 steps with 0 mismatches on all three copy paths and fixes the two CUSTOM heap E_OUTOFMEMORY cases; main + #4682 + #5000 makes d3d12_vulkan_device_test 100% green. Natural empty masks on formats 37/133.
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5464689507 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/37). Originally posted by [Andretuta](https://github.com/Andretuta) on 2026-11-24T02:04:58Z. --- > Carried over from **old PR 4682** by `ray3242` in the original Leonida repository, which went private on 23 Nov 2026. The code is the branch `old-pr/4682`, exactly that PR's last commit. All carried-over PRs are listed in #17. > Opened as a draft, and the CI runs the opening started were cancelled so 250 PRs don't fill the queue. Re-run CI here when you review it. > `ray3242`: this is your work. Feel free to take it over, by pushing to the branch or opening your own PR and closing this one. --- Original description (mentions and `#N` references are disabled; the numbers refer to the old repository): ��Item: **TEST-995** �^C�� claim: https://github.com/ItsNotRexed/Leonida/issues/4571#issuecomment-7091273076 (found by me in `#4420`). Depends on: `#5000` (the known pre-existing tier-1 `heap_mismatches` assertion in `d3d12_vulkan_device_test` is fixed there; this PR's own fallback path is complete without it). Head `310fa807` is based on `0db7fed5` and is not rebased onto the current `main` `561b65a8` (merge base `0db7fed5`, 1815 commits behind); it remains mergeable. The body had a cp1252 round-trip mangling; rewritten as UTF-8. I will rebase when a maintainer asks rather than force-push a branch that reviewers have already validated at this head. ### What and why On NVIDIA Pascal (GTX 1060 / 582.78, GTX 1050 Ti / 560.94 and 582.78), a texture in a CPU-visible heap advertises `VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT`, `vkCreateImage` succeeds, but `vkGetImageMemoryRequirements` returns `memoryTypeBits = 0` (no memory type at all). `CreateCommittedResource` then returned `E_OUTOFMEMORY`. The Vulkan SDK 1.4.363 validation layer reports nothing. `runtime/shims/d3d12_vulkan_device.cpp` now recreates such an unbound image without `VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT` (re-checking format support first) and continues on the staging-copy path. A failed `vkCreateImage` leaves `image_` null so the destructor cannot free an undefined handle. The retry loop also handles an allocation/bind failure with the same fallback, and `log_once` reports which branch fired. With `@gustavorafaelschmidt`'s go-ahead, the permanent test-only `force_host_transfer_retry` path from their `#3077` commit is included here (commit authored by them, `4469dbca`), so both `d3d12_subresource_copy_test` and `d3d12_vulkan_device_test` run their CPU copies through three paths: normal host copy, explicit staging, and forced no-memory-type. The tier-1 heap/WARP changes in `#3077` are deliberately not ported �^C�� they belong to D3D-504 (`#5000`). ### Tested Windows 11, **NVIDIA GeForce GTX 1060 6GB, driver 582.78**, Vulkan 1.4.312 / headers 1.4.363, MSVC 19.44 + Ninja, RelWithDebInfo: - `d3d12_subresource_copy_test: OK` �^C�� three paths, 109 compared steps each, 0 mismatches. - `d3d12_vulkan_device_test`: three CPU-copy paths matched; the only failure is the known pre-existing tier-1 `heap_mismatches` assert (D3D-504), fixed by `#5000`. `git diff --check` clean. Independent confirmations on this PR: - `@shdann`: fault injection of both branches (pass on head, fail on base); - `@Codejustcode12` (GTX 1050 Ti / 560.94): natural empty mask on formats 37/133/98, all three paths 0 mismatches, no VUIDs, and main + `#4682` + `#5000` green on Pascal; - `@thehollowedone` (RTX 3080 Ti / 621.35) and `@Krashgamer` (RTX 3080 / 610.88): all three paths matched native D3D12, no VUIDs; Krashgamer's negative control (restoring main's `E_OUTOFMEMORY`) makes both executables fail. AI-assisted (OpenCode). Synthetic fixtures only; no game data. - `@auswhalen999-debug` (GTX 1070 8 GB / driver 581.80, Windows 11, clang-cl 23.1.6, head `310fa807` merged with main `8f208d09a`): clean main reproduces `#4420` on this card; this PR gives 109/109 steps with 0 mismatches on all three copy paths and fixes the two CUSTOM heap E_OUTOFMEMORY cases; main + `#4682` + `#5000` makes `d3d12_vulkan_device_test` 100% green. Natural empty masks on formats 37/133.
qhukz13 commented 2026-11-24 22:36:48 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by qhukz13 on 2026-11-24T22:36:48Z.


These three commits are carried onto current main in #1364 (claim OLD-4682), cherry-picked unchanged with your authorship; the only conflict was the docs/testing.md row the third commit removes anyway. Re-measured there on a GTX 1050 Ti (NVIDIA 582.66, Windows 10): d3d12_subresource_copy and the CPU-heap texture cases of d3d12_heap_properties and d3d12_vulkan_device fail on main and pass with it. If you would rather carry it yourselves, say so and I will close mine. AI-assisted (Claude Code).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7146439220 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/37#issuecomment-7146439220). Originally posted by [qhukz13](https://github.com/qhukz13) on 2026-11-24T22:36:48Z. --- These three commits are carried onto current `main` in #1364 (claim OLD-4682), cherry-picked unchanged with your authorship; the only conflict was the `docs/testing.md` row the third commit removes anyway. Re-measured there on a GTX 1050 Ti (NVIDIA 582.66, Windows 10): `d3d12_subresource_copy` and the CPU-heap texture cases of `d3d12_heap_properties` and `d3d12_vulkan_device` fail on `main` and pass with it. If you would rather carry it yourselves, say so and I will close mine. AI-assisted (Claude Code).
aslan2142 commented 2026-11-24 23:15:15 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-11-24T23:15:15Z.


Closing this carried-over draft: the same three commits, with their original authors, were carried onto current main in #1364 (claim OLD-4682), and #1364 is merged now.

The NVIDIA runs recorded here were part of what #1364's merge rested on. Thanks to everyone who tested it.

AI-assisted (Claude Code, Claude Fable 5.2).

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7147189753 --> Imported from [ubiquitarianism/leonida](https://github.com/ubiquitarianism/leonida/pull/37#issuecomment-7147189753). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-11-24T23:15:15Z. --- Closing this carried-over draft: the same three commits, with their original authors, were carried onto current `main` in #1364 (claim `OLD-4682`), and #1364 is merged now. The NVIDIA runs recorded here were part of what #1364's merge rested on. Thanks to everyone who tested it. AI-assisted (Claude Code, Claude Fable 5.2).

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!37
No description provided.