Commit Graph

3 Commits

Author SHA1 Message Date
bd53fcee30 Runtime: port #3077's forced host-transfer retry into the staging fallback
Ported from @gustavorafaelschmidt's #3077 commit 2612b150 (author credited
below). With their go-ahead on #4682, keep one fix for both the empty-mask
driver case and the allocation-failure case this PR already handled:

- VulkanDeviceInfo::force_host_transfer_retry (tests only) forces the
  no-memory-type branch on any GPU, so d3d12_vulkan_device_test and
  d3d12_subresource_copy_test run their CPU copies through a third path.
- create_image() is a lambda that leaves image_ null after a failed create
  (the handle is undefined on failure and ~Resource destroys any non-null
  one), and log_once reports when the fallback fires.
- After dropping host-transfer usage, check_image_support is re-run before
  the image is made again; this PR's allocation/bind-failure retry is kept
  alongside it.
- docs/d3d12_vulkan.md and docs/testing.md record the Pascal measurement and
  the tier-1 host note.

The tier-1 heap/WARP comparison changes in #3077 are not part of this port:
they belong to D3D-504 (#5000). Tests on GTX 1060 / 582.78: both executables
built with MSVC 19.44; d3d12_subresource_copy_test OK with all three paths
(109 compared steps, 0 mismatches each); d3d12_vulkan_device_test's three
CPU-copy paths matched, with only the known pre-existing tier-1
heap_mismatches assert (D3D-504) still failing. No game data.

AI-assisted (OpenCode).

Original commit by Gustavo Rafael Schmidt <204491080+gustavorafaelschmidt@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:48:51 +02:00
b136ee4680 Tests: check Microsoft's recorded answers where Wine and Proton have no reference
Under Wine the host D3D12 is vkd3d and under Proton vkd3d-proton, and
Proton's EnumWarpAdapter returns the hardware adapter, so the host and
WARP references six tests compare with are not Microsoft's runtime:
d3d12_r9g9b9e5_uav, d3d12_method_variants and d3d12_sampler2 fail under
Proton (the last two crash inside vkd3d-proton), d3d12_fence_timing and
d3d12_subresource_copy under both, d3d12_private_data under Wine.

The six skip the host comparison there with hostwine::host_is_wine() and
check the layer against Microsoft's answers recorded in the test instead,
so Wine and Proton still check values. d3d12_r9g9b9e5_uav gets WARP's
words for its six clear cases, from the packing rule in
docs/d3d12_vulkan.md. d3d12_subresource_copy and d3d12_private_data get
answer tables, taken from the records that Windows runs on NVIDIA and AMD
compared with Microsoft's runtime with no mismatches; LEONIDA_D3D49_DUMP=1
prints the host's record on Windows to regenerate them. The other three
already had recorded answers. Windows still compares with the live
runtime too.
2026-11-22 20:40:59 -07:00
c226964ea0 d3d12: WriteToSubresource/ReadFromSubresource answer as the host runtime does
d3d12_subresource_copy_test runs the same 117 steps on the Vulkan-backed device
and on the host runtime: textures in write-back and write-combine custom heaps,
a volume, an array, BC1 blocks, a buffer, an upload-heap buffer, a default-heap
texture and a multisampled one; whole and boxed copies, boxes outside, empty,
inverted or cutting a block, subresources past the last, pitches too small or
0, and copies before Map. It records every HRESULT and a hash of the whole
destination of every read, once per copy path (host image copy and staging).
On main 17 steps differed (RTX 3060, driver 610.88); now none do. The host's
rules:

- a box is refused only when its right, bottom or back edge lies past the
  mip's, or it cuts a compressed block; an empty or inverted box that passes
  those checks is S_OK and copies nothing (the layer refused it);
- the row and depth pitches are not checked: rows or slices that overlap are
  copied in order (the layer refused a pitch smaller than a row or slice).

Not compared, and reported as such: null data (the host faults; the layer
still answers E_INVALIDARG), which bytes win when a read's rows overlap (the
driver's copy order, tiled on NVIDIA), and a default-heap texture, which the
host refuses and the layer copies on purpose, as docs/d3d12_vulkan.md says.

d3d12_vulkan_device_test's cpu_copies expected the old refusals for an empty
box and overlapping slices, and now expects S_OK.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:04:31 +01:00