Commit Graph

4163 Commits

Author SHA1 Message Date
8b23fa2732 Runtime: GetPrivateData returns the needed size with DXGI_ERROR_MORE_DATA
A buffer too small for an entry now gets the size to retry with, for byte
and interface entries alike, as vkd3d-proton's private store does. The
test retries with the returned size for both kinds. Review on #419.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:55:00 +00:00
0e59c75b7b Runtime: GameInput shim on SDL3 (any controller; DualSense trigger effects, lightbar)
GameInputCreate and the v0 IGameInput/IGameInputDevice/IGameInputReading/IGameInputDispatcher surface a title uses
for gamepads, served from SDL3 gamepads so DualSense, DualShock 4, Switch Pro and Xbox pads all work. Rumble goes to
SDL_RumbleGamepad, impulse-trigger rumble to SDL_RumbleGamepadTriggers, and on a DualSense to adaptive-trigger effects
through SDL_SendGamepadEffect (LEONIDA_DS_TRIGGERS=off|rumble|resistance). Lightbar via LEONIDA_DS_LIGHTBAR.

SDL3 (zlib) comes from an installed package or a pinned, hash-checked release tarball via FetchContent;
-DLEONIDA_SDL3=OFF skips the shim. gameinput_test covers the shim on SDL virtual joysticks; gameinput_probe is the
manual check on a real pad. docs/gameinput.md has the mapping, settings and VERIFY list.

AI-assisted (Claude Code).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 02:54:55 +00:00
74c71672c0 fix: reject shader views on textures that deny shader access
Depth-stencil attachments can opt out of sampling while remaining valid resources. Leave a reused descriptor null before any view is encoded or registered.
2026-11-22 03:54:16 +01:00
ff354a556b Report and exercise A8 texture mip support 2026-11-21 23:51:24 -03:00
e36f74fc8a Name the per-format texture locals without shadowing the RGB9E5 fixture 2026-11-21 23:49:42 -03:00
50bf02723d Keep multisample test descriptors separate from volume views 2026-11-22 02:49:14 +00:00
9f755a30fa Runtime: depth-plane SRVs only on their own depth family (#678 follow-up)
#678 (D3D-84) took R24_UNORM_X8_TYPELESS and R32_FLOAT_X8X24_TYPELESS on any
texture with a depth aspect, so the other family's view (an X8X24 view of an
R24G8 texture, or the reverse) got a live descriptor of the texture's own
depth format. D3D12 refuses both. Each depth view format now belongs to its
own DXGI family only (R24G8_TYPELESS / D24_UNORM_S8_UINT, R32G8X24_TYPELESS /
D32_FLOAT_S8X24_UINT), checked on the resource's DXGI format, so a D24
texture backed by D32_SFLOAT_S8_UINT still takes the R24 view. The other
family's view falls through to the existing "view format not supported"
path and leaves the slot null.

d3d12_descriptor_test checks both cross pairs give a null descriptor, and
takes the expected depth T# from the texture's backing: a GPU without a
usable D24 (the layer's depth_usable rule) backs R24G8 with
D32_SFLOAT_S8_UINT, where the old expectation of 8_24_UNORM failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 20:42:28 -06:00
5879d22055 Merge remote-tracking branch 'origin/main' into shader-36-gather-wrap
# Conflicts:
#	scripts/run_gpu_tests.py
#	tests/test_shader_checks.py
2026-11-22 03:41:57 +01:00
875aecb46e Merge remote-tracking branch 'origin/main' into bpw32-main
# Conflicts:
#	docs/design.md
#	runtime/test/shaders/check.py
#	scripts/run_gpu_tests.py
#	tests/test_run_gpu_tests.py
2026-11-22 03:38:09 +01:00
a9c9257df9 Merge pull request #758 from VictorJulianiR 2026-11-21 21:38:01 -05: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
1511d2bff2 Merge pull request #747 from Ayoze Torres 2026-11-21 21:37:57 -05:00
1242d7b861 Merge pull request #741 from totonii 2026-11-21 21:37:56 -05:00
35b0026581 Merge pull request #734 from omardev29 2026-11-21 21:37:54 -05:00
2b905ef651 Runtime: PE loader applies HIGHLOW (32-bit) base relocations
Loader::load threw "unsupported relocation type 3" on
IMAGE_REL_BASED_HIGHLOW, which the x64 Windows loader applies: 32-bit
absolute addresses, as /LARGEADDRESSAWARE:NO code has. They are now
moved by the delta like DIR64 ones. Where the moved address no longer
fits in 32 bits, Windows would truncate it; the loader refuses the image
with "a 32-bit (HIGHLOW) relocation does not fit at this base" instead.
Other 32-bit forms (HIGH, LOW, HIGHADJ) stay unsupported.

test_pe_loader_bounds.cpp was never built: it had no CMake target. It
now has one and runs under ctest as pe_loader_bounds (its existing 37
checks pass as they are). Five new checks build an image with a HIGHLOW
entry: the dword moves by exactly the delta, an address past 4 GiB is
refused, and HIGH is still rejected by name. Against the old loader,
three of them fail with "unsupported relocation type 3".
2026-11-22 02:37:52 +00:00
e4081f29c0 Merge pull request #721 from Proudnoob4 2026-11-21 21:37:52 -05:00
18edaeba25 Merge pull request #717 from Dea7hsmiles 2026-11-21 21:37:51 -05:00
fcd51e74ba Merge pull request #708 from Spaghetih 2026-11-21 21:37:50 -05:00
ce8c10a572 Merge pull request #704 from Ayinaki 2026-11-21 21:37:49 -05:00
51a5c3ee3b Merge pull request #701 from mohamedsaad.lahlou 2026-11-21 21:37:48 -05:00
6cb0facab2 Merge pull request #696 from SuarezPM 2026-11-21 21:37:48 -05:00
28e2991a8c Merge pull request #672 from Vonsek 2026-11-21 21:37:46 -05:00
4e0cfc3637 Merge pull request #617 from VictorJulianiR 2026-11-21 21:37:46 -05:00
1df0045b5c Merge pull request #500 from troythedecoyx 2026-11-21 21:37:44 -05:00
fcea57d5d9 Merge pull request #455 from fearkov 2026-11-21 21:37:44 -05:00
48f2164427 Merge pull request #399 from fearkov 2026-11-21 21:37:44 -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
88dc8beac1 Runtime: bind multisampled 2D and array shader-resource views 2026-11-22 02:34:09 +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
94616fef20 test: cover a volume that denies shader access
Exercise the null descriptor when the layer accepts a transfer-only volume and allow a resource-creation rejection consistent with the host runtime.
2026-11-22 03:30:53 +01:00
e6eaecd05a Runtime: the descriptor table lives in device-local memory (D3D-76)
AI-assisted. Set 0 binding 2 is the table every T#/S# lookup probes.
BindlessSet allocated it HOST_VISIBLE | HOST_COHERENT and flush() memcpy'd into
the mapping, so a divergent lookup read it over PCIe: 19.5x slower for T#+S#
pairs and 46.2x for a divergent miss at 100k entries on an RTX 2060 SUPER
(vk_descriptor_bench, #639; 58-796x on the 5080).

The table now lives in DEVICE_LOCAL (HOST_VISIBLE kept as a fallback for a device
without it). flush() takes the command buffer that will use the set and uploads
only what changed: the whole table from a mapped staging buffer when the buffers
were just created (first use or growth), and the changed slots with
vkCmdUpdateBuffer otherwise, which copies the data into the command buffer while
recording so no staging bytes are read at execution. A TRANSFER_WRITE ->
SHADER_READ barrier follows, before the draws. DescriptorTable tracks the slots
that insert, replace, erase, clear and grow touched, including both slots of a
relocation, so a flush no longer rebuilds an 80 MiB table for one descriptor.

A command buffer whose vkQueueSubmit is rejected never runs the upload, so the
set keeps the obligation: VulkanQueue::execute reports the submit result through
a commit callback, and the set rebuilds the table on the next flush, which also
reports flush_needs_idle() and makes the device wait before it. The same wait now
honours the pre-existing contract for replaced/erased entries and for growth
(the device ignored flush_needs_idle() before), and frees the retired buffers
once the queue is idle instead of at teardown.

Verified on an NVIDIA RTX 2060 SUPER, Linux 620.73.04, Vulkan 1.4.357:
- ctest 10/10, including descriptor_table cases for the change list, relocation
  marking and consume-once reads.
- vk_bindless_test with LEONIDA_VK_VALIDATION=1: 14 draws (probe depth, erase,
  relocation, growth 64 -> 512 slots, rebind, failed-submit retry, other view,
  removal) read back exact, table in device-local memory in both
  descriptor-indexing configurations. With the retry disabled the test is red.
- GPU suite 64/91 with the same 27 64-wide skips as main, 0 failures; 91/91 with
  LEONIDA_W64_EMULATE=1.

No game data; synthetic fixtures only.
2026-11-21 23:30:46 -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
ece8aab506 Benchmark: report unavailable descriptor lookup timings 2026-11-21 23:29:39 -03:00
14668c62d8 Runtime: RTS0 descriptor ranges read Flags before the table offset
parse_rts0 read 1.1/1.2 descriptor-range records with Flags and
OffsetInDescriptorsFromTableStart swapped (offset at +16, flags at +20).
The PC serializer writes D3D12_DESCRIPTOR_RANGE1 order: type, count, base
register, space, Flags, then the offset. Both values were discarded, so
nothing broke yet, but the descriptor-table layout would have read flags as
offsets.

DescriptorRange now keeps all six fields; the canonical codec stores them
(codec version 2; nothing persists version 1 blobs). The hand-built 1.1
fixture in root_signature_test had the same swap and is corrected; a 1.0
fixture is added, and root_signature_oracle_test checks every range field
against the host serializer for 1.0, 1.1 and 1.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 12:29:35 +10: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
2748b0f6bb D24 clears quantised on the native path too; host ties logged as a quirk
- A depth clear of any D24 texture, native D24 or stored as D32, now clears with
  depth24_to_float(depth24_quantize(v)), an exact 24-bit value, so no driver's
  tie rounding is left and NVIDIA's native D24 matches WARP and AMD.
- d3d12_depth24_compare.h checks the layer's clears against the reference
  (depth24_quantize, stencil value) and fails on a difference; the host is
  compared byte for byte only when it agrees with the reference, otherwise
  the difference is logged as a host quirk (NVIDIA's D3D12 rounds some ties
  the other way: 478 of 5215 values).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 03:25:35 +01:00
42e0b56c8d runtime: keep the loader off the default EXE base; loader_tls copies with CopyFileW
Under Wine the host EXE stays at its preferred base, so gta6rt and
loader_test at 0x140000000 took the address a mapped EXE without
relocations needs (loader_test: "preferred base is taken"). Link them at
0x10000000000; Windows relocates them with ASLR either way.

loader_tls_test copied its fixture with std::filesystem::copy_file,
which MSVC implements with CopyFile2, missing from Wine 9.
2026-11-22 02:25:15 +00:00
13cae9c949 chore: merge upstream descriptor plane coverage
Preserve the new plane views and packed-format tests alongside volume sampling so they run in the same descriptor fixture.
2026-11-22 03:24:54 +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
e3794131b6 docs/runtime: XDXR BATCHED_DESC2 and XDXR_STREAM_DESC layouts from XboxBvhBuilder.dll (open question 8)
Recovered from the package DLL's own reads (field accesses, element strides,
the standard-build and prebuild wrappers that construct a BATCHED_DESC2):
BATCHED_DESC2 is the public build desc, the postbuild count and pointer and
a 16-byte XDXR_STREAM_DESC (0x50 bytes); the stream desc is a size and a
pointer to 16-byte typed records, whose offsets, value types, defaults and
lookup rule are measured. The DLL rejects the offline-statistics postbuild
type for every build, so that layout is not in the package.

docs/xdxr.md has the evidence per field (RVAs only, nothing quoted from the
DLL). runtime/src/xdxr_descs.h defines the structs with static_asserts and
the DLL's stream lookup and flag defaults; xdxr_descs_test checks them and,
with a DXR d3d12.h, the public part against the SDK.
2026-11-22 03:23:37 +01:00
398f5b06bd Merge current main into the D3D12 trace branch 2026-11-22 03:22:44 +01:00
40bb5e76ce Merge remote-tracking branch 'origin/main' into HEAD
# Conflicts:
#	runtime/src/vulkan_replay.h
2026-11-22 03:20:16 +01:00
3dce6425c7 bvh_builder_test: skip with a reason when the host D3D12 device has no ID3D12Device11 (#688)
The proxy answers ID3D12Device11 with a QueryInterface on the host device. The Windows 10 runtime without the Agility SDK stops before ID3D12Device11, on hardware and WARP alike, so the test failed on every Windows 10 machine with a game copy before the DLL made a call. It now prints SKIP with the reason there, as root_sig does since #597; LEONIDA_BVH_DEVICE=vulkan still runs.
2026-11-21 21:19:16 -05: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