Commit Graph

227 Commits

Author SHA1 Message Date
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
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
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
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
817de3de95 Merge pull request #2041 from fearkov 2026-11-22 11:41:08 -05:00
1e24a98cce Merge pull request #2032 from Alex Arenas 2026-11-22 11:41:04 -05:00
1241d87e4f Merge pull request #1991 from TheHoracio 2026-11-22 11:40:59 -05:00
56000c7c7f Runtime: CreateRootSignature and CreateQueryHeap 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, five answers
differed:

- CreateRootSignature took a node mask other than node 0 (host:
  E_INVALIDARG), took a DXBC blob passed with more bytes than its own
  size (host: E_INVALIDARG), and answered a null output with E_POINTER.
  The host answers a null output with S_FALSE before it looks at the
  blob or the node mask.
- CreateQueryHeap answered an unknown type (past PIPELINE_STATISTICS1)
  with E_NOTIMPL (host: E_INVALIDARG), and a null output with S_FALSE
  (host: E_UNEXPECTED, after the description checks).

compare_invalid_arguments gets 30 "query heap:" and "root signature:"
cases. The root signature blobs come from the host's serializer.
d3d12_vulkan_device_test's own null-output check now expects
E_UNEXPECTED. Known query types this layer has no path for stay
E_NOTIMPL, and more than 32 root dwords stay refused (pack()).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:40:55 +01:00
067e0240bd Merge pull request #1935 from Tao Battarel 2026-11-22 11:40:49 -05:00
fac5a5af7d Runtime: MULTISAMPLE_QUALITY_LEVELS answers TILED_RESOURCE
CheckFeatureSupport(MULTISAMPLE_QUALITY_LEVELS) refused the TILED_RESOURCE
flag with E_INVALIDARG. Native D3D12 (RX 7800 XT, a Radeon iGPU and WARP)
answers S_OK: 1x and 4x keep the plain answer, every other count has none,
and a format without a tile shape (96-bit) has none at any count, which is
GetResourceAllocationInfo's tiled rule here (tiled MSAA is 4x only).
128-bit formats tiled at 4x are a driver difference: the AMD drivers answer
0, WARP and NVIDIA allocate them; the layer follows the latter.

d3d12_vulkan_device_test compares the TILED_RESOURCE quality levels of six
formats at five counts with the host's (allowing that one difference). The
allocation side of the AMD failure is c97ae261's host-quality gate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 17:32:12 +01:00
f6ae4e58ab runtime: report COMMAND_QUEUE_PRIORITY_HIGH unsupported (D3D-258) 2026-11-22 17:15:59 +01:00
09632c2e38 Tests: the standalone device's pixel-shader extensions follow the GPU 2026-11-22 12:13:27 -04:00
849f4b7a9c d3d12: reject integer formats in plain resolves (D3D-274)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-11-22 16:59:20 +01:00
a37d1e6e7e runtime: fail closed on non-ERROR_NO_TOKEN OpenThreadToken errors in has_global_realtime_privilege
Address @Flyander's post-merge review feedback on #1817 (D3D-236):

- Only fall back from OpenThreadToken to OpenProcessToken when GetLastError() == ERROR_NO_TOKEN, failing closed on ERROR_CANT_OPEN_ANONYMOUS or any other thread-token error.

- Log the standard-priority Vulkan queue approximation once on the granted global-realtime path.

- Remove the +not_elevated skip predicate from compare_invalid_arguments and add a SecurityAnonymous impersonation regression test.
2026-11-22 16:53:06 +01:00
503c55e185 Tests: the standalone device's image and output features follow the GPU 2026-11-22 11:41:07 -04:00
e65b624932 Merge pull request #2030 from itsRevela 2026-11-22 10:40:36 -05:00
dd91fbe6ff Merge pull request #1935 from Tao Battarel 2026-11-22 10:39:33 -05:00
8dc359b892 Merge pull request #1914 from zneel 2026-11-22 10:39:25 -05:00
53e46c0b8c Merge pull request #1886 from Claude 2026-11-22 10:39:10 -05:00
9fb466a137 Merge pull request #1820 from Tomgamer 2026-11-22 10:38:57 -05:00
944f26d7d1 Merge pull request #893 from traeb0n 2026-11-22 10:38:44 -05:00
7f9b28a8d6 fix(d3d12): build with Windows SDK headers that lack the D3D12 sample-pattern names
D3D12_STANDARD_MULTISAMPLE_PATTERN and D3D12_CENTER_MULTISAMPLE_PATTERN
are only in d3d12.h from DirectX-Headers 1.613 (D3D12_SDK_VERSION 613)
on; older Windows SDK 10.0.26100 headers lack them, so gta6rt_d3d12_com
and d3d12_vulkan_device_test stop with C2065 under VS 2022. They are
enum members, so an #ifndef fallback can't detect them. Use the equal
DXGI_STANDARD/CENTER_MULTISAMPLE_QUALITY_PATTERN macros from
dxgicommon.h, which d3d12.h includes on every SDK.
2026-11-22 09:36:23 -06:00
697bdae8f8 Runtime: compare CheckFeatureSupport error HRESULTs with the host (D3D-50)
Add a comparison test that runs CheckFeatureSupport on both the shim and the host PC runtime and asserts their HRESULTs agree for invalid inputs: a null data pointer, a structure smaller than the feature requires, and feature values no runtime defines. Valid queries are not compared (their answers are the GPU choice). No game files; runs on WARP or any D3D12/Vulkan GPU.
2026-11-22 16:32:41 +01:00
7d30d3fd83 D3D-238: accept HARDWARE_PROTECTED heaps, as the host does
A host run on an RTX 4070 SUPER and a UHD 770 (@CowBoYdu76) creates a
HARDWARE_PROTECTED default heap, though the D3D12_HEAP_FLAGS
documentation calls it unsupported. heap_desc_refusal no longer refuses
it; it moves from the refusal cases to compare_heap_neighbours and the
accepted list. ALLOW_DISPLAY stays refused, now confirmed on those hosts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:27:24 +01:00
6c47d748b1 Merge remote-tracking branch 'origin/main' into d3d-238-createheap-validation 2026-11-22 16:26:16 +01:00
ea32ba2f8e d3d12: review fixes for the new formats
- UAV clears of A4B4G4R4: an R4G4B4A4_PACK16 layout row (red in bits
  12-15, alpha in 0-3), unit-checked in conversion_checks and cleared end
  to end where the layer reports a typed UAV (the driver's call: WARP has
  one, AMD's D3D12 driver doesn't).
- FORMAT_SUPPORT reports IA_VERTEX_BUFFER only for formats input layouts
  accept (vertex_format), not every format Vulkan can fetch: R8/R16
  SNORM/SINT (and R8G8 SNORM/SINT) have no input-layout mapping yet.
- new_format_round_trips: each render-target format is cleared to
  (-3, -0.4, 0.25, 7) on the layer and on the host and the bytes compared,
  which catches a mapping of the right size but the wrong numeric type
  (R16_SNORM as UNORM, R8_SINT as UINT); no value is an exact half step.
  The host is the Vulkan device's own adapter, as in
  compare_format_support, not the default one.
- A4B4G4R4 is skipped where the Vulkan driver can't sample
  R4G4B4A4_UNORM_PACK16 (Vulkan doesn't require it), by the driver's
  format properties rather than the layer's answers; B4G4R4A4 and
  B5G5R5A1 are never skipped.
- d3d12_copy_xfmt: D16_UNORM <-> R16_UINT and R16_SNORM copies, the new
  members of depth_colour_pair, against the host and WARP.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:23:58 +01:00
9df4eda200 Runtime: VulkanQueue keeps its PreparedList storage between executions
execute built a new std::vector<PreparedList> on every call, so every
command's detail::Prepared entry (1288 bytes on main now) was made in
fresh memory and freed again: replay_cpu_bench measures that at 274-292
ns per command on an i7-14700K, against 85 ns refilled in kept storage,
over half of the layer's whole CPU cost per command. The queue now keeps
the vector as a member (per queue, like its command buffers: one execute
at a time on a queue, as acquire() and submit() already assume) and
resizes it to the list count; prepare refills each list's entries in
place, where the per-entry vectors also keep their capacity.

replay_cpu_bench mirrors the change and reports both floors (entries in
kept storage and made fresh). Its frame goes from 425 to 194 ns per
command (a 21,504-command frame from 9.1 ms to 4.2 ms).

d3d12_vulkan_device_test executes {B, A}, then {B} alone, and checks
that only B ran the second time: with storage that only grows, a stale A
is replayed after B and the test fails (checked).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:19:29 -06:00
2b2effeacb runtime: answer non-OPTIONS CheckFeatureSupport queries (D3D-258) 2026-11-22 16:07:42 +01:00
d63fac7606 Merge branch 'main' into d3d-238-createheap-validation 2026-11-22 15:57:50 +01:00
0a488f6733 D3D-238: refuse ALLOW_DISPLAY and HARDWARE_PROTECTED, leave CreateHeap1 to #1846
heap_desc_refusal now also refuses D3D12_HEAP_FLAG_ALLOW_DISPLAY and
HARDWARE_PROTECTED, which the D3D12_HEAP_FLAGS documentation says
CreateHeap does not support (review on #1820). Both are host-comparison
cases in compare_invalid_arguments, awaiting a host run, and direct
refusal checks on the standalone device.

CreateHeap1, its heap1 test cases and the heap_create1 helper are
removed: #1846 implements CreateHeap1 over CreateHeap and inherits these
checks. The docs keep #1846's CreateHeap1 line untouched and describe
the CreateHeap checks under the heap bullet instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:56:23 +01:00
2daadb7968 Merge pull request #1820 from Tomgamer 2026-11-22 09:48:26 -05:00
fb3e409fe0 Merge pull request #1817 from Alex Arenas 2026-11-22 09:48:25 -05:00
26a0ca32da Merge pull request #1753 from Serrambi 2026-11-22 09:48:10 -05:00
54e2fee2a9 Runtime: CreateCommandSignature refuses what the host refuses
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ2Pr9JZJaj81r4m2MtQZk
2026-11-22 14:47:23 +00:00
023cdbb924 d3d12_vulkan_device_test: compare CreateCommandSignature refusals with the host
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ2Pr9JZJaj81r4m2MtQZk
2026-11-22 14:44:52 +00:00
88eaac7c55 D3D-238: compare the valid heap neighbours on the arena-enabled device
compare_invalid_arguments runs on a device without the GPU address arena,
where every heap is E_NOTIMPL, so the ten valid-neighbour heap cases
mismatched the host's S_OK (RTX 5070 Ti and AMD iGPU run on PR #1820).
They move to compare_heap_neighbours, which runs on the standalone device
the CreateHeap tests use. The refusal cases stay in
compare_invalid_arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:41:45 +01:00
e550c82375 d3d12_vulkan_device_test: #1674's tiled-texture wait uses a new fence value
The standalone-device block signals its fence 5, 6, 7, 8. #1674's tiled placed-texture readback signalled 7 again,
so SetEventOnCompletion returned at once and the block read the readback buffer before the copy (line 4995). It
now waits on 8 and the next block on 9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 09:32:25 -05:00
629bcb2d99 d3d12: map the 11 R8/R16 and A4B4G4R4 formats the host creates
vulkan_format() had no entry for R16_UINT, R16_SINT, R16_SNORM, R8_UINT,
R8_SINT, R8_SNORM, R8_TYPELESS, R16G16_UNORM, R16G16_SNORM,
R16G16B16A16_SNORM or A4B4G4R4_UNORM, so CreateCommittedResource refused
them with E_INVALIDARG and FORMAT_SUPPORT answered DXGI_ERROR_UNSUPPORTED
where native D3D12 creates them (item 1 of the FORMAT_SUPPORT finding in
#1380).

A4B4G4R4_UNORM keeps alpha in bits 0-3 and red in 12-15 (cleared and
read back on native D3D12, RX 9070 XT and WARP), which is Vulkan's
R4G4B4A4_UNORM_PACK16; its T# row reads that as W, Z, Y, X.

Copies get the formats' texel sizes, D16 copies pair with R16 SNORM/UINT/
SINT like the other R16_TYPELESS members, and the colour-resolve check
refuses every integer format by numeric class instead of a list that
missed R8/R16 and the SINT forms of R8G8B8A8, R32 and R32G32B32A32.

Tests: d3d12_vulkan_device creates each format (as the host does), copies
a 4x4 upload in and back out bit for bit, and clears an A4B4G4R4 render
target to R, G, B and A; d3d12_descriptor_test samples A4B4G4R4 through
a T# alongside B4G4R4A4 and B5G5R5A1.

AI-assisted (Claude Code).

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