Commit Graph

177 Commits

Author SHA1 Message Date
26a0ca32da Merge pull request #1753 from Serrambi 2026-11-22 09:48:10 -05: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
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
be6ebf0e91 runtime: set binding.va and host_readable on placed buffers 2026-11-22 14:45:46 +01:00
86afc220f1 test(d3d12): rename shadowed loop variable host_desc (C4456) 2026-11-22 14:43:53 +01:00
fa687fda48 d3d12_vulkan_device_test: sampler heap size and realtime priority gates 2026-11-22 14:43:26 +01:00
1eeaa202f9 d3d12_vulkan_device_test: invalid-argument cases a Windows 10 host predates 2026-11-22 14:41:44 +01:00
e2af5b7df7 Merge pull request #1674 from Serrambi 2026-11-22 08:38:19 -05:00
aee81b80ef Merge pull request #759 from Douglas Sposito 2026-11-22 08:37:59 -05:00
83160a8114 d3d12: handle 4x MSAA and invalid MSAA in tiled allocation queries (D3D-191) 2026-11-22 14:36:05 +01:00
51dc01f123 Merge pull request #1616 from AlxcBTW 2026-11-22 08:08:11 -05:00
6c655f92b7 Merge pull request #1614 from Vonsek 2026-11-22 08:08:10 -05:00
a0c07b7c48 d3d12: support tiled placed textures (D3D-191) 2026-11-22 14:07:43 +01:00
b576c75ad2 Runtime: B8G8R8X8 textures as BGRA8 images, views read alpha 1 (D3D-87)
Map B8G8R8X8_UNORM, _UNORM_SRGB and _TYPELESS to the B8G8R8A8 Vulkan formats, so
creation, copies, footprints and clears work as for BGRA8. Shader views of the family
read alpha as 1 (the T# selects one for the alpha channel), and views between the
B8G8R8X8 and B8G8R8A8 typeless families are refused, although both land on the same
VkFormat.

Compared with the host D3D12 runtime on an RX 9060 XT: it reports no typed UAV for the
family and refuses typed B8G8R8X8 textures that allow unordered access (the typeless
format is accepted). The BGRA8 image would have advertised storage, so
CheckFeatureSupport now leaves the typed UAV bits out, texture creation refuses typed
B8G8R8X8 with ALLOW_UNORDERED_ACCESS, CreateUnorderedAccessView gives a null descriptor
for the family, and its images get no storage usage. WARP writes the clear's alpha into
the X byte, as Vulkan does, so clears need no change.

Tests: d3d12_clear_test clears B8G8R8A8_UNORM and B8G8R8X8_UNORM against WARP;
d3d12_vulkan_device_test compares B8G8R8X8 footprints, the typed UAV bits and UAV/RTV
resource creation with the host runtime; d3d12_descriptor_test samples a B8G8R8X8 and a
B8G8R8A8 texture with the same bytes through the bindless set (alpha 1 against the
stored byte) and checks the refused views.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 10:03:51 -03:00
cb439236d1 d3d12_vulkan_device_test: compare the placed castable clears with the layer's own adapter
Float -> UNORM at an exact tie (0.5 * 255 = 127.5) may map to either code
(D3D11.3 functional spec 3.2.3.6, 0.6 ULP tolerance). Native D3D12 gives 0x7f on
NVIDIA (RTX 3080 616.64, RTX 3090 610.88; Vulkan too) and 0x80 on Radeon and
WARP, so comparing the layer on NVIDIA with a host on another adapter failed
the placed plain clear. The host is now the layer's own adapter (LUID, then PCI
ids) unless LEONIDA_HOST_ADAPTER names one, and the output says which adapter
it was and whether it is the layer's. Against a different adapter or WARP an
exact tie may differ by one code; every other byte stays exact. The layer is
unchanged.

Measurements and review by @Rainmaker33 and @Flyander.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:01:03 +01:00
c3975165ac fix(runtime): allow native RGB9E5 multisample resolves 2026-11-22 13:38:38 +01:00
11380bbbd6 Merge pull request #1511 from zneel 2026-11-22 07:38:00 -05:00
814e506179 Merge pull request #558 from omar-akermi 2026-11-22 07:37:53 -05:00
ce7e042e6e Merge pull request #495 from Aminecsmc 2026-11-22 07:37:52 -05:00
1556d9c4db Merge main (99f99890) into d3d-51-command-list-rules
Conflicts in d3d12_com.cpp and d3d12_vulkan_device_test.cpp: both sides kept.

d3d12_debug_markers_test recorded two lists into one allocator at once, which
this branch rejects as the PC runtime does; its second list now has its own
allocator. The device-removed wording in the docs and the test matches main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:36:11 +01:00
7ec6e3ecfe d3d12 FORMAT_SUPPORT: depth formats are not UAVs
NVIDIA gives VK_FORMAT_D32_SFLOAT and D16_UNORM STORAGE_IMAGE, so the
layer reported typed UAVs (and now typed loads) for D32_FLOAT and
D16_UNORM on an RTX 3070 where native D3D12 reports none (found by
@Parakeet-Wheat, review by @Flyander). The depth cleanup clears the
typed-UAV bit and every Support2 bit, and the host comparison's depth
check now covers TYPED_UNORDERED_ACCESS_VIEW and Support2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:24:48 +01:00
17d0861c34 d3d12 FORMAT_SUPPORT: review fixes; the test catches over-claims
From two reviews of #1511:
- Depth formats drop TEXTURE1D: the layer refuses 1D depth-stencil
  resources (native D3D12 allows them).
- The depth MULTISAMPLE_RENDERTARGET query uses the same usages as
  MULTISAMPLE_QUALITY_LEVELS and resource creation.
- R9G9B9E5's emulated UAV reports typed load with store, like the rest.
- Comments and docs say what works today: typed UAV texture reads go
  through the sampled binding; typed buffer UAVs share the store side's
  gaps (no buffer UAV views, rdna2spirv FORMATS); R32_UINT atomics work
  on 2D UAVs only.
- compare_format_support only runs against a host on the same adapter,
  lists the formats the layer answers with no uses instead of skipping
  them silently, needs at least 40 compared formats, and checks
  over-claims: MIP and atomics the host lacks, atomics outside
  R32_UINT/R32_SINT, sampling integer formats, and multisample render
  targets that disagree with MULTISAMPLE_QUALITY_LEVELS. A layer with
  injected atomics, multisample and integer-sampling over-claims fails
  it with 128 mismatches.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:23:02 +01:00
cb33e81b04 Runtime: invalid-argument HRESULTs as the host runtime (D3D-49)
CreateCommittedResource, CreateDescriptorHeap, CreateCommandQueue, CreateFence
and Map now return the host PC runtime's HRESULTs for invalid arguments.
compare_invalid_arguments in d3d12_vulkan_device_test checks the invalid
descriptions and their valid neighbours, plus ALLOW_RENDER_TARGET and
ALLOW_DEPTH_STENCIL on every format both devices create, against the host
device.

On main the new test found 25 mismatches in its first 55 cases (invalid
heap properties and flags, buffer layouts, upload/readback states, clear
values and texture flags accepted; two access violations, on a zero-width
buffer and a zero-size texture array), then the process died creating a
2049-layer texture. main also refused zero-descriptor heaps and answered
E_POINTER where the host treats a null output as a capability check.

CreateDescriptorHeap answers a null output before its flag, type and node
rules, as the host does; committed resources and fences check their
arguments first. A GPU_UPLOAD heap is refused, matching the layer's
OPTIONS16.GPUUploadHeapSupported FALSE; the test compares that case only on
a host without GPU upload heaps (Resizable BAR off).

CreateCommittedResource accepts a sample quality on a single-sampled texture
and the two standard MSAA patterns, as the host does.

The flag and format rules were measured on an RX 9070 XT, an integrated Radeon
GPU and WARP. Answers that differ between them, or that the layer can't follow,
are not compared and are listed in docs/d3d12_vulkan.md. Each new refusal is
logged once with its reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 13:19:56 +01:00
48a8d23be0 Merge pull request #1511 from zneel 2026-11-22 07:07:58 -05:00
00d9634ac7 d3d12 FORMAT_SUPPORT test: integer resolves only; guard the depth MSAA query
Which float formats resolve is up to the GPU (the RX 9070 XT's driver
reports no R9G9B9E5 resolve, WARP does), so the host comparison only
checks the rule the layer implements: no resolve of UINT/SINT formats.
The depth-stencil multisample query checks image_format_properties like
the other calls do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:46:48 +01:00
9a08a6d706 d3d12: FORMAT_SUPPORT follows D3D12's per-format rules
The layer turned Vulkan feature bits straight into D3D12 support bits. On an
RX 9070 XT that disagreed with native D3D12 on the same adapter in 169
reported-but-absent bits and 761 absent-but-native ones. This change only
reports what the layer provides:

- UAV_TYPED_LOAD with every typed UAV (reads use the sampled binding), not
  from STORAGE_IMAGE_ATOMIC; the UAV atomic bits other than exchange for
  R32_UINT, the format with the r32ui storage view
- MIP where the image can have mips; SHADER_GATHER with SHADER_SAMPLE;
  MULTISAMPLE_RENDERTARGET for depth formats
- no integer MULTISAMPLE_RESOLVE, no 1D block-compressed, no 3D or shader
  reads of depth formats, and TYPELESS formats report only texture
  dimensions and MIP

d3d12_vulkan_device_test compares these format-defined bits with native
D3D12 on the same adapter: 0 mismatches over 78 formats with this change,
249 on main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:42:00 +01:00
d6d5117244 Merge pull request #1440 from IAmNotSiob 2026-11-22 06:38:04 -05:00
0b6e9952d4 Merge pull request #1432 from Emre Demir 2026-11-22 06:38:02 -05:00
aa2190bacb Trim comments 2026-11-22 12:29:31 +01:00
09ba78556a D3D12 device: host-like answers for meta commands, CheckDriverMatchingIdentifier and RemoveDevice
These ID3D12Device5 methods are on the 'not planned until the game's trace shows
them' list and were still generated E_NOTIMPL stubs. Answer them as D3D12 does on
a device without the feature (and as vkd3d-proton does):

- EnumerateMetaCommands: no meta commands (count 0, S_OK; null count E_INVALIDARG)
- EnumerateMetaCommandParameters / CreateMetaCommand: unknown command, E_INVALIDARG
- CheckDriverMatchingIdentifier: UNRECOGNIZED for serialized acceleration
  structures, UNSUPPORTED_TYPE for any other type
- RemoveDevice: GetDeviceRemovedReason reports DXGI_ERROR_DEVICE_REMOVED afterwards

Tested in d3d12_vulkan_device_test (RemoveDevice on a device of its own).
2026-11-22 12:26:23 +01:00
cee1ba5ac4 tests: accept a host that wraps GetResourceAllocationInfo totals past 2^64; ours stays saturated
compare_allocation_info required the host's answer for two totals that
overflow 2^64 (two 2^63 buffers; the largest buffer plus one). WARP and
the hosts of #1204 saturate at 0xFFFFFFFFFFFF0000, but the Intel Raptor
Lake-S (101.7092) and RTX 5060 Laptop (621.24) hosts on Windows
26300.9974 (D3D12Core 10.0.26100.9818) wrap, to 0 and 65536, while WARP
on the same PC saturates. d3d12_vulkan_device_test failed there on both
GPUs.

Ours is now pinned to the saturated answer, which can't make a caller
allocate less than one of its resources. A host whose total is below its
largest resource has wrapped and is reported, not compared. Any other
host answer is still a mismatch.
2026-11-22 14:14:21 +03:00
8163c74be5 Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts) 2026-11-22 00:52:00 -08:00
759087b51b Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
- register_samplers (main) and create_window_presenter (stack) both kept.
- Resource dtor: stack arena release + main deferred destroys.
- AS binding: main size/host_readable + stack console va.
- VulkanContext: main's lock split kept; stack arena/pipeline accessors
  moved to resource_mutex_ (execute copies replay_ under its shared lock),
  presenter lookups take it shared.
- README takes main wholesale; D3D-90 code and tests untouched.
2026-11-22 00:51:55 -08:00
9055393d88 Merge pull request #1204 from quackottu 2026-11-22 03:37:48 -05:00
15aa49c006 d3d12: GetResourceAllocationInfo follows the PC runtime's 4 KiB, totals and flag rules
4 KiB alignment now counts the 4 KiB tiles covering the top mip of one
slice (at most 16; a volume's depth counts), instead of fitting the whole
image in 64 KiB. Multi-resource totals round up to the largest alignment,
saturate instead of wrapping, and an empty query is {0, 1}. Simultaneous
access with depth-stencil or MSAA, and a depth-stencil volume, are refused.
All measured against the host runtime on an RTX 5070 and WARP.
2026-11-22 13:45:20 +05:30
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
36d073f79d Merge remote-tracking branch 'origin/main' into pr1083-merge-main
# Conflicts:
#	runtime/src/vulkan_backend.h
#	runtime/src/vulkan_replay.h
2026-11-21 23:26:25 -08:00
2933767eac Merge origin/main into d3d90-castable-placed (resolve #1083 conflicts)
Keep-both resolutions per #313's conflict analysis: main's ExecuteIndirect /
acceleration-structure / debug-marker / depth24 / node-mask features alongside
the stack's arena, compute and draw paths. Main's indirect and AS offsets gain
the arena's buffer_offset / heap_base compensation; AS resources on default
heaps get their GENERIC structure over the arena range. Reset clears
stencil_ref_set_ next to reset_state, and OMSetStencilRef sets it. README takes
main's (the crypto-token lines stay deleted).
2026-11-21 23:23:18 -08:00