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.
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.
The buffer branch only checked first/count and the texture branch never
looked at Width, Height, DepthOrArraySize or SampleDesc, turning a zero
extent into 1. The PC runtime gives the failure answer (every output all
ones) for these; measured on WARP, and @quackottu's subset on an NVIDIA GPU.
Buffers: Width 0, or any of Height, DepthOrArraySize, MipLevels, Format,
Layout, SampleDesc or Alignment other than its one valid value. Textures:
a zero extent, Count 0, or more than one sample outside a single-mip,
non-ROW_MAJOR 2D render target or depth stencil, or a count that is not a
power of two. Left unchecked because the host accepts them or adapters
differ: Flags on buffers, extra mips, 2D ROW_MAJOR, Quality at one sample,
extent limits, texture alignment, multisample quality and format support.
d3d12_vulkan_device_test: footprint_validity_cases() is compared with the
host runtime when there is one and checked on its own otherwise.
AI-assisted
#895's CBV/SRV/UAV views write placeholder tags (1, 2, 3) into the descriptor heap, and its new check in
d3d12_vulkan_device_test expects an SRV's first dword to be 2. main's SRVs are GFX10 T# words (D3D-72 and the
descriptor table), so the device test failed at line 2211. The PR needs a rebase onto main's descriptor model.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NumFeatureLevels 0 returned DXGI_ERROR_UNSUPPORTED, and a null
pFeatureLevelsRequested with a count was read. The host D3D12 runtime
(NVIDIA and WARP) returns E_INVALIDARG for both. When no requested level
is supported the host also writes MaxSupportedFeatureLevel 0 next to
DXGI_ERROR_UNSUPPORTED; the layer left the field as it was.
compare_options1 created the host D3D12 device on the default adapter. On a PC with an AMD
iGPU and an NVIDIA card, a run on the AMD (VK_LOADER_DRIVERS_SELECT=*amd*) compared its 32..64
lanes with the NVIDIA's 32..32 and failed (WaveLaneCountMax: ours 64, host 32). It now uses
create_host_device_for_physical, like compare_feature_options: LUID, then PCI ids, then the
default adapter as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The occlusion-query block from #858 declared a D3D12_QUERY_HEAP_DESC
named heap_desc inside the function that already has a
D3D12_DESCRIPTOR_HEAP_DESC heap_desc (line 2107), and MSVC /W4 warned
C4456. Rename it to query_heap_desc.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#850 moved the waits to a counter, but the 1D-texture block still signalled 8 and #858's predication block
12/13. Once the counter had passed those values, SetEventOnCompletion returned at once and the blocks read results
the GPU had not written yet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CheckFeatureSupport already reported TEXTURE1D, but CreateCommittedResource
rejected the dimension. Create 1D images with a height-one extent, reject
non-unit heights and attachment flags, and teach GetCopyableFootprints and
GetResourceAllocationInfo the 1D shape. The device test now uploads and reads
back a 1D texture and a layer of a 1D array, and compares allocation and
footprint results with the PC runtime.
D3D12_RESOURCE_STATE_PREDICATION is the same bit as INDIRECT_ARGUMENT
(and SYNC/ACCESS_PREDICATION the same as EXECUTE_INDIRECT /
INDIRECT_ARGUMENT), and the layer mapped that bit only to
INDIRECT_COMMAND_READ at DRAW_INDIRECT. vkCmdBeginConditionalRenderingEXT
reads the predicate with CONDITIONAL_RENDERING_READ at the
CONDITIONAL_RENDERING stage, so ResolveQueryData -> COPY_DEST to
PREDICATION barrier -> SetPredication had no dependency from the copy's
write to the predicate read (and none the other way before the next
resolve).
With the extension enabled (the only case those flags are valid),
vulkan_access and vulkan_barrier_scope now add the conditional-rendering
access and stage for that bit; GENERIC_READ, which contains it, gets
them too. The replay passes the flag from its conditional-rendering
entry points.
d3d12_vulkan_device_test now enables conditional rendering on its device
and runs an occlusion query resolved into a predicate: EQUAL_ZERO skips a
clear, NOT_EQUAL_ZERO runs one, and the predicate is resolved into again
after the read, once through legacy barriers and once through enhanced
buffer barriers. d3d12_state_map_test checks both mappings with and
without the extension.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
loader_test: the probe for security software that holds newly written
images also stops when writing and reading one back averages over
25 ms. Under Wine there is no such software and its file I/O alone took
38-40 ms in the wine job, so there only the refusals and contents are
checked.
The host comparisons move from d3d12_vulkan_device_test's
create_host_device to copycmp::create_host, so the copy comparisons are
skipped under Wine too (with them, winevulkan asserted in
vkBindBufferMemory).
A reused or lower fence value makes SetEventOnCompletion return at once, so a
block read results the GPU had not written yet (#278 hit this twice after
rebases). Every wait on the main fence now goes through submit_and_wait, which
signals the next value and waits for it, including the query blocks that landed
with 10 and 11. Fences that belong to one block (ms_fence, the standalone
device's) keep their own values.
Its host comparisons take Microsoft's d3d12.dll as the reference. Wine's
(vkd3d) lays out depth-stencil formats in one plane, rejects R9G9B9E5
and BC footprints and accepts descriptions Microsoft's runtime refuses,
so under Wine (ntdll exports wine_get_version) create_host_device
answers as when there is no host device: each comparison is printed as
skipped. Windows compares as before.
Main's depth-plane SRV T# code follows the texture's backing format (X24_8_32_FLOAT
where D24 is stored as D32), so the override from f9addf5 is dropped and the
D24 comparison test expects the backing format's code. The family refusal and
bind_image are main's.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The query fell through to E_INVALIDARG. It now reports the Vulkan physical
device's subgroup operations and wave-size range, with TotalLaneCount held to
one full wave because Vulkan has no device-wide lane count.
Map XR_BIAS to the bit-compatible A2B10G10R10 UNORM Vulkan format, report only the 2D and cast-within-bit-layout support the layer provides, and refuse the mip, MSAA and 3D cases the PC runtime refuses. Test creation, allocation, footprints and the resource-method variants.
CreateQueryHeap makes one VkQueryPool per heap: occlusion (OCCLUSION and
BINARY_OCCLUSION queries), timestamp and copy-queue timestamp, and pipeline
statistics (all eleven Vulkan counters, whose order is the field order of
D3D12_QUERY_DATA_PIPELINE_STATISTICS). Other heap types are logged and
refused with E_NOTIMPL.
BeginQuery, EndQuery and ResolveQueryData are recorded in the command-list
IR with D3D12's rules for the calls, and replayed as vkCmdResetQueryPool +
vkCmdBeginQuery/vkCmdEndQuery, vkCmdWriteTimestamp at BOTTOM_OF_PIPE and
vkCmdCopyQueryPoolResults (64-bit, WAIT). Heap types, index ranges and the
destination buffer are checked before anything is written. A query that was
never ended resolves to zeros instead of stalling the GPU on WAIT_BIT.
GetTimestampFrequency is 1e9 / timestampPeriod. The devices enable
occlusionQueryPrecise and pipelineStatisticsQuery where the GPU has them.
Overlapping queries of one kind (valid D3D12, one active query per type in
Vulkan) are refused as unsupported, and binary occlusion is not clamped to
0/1 yet; both are written down in docs/d3d12_vulkan.md section 4.6.
Tested on an RTX 5070 (driver 621.01) under VK_LAYER_KHRONOS_validation.
AI-assisted (Claude Code).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Windows 10's d3d12.dll refuses shader models 6.7-6.9 and root signature 1.2 with E_INVALIDARG, where a newer runtime clamps them, so the SHADER_MODEL / ROOT_SIGNATURE comparison from #704 counted 4 mismatches on every Windows 10 machine. A request above the highest one the host answered is now checked against the layer's own clamp (S_OK, 6.0 / 1.1) instead, and the count is printed.
Upload-heap buffers asked for HOST_VISIBLE | HOST_COHERENT memory only, so the GPU read every vertex, index and
constant buffer a game uploads over PCIe from system memory. They now prefer DEVICE_LOCAL | HOST_VISIBLE |
HOST_COHERENT when the device has Resizable BAR: such a type in a device-local heap larger than the 256 MiB BAR
window (leonida::resizable_bar, runtime/src/vulkan_memory.h). Without Resizable BAR that type is a window of
256 MiB or less that every upload buffer would share, so they stay in system memory there. A full VRAM heap falls
back to system memory through DeviceState::allocate's existing order.
The device logs where upload heaps live, LEONIDA_UPLOAD_SYSMEM=1 keeps them in system memory for comparison, and
vulkan_memory_flags / device_upload_in_vram report the choice to tests. d3d12_state_map_test checks the detection
on the heap layouts of an RTX 5060 Ti with Resizable BAR, an RTX 3090 without it, a 256 MiB window and an
integrated GPU; d3d12_vulkan_device_test checks that its upload buffer is placed accordingly, and its GPU copies
then read that buffer in both placements.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeps both sides; the discard emit now passes the binding to image_barrier
as main's version takes it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A region with NumSubresources = UINT_MAX was recorded like a null region and
skipped the FirstSubresource check. DiscardResource now has a whole flag;
explicit ranges are checked in 64-bit at recording and replay. Tests at the
UINT_MAX boundary in command_list_test, part F and the COM device test.
Found by matheuskshn in review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>