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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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).
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.
- 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.