Commit Graph

125 Commits

Author SHA1 Message Date
bc59ef4646 d3d12_xs proxy: slots 14/62/76 and heap GetDevice clear the output before failing
d3d12.h declares these outputs _COM_Outptr_ (NULL on failure), and the
inner Vulkan device clears it, but the Xbox-ABI proxy returned an error
with the caller's pointer untouched: slot 14 created into a local, and
slots 62/76 and heap slot 7 checked riid/desc before touching out.
2026-11-22 13:15:37 +05:30
86ef2454a8 Merge pull request #1069 from undeadhuman37 2026-11-22 01:38:14 -05:00
55bf9d0328 D3D-122: GetCopyableFootprints refuses the descriptions the host refuses
The buffer branch only checked first/count and the texture branch never
looked at Width, Height, DepthOrArraySize or SampleDesc, turning a zero
extent into 1. The PC runtime gives the failure answer (every output all
ones) for these; measured on WARP, and @quackottu's subset on an NVIDIA GPU.

Buffers: Width 0, or any of Height, DepthOrArraySize, MipLevels, Format,
Layout, SampleDesc or Alignment other than its one valid value. Textures:
a zero extent, Count 0, or more than one sample outside a single-mip,
non-ROW_MAJOR 2D render target or depth stencil, or a count that is not a
power of two. Left unchecked because the host accepts them or adapters
differ: Flags on buffers, extra mips, 2D ROW_MAJOR, Quality at one sample,
extent limits, texture alignment, multisample quality and format support.

d3d12_vulkan_device_test: footprint_validity_cases() is compared with the
host runtime when there is one and checked on its own otherwise.

AI-assisted
2026-11-22 09:21:11 +03:00
294deab8c3 Merge pull request #991 from sanuk369 2026-11-22 01:08:12 -05:00
7a6b97c946 Revert "Merge pull request #895 from cobalt-pebble-804"
#895's CBV/SRV/UAV views write placeholder tags (1, 2, 3) into the descriptor heap, and its new check in
d3d12_vulkan_device_test expects an SRV's first dword to be 2. main's SRVs are GFX10 T# words (D3D-72 and the
descriptor table), so the device test failed at line 2211. The PR needs a rebase onto main's descriptor model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:39:08 -05:00
1056982e74 Merge pull request #962 from UlteriorMotive00 2026-11-22 00:33:18 -05:00
13ad2f2fe4 Merge pull request #952 from Felix Croasdale 2026-11-22 00:33:14 -05:00
6ac93b21f0 Merge pull request #895 from cobalt-pebble-804 2026-11-22 00:33:02 -05:00
61bcc969c4 D3D-86: answer CheckFeatureSupport OPTIONS2-5, 7, 9, 11, 13-16, 18-21 2026-11-22 06:29:05 +01:00
7b11673e33 CheckFeatureSupport(FEATURE_LEVELS): an empty or missing list is E_INVALIDARG
NumFeatureLevels 0 returned DXGI_ERROR_UNSUPPORTED, and a null
pFeatureLevelsRequested with a count was read. The host D3D12 runtime
(NVIDIA and WARP) returns E_INVALIDARG for both. When no requested level
is supported the host also writes MaxSupportedFeatureLevel 0 next to
DXGI_ERROR_UNSUPPORTED; the layer left the field as it was.
2026-11-22 10:58:38 +05:30
b61f68ed2b d3d12_vulkan_device_test: compare OPTIONS1 with the same GPU's host device, not the default adapter
compare_options1 created the host D3D12 device on the default adapter. On a PC with an AMD
iGPU and an NVIDIA card, a run on the AMD (VK_LOADER_DRIVERS_SELECT=*amd*) compared its 32..64
lanes with the NVIDIA's 32..32 and failed (WaveLaneCountMax: ours 64, host 32). It now uses
create_host_device_for_physical, like compare_feature_options: LUID, then PCI ids, then the
default adapter as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:09:59 -05:00
e875297227 d3d12_vulkan_device_test: the predication block's query heap desc no longer hides heap_desc (C4456)
The occlusion-query block from #858 declared a D3D12_QUERY_HEAP_DESC
named heap_desc inside the function that already has a
D3D12_DESCRIPTOR_HEAP_DESC heap_desc (line 2107), and MSVC /W4 warned
C4456. Rename it to query_heap_desc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:08:17 -06:00
072620be0c d3d12_vulkan_device_test: the last two waits on fence use submit_and_wait
#850 moved the waits to a counter, but the 1D-texture block still signalled 8 and #858's predication block
12/13. Once the counter had passed those values, SetEventOnCompletion returned at once and the blocks read results
the GPU had not written yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:51:42 -05:00
70f184a636 feat(runtime): add D3D12 CBV/SRV/UAV buffer views and VkPipelineLayout root signatures 2026-11-22 01:27:04 -03:00
7123be6c5e Merge pull request #869 from Ayoze Torres 2026-11-21 23:15:37 -05:00
9b21cde473 Merge pull request #858 from traeb0n 2026-11-21 23:15:34 -05:00
67bb661453 Merge pull request #850 from sanuk369 2026-11-21 23:15:33 -05:00
a03a3db26b Merge pull request #737 from AlxcBTW 2026-11-21 23:15:27 -05:00
8d8c528aa1 Merge pull request #561 from Ayinaki 2026-11-21 23:15:23 -05:00
c7d5f8e8a4 d3d12: create 1D textures and 1D arrays
CheckFeatureSupport already reported TEXTURE1D, but CreateCommittedResource
rejected the dimension. Create 1D images with a height-one extent, reject
non-unit heights and attachment flags, and teach GetCopyableFootprints and
GetResourceAllocationInfo the 1D shape. The device test now uploads and reads
back a 1D texture and a layer of a 1D array, and compares allocation and
footprint results with the PC runtime.
2026-11-22 03:55:49 +00:00
d868cba00f Runtime: barriers into PREDICATION cover conditional rendering's read
D3D12_RESOURCE_STATE_PREDICATION is the same bit as INDIRECT_ARGUMENT
(and SYNC/ACCESS_PREDICATION the same as EXECUTE_INDIRECT /
INDIRECT_ARGUMENT), and the layer mapped that bit only to
INDIRECT_COMMAND_READ at DRAW_INDIRECT. vkCmdBeginConditionalRenderingEXT
reads the predicate with CONDITIONAL_RENDERING_READ at the
CONDITIONAL_RENDERING stage, so ResolveQueryData -> COPY_DEST to
PREDICATION barrier -> SetPredication had no dependency from the copy's
write to the predicate read (and none the other way before the next
resolve).

With the extension enabled (the only case those flags are valid),
vulkan_access and vulkan_barrier_scope now add the conditional-rendering
access and stage for that bit; GENERIC_READ, which contains it, gets
them too. The replay passes the flag from its conditional-rendering
entry points.

d3d12_vulkan_device_test now enables conditional rendering on its device
and runs an occlusion query resolved into a predicate: EQUAL_ZERO skips a
clear, NOT_EQUAL_ZERO runs one, and the predicate is resolved into again
after the read, once through legacy barriers and once through enhanced
buffer barriers. d3d12_state_map_test checks both mappings with and
without the extension.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:55:19 -06:00
6ba626606b tests: loader's scan probe and the D3D12 host comparisons under Wine
loader_test: the probe for security software that holds newly written
images also stops when writing and reading one back averages over
25 ms. Under Wine there is no such software and its file I/O alone took
38-40 ms in the wine job, so there only the refusals and contents are
checked.

The host comparisons move from d3d12_vulkan_device_test's
create_host_device to copycmp::create_host, so the copy comparisons are
skipped under Wine too (with them, winevulkan asserted in
vkBindBufferMemory).
2026-11-22 03:55:16 +00:00
fbb991e90d Tests: one fence helper in d3d12_vulkan_device_test instead of hand-picked values
A reused or lower fence value makes SetEventOnCompletion return at once, so a
block read results the GPU had not written yet (#278 hit this twice after
rebases). Every wait on the main fence now goes through submit_and_wait, which
signals the next value and waits for it, including the query blocks that landed
with 10 and 11. Fences that belong to one block (ms_fence, the standalone
device's) keep their own values.
2026-11-22 09:20:25 +05:30
4c0faa7693 Merge pull request #739 from Ayinaki
# Conflicts:
#	docs/d3d12_vulkan.md
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-21 22:49:20 -05:00
749c1ae46c Merge pull request #745 from Ayinaki
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-21 22:48:53 -05:00
55d02a5861 Merge origin/main into d24-on-d32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:48:46 +01:00
1f50ec3ba5 tests: d3d12_vulkan_device has no host to compare with under Wine
Its host comparisons take Microsoft's d3d12.dll as the reference. Wine's
(vkd3d) lays out depth-stencil formats in one plane, rejects R9G9B9E5
and BC footprints and accepts descriptions Microsoft's runtime refuses,
so under Wine (ntdll exports wine_get_version) create_host_device
answers as when there is no host device: each comparison is printed as
skipped. Windows compares as before.
2026-11-22 03:46:44 +00:00
0db0d72dc7 Merge origin/main into d24-on-d32; follow main's depth-plane T# rule (D3D-75)
Main's depth-plane SRV T# code follows the texture's backing format (X24_8_32_FLOAT
where D24 is stored as D32), so the override from f9addf5 is dropped and the
D24 comparison test expects the backing format's code. The family refusal and
bind_image are main's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:45:53 +01:00
783a491deb Answer wave ops and lane counts in D3D12_OPTIONS1
The query fell through to E_INVALIDARG. It now reports the Vulkan physical
device's subgroup operations and wave-size range, with TotalLaneCount held to
one full wave because Vulkan has no device-wide lane count.
2026-11-22 03:39:25 +00:00
ab1ff9f9c5 Support R10G10B10_XR_BIAS_A2_UNORM textures
Map XR_BIAS to the bit-compatible A2B10G10R10 UNORM Vulkan format, report only the 2D and cast-within-bit-layout support the layer provides, and refuse the mip, MSAA and 3D cases the PC runtime refuses. Test creation, allocation, footprints and the resource-method variants.
2026-11-22 03:39:24 +00:00
37e7f789e9 Merge pull request #816 from Proudnoob4 2026-11-21 22:37:48 -05:00
2474686591 Merge pull request #815 from Felix Croasdale 2026-11-21 22:37:48 -05:00
0b79afb666 Merge pull request #706 from cemalyakla
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:37:40 -05:00
afda786c2c Merge pull request #674 from VictorJulianiR
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:37:39 -05:00
7079108182 Runtime: query heaps on Vulkan (D3D-15)
CreateQueryHeap makes one VkQueryPool per heap: occlusion (OCCLUSION and
BINARY_OCCLUSION queries), timestamp and copy-queue timestamp, and pipeline
statistics (all eleven Vulkan counters, whose order is the field order of
D3D12_QUERY_DATA_PIPELINE_STATISTICS). Other heap types are logged and
refused with E_NOTIMPL.

BeginQuery, EndQuery and ResolveQueryData are recorded in the command-list
IR with D3D12's rules for the calls, and replayed as vkCmdResetQueryPool +
vkCmdBeginQuery/vkCmdEndQuery, vkCmdWriteTimestamp at BOTTOM_OF_PIPE and
vkCmdCopyQueryPoolResults (64-bit, WAIT). Heap types, index ranges and the
destination buffer are checked before anything is written. A query that was
never ended resolves to zeros instead of stalling the GPU on WAIT_BIT.
GetTimestampFrequency is 1e9 / timestampPeriod. The devices enable
occlusionQueryPrecise and pipelineStatisticsQuery where the GPU has them.

Overlapping queries of one kind (valid D3D12, one active query per type in
Vulkan) are refused as unsupported, and binary occlusion is not clamped to
0/1 yet; both are written down in docs/d3d12_vulkan.md section 4.6.

Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation.
AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:30:47 -06:00
370b042430 d3d12_vulkan_device_test: check requests the host runtime predates against the layer's clamp
Windows 10's d3d12.dll refuses shader models 6.7-6.9 and root signature 1.2 with E_INVALIDARG, where a newer runtime clamps them, so the SHADER_MODEL / ROOT_SIGNATURE comparison from #704 counted 4 mismatches on every Windows 10 machine. A request above the highest one the host answered is now checked against the layer's own clamp (S_OK, 6.0 / 1.1) instead, and the count is printed.
2026-11-21 22:27:04 -05:00
039df7d24f Runtime: upload heaps in Resizable BAR memory when the GPU has it (D3D-96)
Upload-heap buffers asked for HOST_VISIBLE | HOST_COHERENT memory only, so the GPU read every vertex, index and
constant buffer a game uploads over PCIe from system memory. They now prefer DEVICE_LOCAL | HOST_VISIBLE |
HOST_COHERENT when the device has Resizable BAR: such a type in a device-local heap larger than the 256 MiB BAR
window (leonida::resizable_bar, runtime/src/vulkan_memory.h). Without Resizable BAR that type is a window of
256 MiB or less that every upload buffer would share, so they stay in system memory there. A full VRAM heap falls
back to system memory through DeviceState::allocate's existing order.

The device logs where upload heaps live, LEONIDA_UPLOAD_SYSMEM=1 keeps them in system memory for comparison, and
vulkan_memory_flags / device_upload_in_vram report the choice to tests. d3d12_state_map_test checks the detection
on the heap layouts of an RTX 5060 Ti with Resizable BAR, an RTX 3090 without it, a 256 MiB window and an
integrated GPU; d3d12_vulkan_device_test checks that its upload buffer is placed accordingly, and its GPU copies
then read that buffer in both placements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 21:26:20 -06:00
0251789a8b Merge remote-tracking branch 'origin/main' into d24-on-d32
# Conflicts:
#	runtime/src/vulkan_backend.h
2026-11-22 04:10:13 +01:00
a297365e38 Merge pull request #775 from JavierBlanco23
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:09:05 -05:00
316e2773f7 Merge pull request #715 from Vonsek 2026-11-21 22:08:19 -05:00
d549d2d117 Merge pull request #417 from kotorvr 2026-11-21 22:07:52 -05:00
4859a809b3 chore(merge): integrate current Vulkan descriptor tests
Keep the upstream 3D texture uploads alongside the unaligned BC sample and preserve the expanded feature-query documentation.
2026-11-22 04:06:58 +01:00
e9a8203d45 Merge main and preserve volume views and HRESULT tracing in A8 coverage 2026-11-22 00:06:32 -03:00
d5e00415f6 D3D-86: answer CheckFeatureSupport OPTIONS2-5, 7, 9, 11, 13-16, 18-21 2026-11-22 04:00:58 +01:00
96404ac97a Merge main into D3D-26: unordered-access clears on main
Keeps both sides; the discard emit now passes the binding to image_barrier
as main's version takes it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:58:23 +00:00
c7e450fc69 D3D-26: keep a null discard region apart from an explicit UINT_MAX count
A region with NumSubresources = UINT_MAX was recorded like a null region and
skipped the FirstSubresource check. DiscardResource now has a whole flag;
explicit ranges are checked in 64-bit at recording and replay. Tests at the
UINT_MAX boundary in command_list_test, part F and the COM device test.
Found by matheuskshn in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:44 +00:00
94c786411c Merge pull request #757 from VictorJulianiR 2026-11-21 21:38:01 -05:00
69ed76dad0 Merge pull request #754 from Rafael 2026-11-21 21:37:59 -05:00
dcb2e8ecf1 Merge pull request #748 from Vonsek 2026-11-21 21:37:58 -05:00
18edaeba25 Merge pull request #717 from Dea7hsmiles 2026-11-21 21:37:51 -05:00