Commit Graph

14 Commits

Author SHA1 Message Date
c6817c3d55 d3d12: allow queue submissions during fallback clock calibration 2026-11-25 14:31:03 +05:00
a86d7f9508 d3d12: an integrated GPU reports UMA and refuses MEMORY_POOL_L1 heaps, as the host does (#6569)
Squash-merged after diff review of PR #6569
2026-11-23 12:42:09 -06:00
dc473d8c17 Merge pull request #4282 from cixotdev
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:13:05 -05: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
8dfe9bce1a runtime: notify QueueHolds when a held CPU Fence::Signal fires
When ID3D12Fence::Signal is deferred behind a pending GPU queue signal,
Fence::Signal enqueues a FenceWaitDispatcher callback that calls
vkSignalSemaphore directly instead of going through VulkanFence::signal.
That callback previously never notified QueueHolds via
holds().signaled(semaphore, value) and holds().pump_ready(), leaving any
cross-queue Wait-before-Signal batch stalled on that fence value
forever even after GetCompletedValue() reached it.

Record whether vkSignalSemaphore succeeded, decrement held_ first, and
then call holds().signaled(semaphore, value) and holds().pump_ready()
with no dispatcher or queue lock held. Add cross-queue regression cases
to check_held_cpu_signal in d3d12_fence_timing_test.cpp covering both a
Wait queued before the held CPU Signal and a Wait queued while the CPU
Signal is already held.

Claim: https://github.com/ItsNotRexed/Leonida/issues/4084#issuecomment-7088187469
AI-assisted: yes (Antigravity)
2026-11-22 21:17:10 -03:00
45ffc82680 Merge pull request #1161 from woreksami 2026-11-22 15:09:38 -05:00
7762899b33 Runtime: hold a CPU fence signal until the queue signals before it have completed
ID3D12Fence::Signal from the CPU called vkSignalSemaphore at once, also while a queue Signal of a lower value
was still pending on the GPU. Vulkan requires a host signal to stay below every pending signal
(VUID-VkSemaphoreSignalInfo-value-03259), and D3D12 allows the order. The fence now records the highest value a
queue will signal, under the same lock as the claim, and a CPU signal above a value the GPU has not reached yet
(or made while an earlier one is held) is handed to the fence dispatcher, which applies it once the GPU passes
that value, in the order the signals were made. The callback holds no pointer to the fence; when the fence is
released (cancel) or the device is lost before the queue value is reached, the held signal is dropped, since
signalling then would break the same rule. Until a held signal is applied, GetCompletedValue reads the GPU's
progress.

d3d12_fence_timing_test: a queue Signal kept pending by a Wait on a gate fence, a CPU Signal above it (held, then
applied), and two CPU signals held behind one queue signal (applied in order). Fails on main's Fence at the first
check: the event for the CPU value fired while the queue signal was still pending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:09:56 -05:00
78e83dec6f Runtime: GetCustomHeapProperties names node 0 where it has no answer, as the host does
For CUSTOM, an unknown heap type and a node mask other than node 0, the
layer answered an all-zero D3D12_HEAP_PROPERTIES. The host runtime
(RTX 5070, driver 621.14) answers the same zeros, but with node 0 in
CreationNodeMask and VisibleNodeMask. The masks are now set first, for
every answer.

d3d12_fence_timing_test compares those four cases with the host too:
CUSTOM on node masks 0 and 1, type 99 and UPLOAD on node mask 2. Before,
only DEFAULT, UPLOAD and READBACK were compared. Its local check of the
CUSTOM answer now includes the memory pool and the masks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:58:40 +01:00
3e8191d2ba Check Vulkan clock domains in the fence timing test 2026-11-22 18:01:06 +08:00
158e3e9455 Validate Vulkan clock calibration against Win32 QPC 2026-11-22 17:30:42 +08:00
eb21bee162 Runtime: a released fence sets the events still waiting on it, and SetEventOnMultipleFenceCompletion with no fences is E_INVALIDARG 2026-11-22 14:06:06 +05:30
d3841c0c0e d3d12_fence_timing_test: bound the calibration check by the calls' own durations
The two GetClockCalibration results had to agree within 2 ms. The fallback (a submitted timestamp query) is off by
up to a submission round trip, and with the GPU busy (a pipeline-cache build) that round trip passed 2 ms, so the
test failed about one run in ten. Each calibration is now allowed the time its call took, with 2 ms as the floor;
calibrated timestamps still have to agree within 2 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:15:07 -05:00
37e9e1e02a Tests: run four more GPU test programs under ctest, skipping without a Vulkan driver
d3d12_debug_markers_test, d3d12_fence_timing_test, d3d12_node_mask_test
and dxgi_swapchain_test were built but had no add_test, so ctest (and the
wine job's test list) never ran them; all four pass on an RTX 5070. Each
now exits 77 when there is no Vulkan GPU or driver, as the other GPU tests
do (dxgi_swapchain's SKIP branches exited 0, and with no driver at all it
failed at vkCreateInstance), and is registered with SKIP_RETURN_CODE 77.
2026-11-22 11:46:45 +05:30
25b8b0f3d6 runtime: fences and timing on the Vulkan device (D3D-30)
- SetEventOnMultipleFenceCompletion, ALL and ANY: a null event is one
  vkWaitSemaphores (WAIT_ANY_BIT for ANY); with an event, each fence's
  existing wait thread counts down one shared waiter, so no new threads.
- Queue GetClockCalibration: vkGetCalibratedTimestampsKHR (or the EXT
  alias) over the DEVICE and QueryPerformanceCounter domains when the
  device has the extension (the standalone device now enables it);
  otherwise a submitted vkCmdWriteTimestamp bracketed by QPC reads.
- GetAdapterLuid from VkPhysicalDeviceIDProperties::deviceLUID.
- GetCustomHeapProperties per the D3D12 docs' NUMA table, matching the
  UMA = FALSE the device reports.

d3d12_fence_timing_test covers both calibration paths, the LUID against
DXGI's adapter list and the heap answers against the host runtime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 00:10:33 +00:00