Commit Graph

311 Commits

Author SHA1 Message Date
1dbc0a2674 Merge pull request #3557 from stocksock 2026-11-22 17:02:41 -05:00
150bcde820 Merge pull request #3358 from kapitche 2026-11-22 17:01:39 -05:00
40cf3de8ab Merge pull request #2864 from mrp1no 2026-11-22 16:59:55 -05:00
ccd190606c Merge pull request #2562 from justr4mzi 2026-11-22 16:59:25 -05:00
b69e3a4898 Merge pull request #2297 from Ewann 2026-11-22 16:59:09 -05:00
d3a352f9ac Merge pull request #655 from ismailchaka1 2026-11-22 16:58:44 -05:00
d9b6883e1d d3d12_vulkan_device_test: print why a host comparison of a new format is skipped, and count the compared ones
Follow-up to #2438 from the review of pwu2775-dev. A failed host FORMAT_SUPPORT query was treated as 'no such texture' without saying so, and the summary printed '(host compared)' even when every comparison was skipped. The query's answer is now printed (E_FAIL on Windows 10 build 19045, E_INVALIDARG seen on another 19041 host, so a single code is not assumed) and the summary says how many formats were compared and how many the host lacks.
2026-11-22 22:33:00 +01:00
f8fe26dd5d d3d12_vulkan_device_test: excuse only the measured Windows 10 pair
Review of the previous commit (@kacper-serewis): the ID3D12Device10
predicate excused any unequal answers for the seven cases on a Windows 10
host, where only one pair was measured. Each case is now marked
windows10_refuses, and windows10_refusal() excuses exactly the layer's
S_OK against the host's E_INVALIDARG on a host without ID3D12Device10.
Any other difference there, and any difference on a newer host, is a
mismatch again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 21:09:59 +00:00
173ce07977 d3d12: residency calls answer as the host runtime does
d3d12_residency_test runs the same 110 MakeResident / Evict /
SetResidencyPriority / EnqueueMakeResident steps on the Vulkan-backed device
and on the host runtime, with a committed buffer, a heap, a placed buffer, a
descriptor heap, a query heap and a fence of each. It compares every HRESULT,
the device-removed reason after each step, and the value EnqueueMakeResident
leaves the fence at. Steps that leave the host runtime unusable run there in a
child process with a fresh device (--host-step). On main 7 steps differed (RTX
3060, driver 610.88); now none do:

- SetResidencyPriority takes a priority only for objects that own their
  memory, committed resources and heaps. A placed resource (a reserved one too,
  by the same rule; not measured), a descriptor heap, a query heap or a fence is E_INVALIDARG, also inside a
  longer list (the layer accepted all of them). The host also removes its
  device then (DXGI_ERROR_INVALID_CALL); the layer doesn't, since a title that
  sets priorities on placed resources would lose its device over a hint.
- EnqueueMakeResident accepts a null fence and signals nothing (the layer
  answered E_INVALIDARG).

Not compared: a nonzero count with a null array and a null entry in an array,
which the host dereferences; and a value below the fence's current one, which
moves the host's fence back but not the layer's (Vulkan timelines only go up,
already documented).

d3d12_vulkan_device_test's residency checks expected the old answers for a
fence and an allocator's priority and for a null fence, and now expect the
host's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:04:47 +01:00
61d8911cee d3d12: build against every Windows SDK 10.0.26100 d3d12.h (BUILD-970)
The README asks for "Windows SDK 10.0.26100 or newer", but the SDK's
d3d12.h changed within 10.0.26100: 10.0.26100.6584 ships
D3D12_SDK_VERSION 612, later builds 616. main used names from newer
headers, so it stopped compiling on the older 10.0.26100 builds:

- D3D12_FEATURE_D3D12_OPTIONS21 and its payload, with
  D3D12_WORK_GRAPHS_TIER_NOT_SUPPORTED and
  D3D12_EXECUTE_INDIRECT_TIER_1_0 (header 613);
- D3D12_INDIRECT_ARGUMENT_TYPE_INCREMENTING_CONSTANT (613);
- D3D12_FEATURE_D3D12_OPTIONS20 with D3D12_RECREATE_AT_TIER_NOT_SUPPORTED,
  and D3D12_FEATURE_PREDICATION (611).

They join the two feature values d3d12_feature_compat.h already declares
for the same reason: ABI values and payload structs in rt::d3d12::compat,
used by the device and its test. Where the header has the real
declarations, static_asserts check that the values, sizes and offsets
agree.

The runtime and every test now build against DirectX-Headers v1.610.2,
v1.611.0 and v1.613.0's d3d12.h (put ahead of the SDK's) and against the
SDK's own 616 header. Before this change, 611 failed with 18 errors and
610 with more.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GN11jcpJWD4phrXJyDgED6
2026-11-22 21:02:24 +00:00
2edd806f5c d3d12: typeless depth-stencil textures without ALLOW_DEPTH_STENCIL 2026-11-22 15:51:15 -05:00
dc4256ff53 d3d12_vulkan_device_test: seven buffer-state and heap cases are not comparable on Windows 10
Windows 10's D3D12 (no ID3D12Device10) still validates a buffer's initial
state and refuses a HARDWARE_PROTECTED heap, where newer runtimes and the
layer accept them. Seven cases compared those answers without a predicate,
so the test could not pass on a Windows 10 host:

  committed: buffer in state 0x80000000
  committed: buffer in RENDER_TARGET | UNORDERED_ACCESS state
  heap: HARDWARE_PROTECTED
  placed: upload buffer in COPY_DEST
  placed: readback buffer in GENERIC_READ
  placed: default buffer in state 0x80000000
  reserved: buffer in state 0x80000000

They now carry the ID3D12Device10 predicate their neighbours already use,
and compare_heap_neighbours gains the same "not comparable on this host"
path as the other two comparisons. Hosts with ID3D12Device10 compare
exactly as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-22 20:48:09 +00:00
8eb151724a d3d12_vulkan_device_test: CreateCommandList1 with type NONE is compared only on a Windows 11 runtime
Windows 10's host runtime (19045) creates a list of type -1 that Windows
11's refuses with E_INVALIDARG (@MeNoSkills on #2297, RTX 4070 Ti and a
Radeon iGPU). The case now carries the file's +device10 predicate, as the
other answers newer runtimes changed do: on a host without ID3D12Device10
it is printed as not comparable instead of failing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:21:25 +01:00
6de779367b Runtime: command allocators and lists answer invalid arguments as the host does
Measured against the host D3D12 runtime (RTX 5070, driver 621.14) with
d3d12_vulkan_device_test's compare_invalid_arguments:

- CreateCommandAllocator and CreateCommandList1 took any type (7, 99,
  -1); the host refuses types past VIDEO_ENCODE with E_INVALIDARG.
- CreateCommandList and CreateCommandList1 took a node mask with bits
  past node 0; the host answers E_INVALIDARG.
- A null output was E_POINTER in all three; the host answers
  E_UNEXPECTED, after the argument checks.

compare_invalid_arguments gets 35 "command allocator:", "command list:"
and "command list1:" cases. Video list types are not compared: the host
hands out a video list (E_NOINTERFACE for ID3D12GraphicsCommandList),
while this layer creates a graphics list for them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:21:25 +01:00
cd472ec101 D3D12 layer: stream-output statistics query heaps (D3D-302)
CreateQueryHeap(D3D12_QUERY_HEAP_TYPE_SO_STATISTICS) returned E_NOTIMPL, so
a title that makes one got nothing. The layer has no stream output (a PSO
with StreamOutput entries is refused, SOSetTargets is not implemented), so
every SO_STATISTICS_STREAM0..3 query counts 0 written and 0 needed.

Such a heap is now made without a VkQueryPool: Begin/EndQuery record nothing
in Vulkan (the D3D12 call rules and the ended tracking still apply), the
queries overlap no occlusion or statistics query, and ResolveQueryData fills
16 zero bytes per query (D3D12_QUERY_DATA_SO_STATISTICS) with no statistics
split. When stream output lands this becomes a
VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT pool.

Mesh-shader statistics (PIPELINE_STATISTICS1) are left to D3D-132.
2026-11-22 20:14:17 +00:00
f1c8e9370d d3d12: GetResourceAllocationInfo* answer the invalid allocation for a visible mask above 1
On a single-node adapter the host runtime and WARP return SizeInBytes UINT64_MAX with 64 KiB alignment
for a visible mask naming a node that does not exist, also for zero resources, and leave the
per-resource array untouched (GetResourceAllocationInfo, 1 and 2). The layer ignored the mask and
returned a real size. Compared with the host in d3d12_vulkan_device_test.
2026-11-22 15:13:58 -05:00
e459634208 Merge pull request #3003 from Kacper Serewis 2026-11-22 15:13:57 -05:00
f5ec088201 Merge pull request #2817 from IAmNotSiob 2026-11-22 15:12:17 -05:00
e138630254 Merge pull request #2772 from Nicolas Abosch 2026-11-22 15:11:49 -05:00
63ab7be421 Runtime: zero-fill default-heap buffers outside the arena (D3D-71)
D3D12 committed resources start zeroed unless the heap has
CREATE_NOT_ZEROED. Arena buffers are zeroed through its mapping, but
device-local buffers outside it were not ("default-heap buffers are not
zero-filled yet"). They are now queued on the context and filled with
vkCmdFillBuffer by the next submission on any queue, ahead of its lists.

That submission publishes the same initialisation semaphore as the
storage-image setup, so a list on another queue that uses the buffer first
waits for the fill. A buffer destroyed before any submission leaves the
queue, and a failed submission puts its fills back.

A queue being destroyed now clears that shared semaphore if it published
it: the queue is idle, so the work is done, and a later submission on
another queue would otherwise wait on a destroyed semaphore. With buffer
fills publishing it often, d3d12_vulkan_device_test hit exactly that
(vkQueueSubmit: invalid pWaitSemaphores, then a crash).

d3d12_vulkan_device_test (a device without the arena) reads a fresh
default buffer back as zeros after dirtying recycled memory, and checks
that a CREATE_NOT_ZEROED buffer written in the same list keeps the copy.
2026-11-22 20:11:43 +00:00
b34368e7a2 d3d12: exclude 8-bit sRGB formats from typed buffer support 2026-11-22 20:05:06 +01:00
3a44e1926b Merge pull request #2736 from mrp1no 2026-11-22 13:17:27 -05:00
a44df460f3 Merge pull request #2662 from admin 2026-11-22 13:16:54 -05:00
23f61f5724 Merge pull request #2563 from Ewann 2026-11-22 13:16:12 -05:00
da3861dd86 Merge pull request #2462 from mrp1no 2026-11-22 13:15:29 -05:00
84df39f34f Merge pull request #2453 from Flyander 2026-11-22 13:15:26 -05:00
b715e6ac2e Merge pull request #2438 from MeNoSkills 2026-11-22 13:15:19 -05:00
09cf8b65e3 rdna2spirv: s_memtime / s_memrealtime via OpReadClockKHR, enable VK_KHR_shader_clock 2026-11-22 19:14:59 +01:00
e41720bac9 Merge pull request #2373 from Ewann 2026-11-22 13:14:21 -05:00
c7894a6fb7 Merge pull request #2242 from Ewann 2026-11-22 13:13:28 -05:00
45a5aec292 Merge pull request #2100 from Koro4e 2026-11-22 13:13:01 -05:00
db317bd3ee Merge pull request #1947 from Jolymmiles 2026-11-22 13:12:44 -05:00
c43bc3df9d d3d12: CheckFeatureSupport refuses undefined root signature versions
The layer clamped every HighestVersion above 1.1 to 1.1 and returned S_OK.
The host only does that for versions it defines: on an RTX 4070 Laptop
(621.24) and WARP, anything above 1.2 is E_INVALIDARG with the value left
unchanged. Keep the clamp for 1.2 and refuse the rest.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:10:23 -03: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
b30eead831 d3d12_vulkan_device_test: realign
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 17:58:47 +00:00
d59cf62ee5 d3d12_vulkan_device_test: don't shadow the feature-level array (MSVC C4456)
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 17:58:40 +00:00
ccc7cf8f3c Merge remote-tracking branch 'upstream/main' into d3d-msaa-quality-levels-host 2026-11-22 17:52:50 +00:00
90555270cb Reject R1_UNORM and keep output for unknown formats in MULTISAMPLE_QUALITY_LEVELS; fix flag type name
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 17:50:24 +00:00
a78c36ae51 d3d12: acceleration-structure state only on a device that has them
@aguedou-34 measured on #2462 that an integrated Radeon without DXR (OPTIONS5
reports no ray tracing) refuses a UAV buffer created in
RAYTRACING_ACCELERATION_STRUCTURE state, which an RTX accepts. The layer now
accepts that state only where it has acceleration structures (KHR builds, or
the XDXR records with the GPU address arena), for committed, placed and
reserved resources alike, and refuses it elsewhere.

d3d12_vulkan_device_test compares the existing committed case on the device
main builds (no acceleration structures) only with a host without ray
tracing, and two new cases on the standalone device (committed and placed)
only with a host that has it; otherwise they are reported as not comparable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:43:48 +01:00
7a9bebd226 Runtime: CheckFeatureSupport(FORMAT_SUPPORT) answers UNKNOWN and unlisted formats as the host does
Measured against the host D3D12 runtime (RTX 5070, driver 621.14):
UNKNOWN is a buffer format (S_OK, Support1 = BUFFER), and a value the
runtime's format table has no entry for is E_FAIL: 116-188, which
includes the planar video formats P208/V208/V408 at 130-132, and 192 and
up. The layer answered DXGI_ERROR_UNSUPPORTED for both.

compare_invalid_arguments gets 11 "format support:" cases, comparing the
HRESULT and Support1. Support2 is not compared, because the host's
TILED is a GPU capability the layer doesn't offer. The local check that
expected UNKNOWN to fail now expects the host's answer. 115, 189 and 191,
the table's edges, must not be E_FAIL.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:29:43 +01:00
eac6e0cee8 Match host multisample quality level query validation
Follow RTX 5070 / 621.14 measurements from upstream #1991; preserve tiled-resource rules and cover host answers synthetically.

AI-assisted.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-22 17:26:17 +00:00
4e596d1a6d d3d12_vulkan_device_test: accept the layer's nearest-even tie on its own adapter
The placed plain clear (D3D-90/D3D-221) is compared byte for byte with the host
D3D12 runtime when the host is the layer's own adapter. Its 0.5 * 255 = 127.5 is
a tie: NVIDIA's D3D12 driver writes 0x7f, WARP and AMD 0x80, and the D3D11.3
spec (3.2.3.6) permits either within 0.6 ULP. With this branch the layer rounds
normalised clear values itself, to nearest even, so on an NVIDIA adapter it
writes 0x80 and the exact same-adapter comparison failed (RTX 5070, 621.24).

On the same adapter a differing plain byte is now accepted only when it is
exactly the nearest-even code and within 0.6 ULP; every other difference still
fails, and the SRGB-cast comparison is unchanged.
2026-11-22 14:12:39 -03:00
9b17404e15 Runtime: replay overlapping statistics and binary occlusion queries (D3D-252)
D3D12 only forbids beginning the same query element twice while it runs, so a
command list may overlap two pipeline-statistics queries, or an ordinary
occlusion query and a binary one, on different slots of one heap. The replay
refused all of those with ReplayResult::unsupported. The overlapping-ordinary
occlusion machinery already virtualizes concurrent queries as non-overlapping
physical segments whose results are summed; this extends it to the remaining
cases:

- Binary occlusion joins the ordinary kind in the same physical pool (both are
  VK_QUERY_TYPE_OCCLUSION, so one physical query is open at a time and the
  shared intersection interval is counted by both logical queries). A binary
  resolve of a multi-segment query sums its segments and normalizes the total
  to 0/1 (OcclusionResolve::sum_binary; run flag needs_sum_binary).
- Overlapping pipeline-statistics queries split into the statistics pool with
  the same one-slot-per-event layout (plan_overlapping_statistics_segments);
  every non-timestamp resolve while a query runs closes and reopens the open
  segment for D3D-162's helper-dispatch exclusion. The single-list replay()
  helper still has no segment pool and refuses such lists outright instead of
  running two Vulkan queries of one type whole.

The device test's old pin of the occlusion+binary refusal now expects a
replay; vk_overlapping_occlusion adds crossing statistics queries checked
word-by-word against three unsplit references and an ordinary query around a
binary one; replay_query_predication pins the segment layouts, the composite
binary resolve and the helper's refusal without a GPU. docs/d3d12_vulkan.md
4.6 moves the case out of "Not implemented yet".

AI-assisted: yes
2026-11-22 18:10:42 +01:00
1240e41494 Fix Windows SDK 10.0.26100 D3D12 compatibility 2026-11-22 18:05:26 +01:00
911ee1a1f9 d3d12_vulkan_device_test: compare A4B4G4R4 with the host only where the host has the format
new_format_round_trips (D3D-259, #1914) failed on a Windows 10 host with 'new format 191: the host refuses a texture the layer creates': A4B4G4R4_UNORM is not in Windows 10's D3D12, whose CheckFeatureSupport reports no 2D texture for it, and the test stops there so no later check runs. The host comparison now runs only for a format the host reports as a 2D texture; a host that reports it and still refuses it fails as before.
2026-11-22 18:03:56 +01:00
076149b744 d3d12: placed and reserved resources answer their arguments as the host does
compare_placed_reserved (d3d12_vulkan_device_test) runs 76 CreatePlacedResource
and CreateReservedResource cases against the host runtime on the standalone
device. On main 31 of them differed (RTX 3060, driver 610.88):

- CreatePlacedResource checked none of the description, initial-state and
  clear-value rules CreateCommittedResource has, and checked a plain texture's
  size against nothing: a texture larger than its heap, or past its end, was
  accepted. A small texture (4 KiB alignment) at a 4 KiB offset was refused.
- CreateReservedResource checked those rules only for textures (through the
  committed backing) and never the initial state or clear value.
- Both answered a null output with S_FALSE; the host checks the arguments,
  then answers E_UNEXPECTED.

The initial state was not checked for committed resources either. The host
takes exactly GENERIC_READ, one write state alone (RENDER_TARGET,
UNORDERED_ACCESS and DEPTH_WRITE with their flag), or a mix of read states on a
texture; any bits on a buffer except the acceleration-structure state without
UAV access. initial_state_refusal holds that rule, in committed_resource_refusal,
so committed, placed and reserved resources share it; 23 "committed: ... state"
cases pin it in compare_invalid_arguments.

A placed buffer in an upload or readback heap takes any initial state on the
host (a committed one must start in GENERIC_READ or COPY_DEST); UAV access is
refused there as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:02:11 +01:00
6670b2bca0 d3d12: order timestamp resolves after their writes on MoltenVK
On Apple GPUs MoltenVK samples a vkCmdWriteTimestamp in a blit pass of its own at the end of the current Metal
encoder. Nothing orders the vkCmdCopyQueryPoolResults resolve after that pass. The copy read the old value, or 0 for
a timestamp never written, so d3d12_vulkan_device failed under Wine on a Mac (t1 == 0). A minimal Vulkan program
reproduces it natively on MoltenVK 1.4.3 and 1.4.2: the copy was right 0 to 43 times in 200, in the same command
buffer, the next one or the next submit. KosmicKrisp and llvmpipe were right in every case.

Where driverID is MoltenVK, the queue sets and waits for a fresh VkEvent before each timestamp resolve that copies.
A submission with such a resolve also waits on the queue's timeline for the submission before it. Both measured
200/200 and 500/500. The timestamps are still the GPU's own. The events go back to a pool after a host reset once
their submission completes. d3d12_vulkan_device also checks a resolve in the execution after the write. Documented
in docs/d3d12_vulkan.md section 4.6.
2026-11-22 21:00:39 +04:00
b3a5411ce0 Merge pull request #2186 from fearkov
# Conflicts:
#	docs/design.md
2026-11-22 11:42:36 -05:00
6f77e39793 Merge pull request #2112 from SirKingg 2026-11-22 11:41:54 -05:00
e0b03b2721 Runtime: CheckFeatureSupport refuses the undefined shader models between 5.1 and 6.0
D3D12_FEATURE_SHADER_MODEL echoed a request of 0x52-0x5f back with S_OK.
No runtime defines a model there, and the host runtime refuses them
with E_INVALIDARG (RTX 5070, driver 621.14). Refuse them the same way.
Requests above 6.9 stay clamped to the layer's model, as newer runtimes
accept newer ones. Checked in d3d12_vulkan_device_test's main, not
against the host: the test notes the host crashed on 0x5f elsewhere.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:41:18 +01:00