Commit Graph

88 Commits

Author SHA1 Message Date
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
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
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
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
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
69cb90ca32 Merge pull request #683 from Rafael 2026-11-21 21:08:40 -05:00
d8b3fd73ec Merge pull request #657 from dcastell1 2026-11-21 21:08:35 -05:00
460d23c335 Merge pull request #654 from AlxcBTW 2026-11-21 21:08:34 -05:00
36da56b1d9 Merge pull request #610 from AlxcBTW 2026-11-21 21:08:32 -05:00
6e1e5c5ce0 Refresh B5G5R5A1 sampling coverage after RGB9E5 support merged 2026-11-21 23:07:59 -03:00
527e41c2d3 Runtime: report DXGI format plane counts through CheckFeatureSupport 2026-11-22 02:06:26 +00:00
12f1dc5a48 runtime: depth-stencil views of a multisample texture array's slice range (D3D-79 part 1)
CreateDepthStencilView refused D3D12_DSV_DIMENSION_TEXTURE2DMSARRAY, so the descriptor held an
empty TargetView and any clear through it failed when the list was recorded. Multisample textures
have one mip, so the view is {resource, mip 0, FirstArraySlice, ArraySize}; the replay already
checks the range against the image and clears through a view of those layers.

d3d12_vulkan_device_test: a 4-layer 4x multisampled D32 texture, a view of slices 1-2 captures
that range and its clear replays; a view of slices 3-4 is refused at execute
(invalid_subresource). D3D12 can't copy a multisampled texture to a buffer, so the cleared
values are not read back. Without the change the test fails at the captured-range check.

docs/d3d12_vulkan.md: drop the duplicated RTV/DSV bullet and list the new dimension. The 1D and
1D-array DSVs need 1D textures first (D3D-63, #561).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 22:51:42 -03:00
ed7e1ead05 D3D-61: keep alpha-only texture sampling distinct from R8 2026-11-21 22:44:35 -03:00
99f6f0b40a test(runtime): register d3d12_vulkan_device_test with CTest
The test was built but only run by hand, so GPU-specific failures (for
example the AMD GetResourceTiling one) never showed up in ctest. Return
77 when no Vulkan device can be created and register the test with
SKIP_RETURN_CODE 77 so CI reports it as skipped rather than failed.
2026-11-22 02:38:54 +01:00
fa7f38b45f Merge pull request #587 from Vonsek 2026-11-21 20:38:54 -05:00
ad1150a4be Test: d3d12_vulkan_device_test compares only what D3D12 fixes about GetResourceTiling, sample counts and null-rect resolves
The tiling comparison required the same standard/packed mip split as the host. D3D11.3 functional spec 5.9.2.8.5
(D3D12_PACKED_MIP_INFO) only requires that a mip filling a tile in every dimension stays standard; a smaller mip
"may or may not be packed, depending on the IHV". Measured on one laptop: an RTX 5070 packs from the first mip
below the tile (as the layer does), a Radeon 880M keeps one or two more standard, WARP packs nothing. The test
failed with 24 mismatches on an AMD or WARP host. It now checks the tile shape, that no mip filling a tile is
packed (layer and host), and the tile counts of the mips both sides keep standard; the split itself is printed.

With that fixed, the same test failed further down on those hosts for host-specific answers:
- depth/colour sample counts a software host (WARP, 16x) offers but the Vulkan GPU's limits lack are skipped;
- a null source rectangle in ResolveSubresourceRegion is the whole source; the Radeon 880M and WARP do not resolve
  it that way, so where a host disagrees with its own whole-source rectangle the layer is held to that result.

The host is picked with LEONIDA_HOST_ADAPTER through d3d12_copy_compare.h (D3D-46).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:37:32 +01:00
4c5ce1a945 Merge remote-tracking branch 'origin/main' into tiling-host-split
# Conflicts:
#	docs/d3d12_vulkan.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/vulkan_replay.h
2026-11-22 02:35:17 +01:00
e40bd6563e Merge main into D3D-26: predication and reserved resources on main
main added SetPredication (D3D-18) and reserved resources; both sides are
kept. The predication replay test took part E, so the D3D-26 test is now
part F. An atomic copy recorded under a predicate is counted with the
other copies that Vulkan's conditional rendering cannot skip, and
SetPredication, DiscardResource and the atomic copies are all refused in
a bundle.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 01:29:19 +00:00
0175e92e61 Merge the rebased RGB9E5 dependency and preserve border sampler checks 2026-11-21 22:23:59 -03:00
fc7e0a11ec Merge remote-tracking branch 'upstream/main' into codex/bgr565-readback
# Conflicts:
#	runtime/test/d3d12_vulkan_device_test.cpp
2026-11-22 02:20:43 +01:00
f5f4cb03f7 Merge remote-tracking branch 'upstream/main' into codex/rgb9e5-texture
# Conflicts:
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/vulkan_replay.h
#	runtime/test/d3d12_descriptor_test.cpp
2026-11-22 02:20:43 +01:00
008560e49d Support B5G5R5A1 sampled textures and two-byte footprints 2026-11-21 22:11:47 -03:00
df0cc483c2 Merge remote-tracking branch 'origin/main' into d3d-46-copy-compare
# Conflicts:
#	runtime/test/d3d12_vulkan_device_test.cpp
2026-11-22 02:11:00 +01:00
2f230bec47 Merge pull request #600 from adriaespii 2026-11-21 20:09:30 -05:00
8493b28604 Merge pull request #493 from Andrea 2026-11-21 20:09:14 -05:00