Commit Graph

212 Commits

Author SHA1 Message Date
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
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
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
7baf4c21ac D3D-238: refuse the heap descriptions the host refuses in CreateHeap
CreateHeap checked only for a null description and a zero size. A shared
heap_desc_refusal now also refuses an alignment other than 0, 64 KiB and
4 MiB, a heap with all three DENY_* flags, and the heap properties that
heap_properties_refusal already refuses for committed resources (a type
outside the enum such as 0, a custom heap without a CPU page property or
memory pool, a non-custom heap with either). CreateHeap1, a stub until
now, wraps CreateHeap and refuses a protected session.

Tests: direct E_INVALIDARG/S_OK checks on the standalone device for both
methods, and host comparison cases in compare_invalid_arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:25:38 +01:00
d665490a68 runtime: check SeIncreaseBasePriorityPrivilege for global realtime queues (D3D-236) 2026-11-22 15:25:02 +01:00
74205e9d78 d3d12: enforce DENY_* heap flags for all placed resources (D3D-222) 2026-11-22 15:16:07 +01:00
6ea194097f Merge pull request #1785 from Vonsek 2026-11-22 09:15:20 -05:00
b78819439f Merge pull request #1753 from Serrambi 2026-11-22 09:15:05 -05:00
082190c19b Merge pull request #1752 from CowDeV 2026-11-22 09:15:05 -05:00
b6135472da Merge pull request #1739 from Alex Arenas 2026-11-22 09:14:59 -05:00
32e03070a3 Merge pull request #1737 from IAmNotSiob 2026-11-22 09:14:58 -05:00
a14edd52a4 Merge pull request #1674 from Serrambi 2026-11-22 09:14:50 -05:00
ceb244b124 d3d12_vulkan_device_test: pin the 0.6 ULP clear tolerance on every GPU
The accept side of the SRGB-cast rule only runs where the host rounds
differently (Intel), so a change to it would stay green on NVIDIA and
AMD. ideal_srgb and within_06_ulp move to file scope, and the test
checks the predicate directly: (187, 188) at 187.516 and (127, 128) at
127.5 are accepted; (186, 188), (126, 128), (224, 225) at 224.61,
(136, 137) at 136.97 and (254, 255) at 255 are not. Raising the
tolerance to 1.6 fails the test on an RTX 4070 SUPER. Suggested in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:11:35 +01:00
1f12cd9f16 Tests: compare d3d12_vulkan_device with the host on the layer's own adapter
On a PC with two GPUs, D3D12's default adapter can be a different GPU from
the one LEONIDA_VK_DEVICE gives the layer. d3d12_vulkan_device's host
comparisons (create_host_device, the D3D-46 copies) then compared one GPU's
Vulkan driver with the other GPU's D3D12 driver: with the layer on an AMD
RDNA2 iGPU and an RTX 5080 as adapter 0 it failed at argument_mismatches
(format 67 RT: the AMD layer accepts an R9G9B9E5 render target, the NVIDIA
host refuses it).

copycmp::layer_adapter() holds the Vulkan device's LUID. When
LEONIDA_HOST_ADAPTER is unset, create_host tries that adapter first and falls
back to the default one. The test sets it from VkPhysicalDeviceIDProperties
in main. LEONIDA_HOST_ADAPTER still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 15:08:57 +01:00
af0453281d d3d12: support multisampled placed textures (D3D-222) 2026-11-22 15:02:35 +01:00
c97ae2619a test(d3d12): gate tiled MSAA allocation skip on host quality levels (D3D-191) 2026-11-22 15:02:33 +01:00
dfdde86773 test(d3d12): skip host-unsupported tiled allocation cases (D3D-191) 2026-11-22 14:57:48 +01:00
146a9f02b4 d3d12_vulkan_device_test: 0.6 ULP tolerance for placed SRGB-cast clears (D3D-221)
Against another adapter or WARP, a placed clear byte may differ from the
host when both sides are within 0.6 ULP of the ideal value, the
tolerance D3D11.3 spec 3.2.3.6 (FLOAT -> UNORM) and 3.2.3.8
(FLOAT -> SRGB) allow. The plain tie rule already did this for
0.5 * 255; the SRGB-cast clear's 0.5 encodes to 187.516, where Intel's
Vulkan driver (UHD 770, 101.7092) writes 187 and WARP 188. The layer's
own adapter stays exact.

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