Commit Graph

311 Commits

Author SHA1 Message Date
67bb661453 Merge pull request #850 from sanuk369 2026-11-21 23:15:33 -05:00
a03a3db26b Merge pull request #737 from AlxcBTW 2026-11-21 23:15:27 -05:00
8d8c528aa1 Merge pull request #561 from Ayinaki 2026-11-21 23:15:23 -05:00
059b9f325f Runtime: CreateHeap and CreatePlacedResource on the Vulkan layer 2026-11-22 05:04:53 +01:00
c7d5f8e8a4 d3d12: create 1D textures and 1D arrays
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.
2026-11-22 03:55:49 +00:00
d868cba00f Runtime: barriers into PREDICATION cover conditional rendering's read
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>
2026-11-21 21:55:19 -06:00
6ba626606b tests: loader's scan probe and the D3D12 host comparisons under Wine
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).
2026-11-22 03:55:16 +00:00
fbb991e90d Tests: one fence helper in d3d12_vulkan_device_test instead of hand-picked values
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.
2026-11-22 09:20:25 +05:30
4c0faa7693 Merge pull request #739 from Ayinaki
# Conflicts:
#	docs/d3d12_vulkan.md
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-21 22:49:20 -05:00
749c1ae46c Merge pull request #745 from Ayinaki
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
2026-11-21 22:48:53 -05:00
55d02a5861 Merge origin/main into d24-on-d32
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:48:46 +01:00
1f50ec3ba5 tests: d3d12_vulkan_device has no host to compare with under Wine
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.
2026-11-22 03:46:44 +00:00
0db0d72dc7 Merge origin/main into d24-on-d32; follow main's depth-plane T# rule (D3D-75)
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>
2026-11-22 04:45:53 +01:00
783a491deb Answer wave ops and lane counts in D3D12_OPTIONS1
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.
2026-11-22 03:39:25 +00:00
ab1ff9f9c5 Support R10G10B10_XR_BIAS_A2_UNORM textures
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.
2026-11-22 03:39:24 +00:00
37e7f789e9 Merge pull request #816 from Proudnoob4 2026-11-21 22:37:48 -05:00
2474686591 Merge pull request #815 from Felix Croasdale 2026-11-21 22:37:48 -05:00
0b79afb666 Merge pull request #706 from cemalyakla
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:37:40 -05:00
afda786c2c Merge pull request #674 from VictorJulianiR
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:37:39 -05:00
7079108182 Runtime: query heaps on Vulkan (D3D-15)
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>
2026-11-21 21:30:47 -06:00
370b042430 d3d12_vulkan_device_test: check requests the host runtime predates against the layer's clamp
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.
2026-11-21 22:27:04 -05:00
039df7d24f Runtime: upload heaps in Resizable BAR memory when the GPU has it (D3D-96)
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>
2026-11-21 21:26:20 -06:00
0251789a8b Merge remote-tracking branch 'origin/main' into d24-on-d32
# Conflicts:
#	runtime/src/vulkan_backend.h
2026-11-22 04:10:13 +01:00
a297365e38 Merge pull request #775 from JavierBlanco23
# Conflicts:
#	docs/d3d12_vulkan.md
2026-11-21 22:09:05 -05:00
316e2773f7 Merge pull request #715 from Vonsek 2026-11-21 22:08:19 -05:00
d549d2d117 Merge pull request #417 from kotorvr 2026-11-21 22:07:52 -05:00
4859a809b3 chore(merge): integrate current Vulkan descriptor tests
Keep the upstream 3D texture uploads alongside the unaligned BC sample and preserve the expanded feature-query documentation.
2026-11-22 04:06:58 +01:00
e9a8203d45 Merge main and preserve volume views and HRESULT tracing in A8 coverage 2026-11-22 00:06:32 -03:00
d5e00415f6 D3D-86: answer CheckFeatureSupport OPTIONS2-5, 7, 9, 11, 13-16, 18-21 2026-11-22 04:00:58 +01:00
96404ac97a Merge main into D3D-26: unordered-access clears on main
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>
2026-11-22 02:58:23 +00:00
c7e450fc69 D3D-26: keep a null discard region apart from an explicit UINT_MAX count
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>
2026-11-22 02:55:44 +00:00
94c786411c Merge pull request #757 from VictorJulianiR 2026-11-21 21:38:01 -05:00
69ed76dad0 Merge pull request #754 from Rafael 2026-11-21 21:37:59 -05:00
dcb2e8ecf1 Merge pull request #748 from Vonsek 2026-11-21 21:37:58 -05:00
18edaeba25 Merge pull request #717 from Dea7hsmiles 2026-11-21 21:37:51 -05:00
ce8c10a572 Merge pull request #704 from Ayinaki 2026-11-21 21:37:49 -05:00
e4d72347d7 Answer 5.1 to a shader model request that asks for it
D3D12's baseline is 5.1, and both WARP and the RTX 5070 runtime answer a 5.1 request with S_OK and 5.1; the layer
refused everything below 6.0, so a caller asking for the minimum got E_INVALIDARG. The host comparison now covers
5.1, the test pins it, and the docs record both measurements.
2026-11-22 02:36:35 +00:00
276a9e9d37 runtime: render-target views of a multisample texture array's slice range
CreateRenderTargetView refused D3D12_RTV_DIMENSION_TEXTURE2DMSARRAY, so after the DSV change in
#683 a multisample array could be a depth target but not a colour target (found by @Derpbeat on
#683). The view is {resource, mip 0, FirstArraySlice, ArraySize}, as for the DSV; the replay
already checks the range and clears through a view of those layers.

d3d12_vulkan_device_test: a 4-layer 4x RGBA8 target is cleared red through a whole-array view and
green through a view of slices 1-2; every slice is resolved and read back, so slices 0 and 3 must
stay red and 1-2 green. A view of slices 3-4 is refused at execute (invalid_subresource). Without
the change the test fails at the captured-range check.

docs/d3d12_vulkan.md: the RTV/DSV bullet lists TEXTURE2DMSARRAY for both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 23:31:00 -03:00
89bf640040 fix(runtime): check image capabilities before texture creation
Single-sampled attachments and storage images could bypass the device's format limits. Use the same query for allocation info and committed creation so unsupported requests get the same answer before Vulkan allocates an image.
2026-11-22 03:29:48 +01:00
0592ad83ce Keep Vulkan test initialization failures visible in CTest 2026-11-21 23:29:23 -03:00
be283d10fc Merge main and preserve stencil and depth views alongside A8 sampled textures 2026-11-21 23:29:03 -03:00
5e55015def Merge main and verify B5G5R5A1 packed sampling and native footprints 2026-11-21 23:28:57 -03:00
24c6e9af45 Drop a wrong item ID from the D24 comments and docs (D3D-47 is the resolve comparison)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:26:24 +01:00
2e23f95471 tests: keep d3d12_vulkan_device_test running on Windows 10 (TEST-97)
Windows 10's host D3D12 runtime cannot answer unaligned block-compressed GetCopyableFootprints cases (no D3D12_OPTIONS8.UnalignedBlockTexturesSupported) and has no ID3D12GraphicsCommandList7 for ResolveSubresourceRegion. Both comparisons failed before the device checks, so a Windows 10 run stopped at line 1061/1080.

Skip unaligned BC footprint cases when the host lacks the option, and compare only the full ResolveSubresource form when the host list has no list7. The full form still covers every supported format and sample count, and a self-check covers the classification used by the footprint skip.
2026-11-21 18:23:46 -08:00
40bb5e76ce Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	runtime/src/vulkan_replay.h
2026-11-22 03:20:16 +01:00
6910e1cfef Merge origin/main into d3d-47-d24-emulation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:17:17 +01:00
00fef11ad2 fix(runtime): report unaligned BC texture support
The Vulkan path can sample a top-level mip with partial edge blocks, but callers querying OPTIONS8 receive E_INVALIDARG. Report the logical device's enabled BC feature so callers can select the matching upload path.
2026-11-22 03:16:34 +01:00
0e63a76da0 D24 conversion: predication, large copies, tests, spec note (review)
- A dispatch honours conditional rendering and the layer's copies do not, so a
  SetPredication that skips copies also skipped the D24 conversion while the
  copy ran. Conditional rendering is ended around the dispatch and begun
  again; a test runs an upload and readback under a skipping predicate and
  compares with the host's unpredicated run (it fails without the fix).
- A copy larger than maxStorageBufferRange (queried; 128 MiB assumed if not)
  is split into dispatches by slices, or by rows of one slice; the descriptors
  bind 256-byte-aligned windows of both buffers. depth24_convert_test splits
  the 4096x4096 copy with a 1 MiB range and a pitched one with a 1 KiB range.
- make_pipeline destroys the layouts it made when a later step fails.
- depth24_convert_test is in the CI tool list; the docs say which GPU each test
  exercises.
- R24G8_TYPELESS with a typed D24 DSV is compared with the host. SRVs of
  R24_UNORM_X8_TYPELESS and X24_TYPELESS_G8_UINT are an empty slot in the
  layer (no format mapping; stencil-plane views refused): reported by the
  test and documented as a known gap.
- depth24.h: the D3D11.3 spec's FLOAT -> UNORM wording (3.2.3.6, 3.2.2) next to
  what WARP and AMD were measured to do; "159" is 5215.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:15:13 +01:00
21126810d6 Answer shader model and root signature feature queries
CheckFeatureSupport fell through to E_INVALIDARG for
D3D12_FEATURE_SHADER_MODEL and D3D12_FEATURE_ROOT_SIGNATURE, so a game
asking either got an error where the PC runtime answers. Report DXIL 1.0
and root signature 1.1, the versions this layer can honour rather than
the driver's maximum, clamp higher requests down, and refuse an undefined
value, a wrong DataSize and a null buffer, as the host runtime does.
2026-11-22 02:11:18 +00:00
3dde44ecb2 Merge current main and isolate the A8 and R8 view descriptors 2026-11-21 23:09:05 -03:00