Commit Graph

4696 Commits

Author SHA1 Message Date
97430d6cbc Register the opt-in guest scene CTest for Wine cross-builds 2026-11-23 19:52:11 +00:00
7fc6fa7285 runtime: opt-in compat-module directory (LEONIDA_COMPAT_DIR)
When LEONIDA_COMPAT_DIR names a folder, an import whose DLL is a file
there binds to that DLL's export. Windows loads it from the full path
(LoadLibraryExW, DLL-load-dir + System32 search, never the game folder),
so it takes no manual static-TLS slot. The step comes before shims,
bundled modules and the host, and the DLL owns all imports of its
module: a missing symbol binds to the unimplemented thunk, not a shim.
Unset or empty: no change.

Measured on the 1.0.2.1 executable: --dry-run goes from 20 unimplemented
imports (AcpHal 9, chad 5, xapu 5, XCRDAPI 1) to 0 with the four
matching omonkeyz/xbox-emulator crates in the folder (and their
TOMBOX_* static initializers turned off; see runtime/README.md).

loader_test: five cases with a synthetic OS-loadable DLL (no game data).

AI-assisted (Claude Code).
2026-11-23 20:51:59 +01:00
b95925cbfc d3d12_xs: verify DXBC total_size and incoming checksum before re-signing RTS0 blobs 2026-11-23 20:51:51 +01:00
9c4c5f92a8 tests: GPU fixture cs_imgload_tfe for the tfe status VGPR on image_load (SHADER-1266)
No GPU fixture set tfe or lwe, so run_gpu_tests.py never reached the
status write a SHADER-1266 fix adds. cs_imgload_tfe is cs_imgload with
tfe on both image_loads: each status VGPR is seeded with 1000 and added
into the stored sum, so a stale status moves every texel by 2000 while a
correct one (0, every texel resident) gives cs_imgload's result, checked
by vk_store_test's unchanged load mode.

Registered next to cs_imgload in check.py and run_gpu_tests.py, and in
the two unit tests that list the vk_store_test fixtures. Red on main
until a SHADER-1266 fix lands; green with #8771's change on an RTX 4060.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:51:28 -03:00
d2f328e560 d3d12: only the title's memory gets a copy; the table scan covers the declared slots and is timed
The xmem shims record what they hand the title (XMemAlloc, XMemAllocDefault,
XMemVirtualAlloc, the title's VirtualAlloc); an address outside those ranges
is left as it was and counted. The submit-time scan reads only the
CBV/SRV/UAV slots the bound table's root signature declares, and its cost
is accumulated per ExecuteCommandLists. Section 3.3 describes the three
places addresses are replaced and the two kinds of copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:51:08 +01:00
89fd2e2f87 dxgi_com: match host Windows 11 waitable swap chain frame-latency contract 2026-11-23 20:50:57 +01:00
876206a90c d3d12_descriptor_test: read back pixels through the UINT-border static samplers
The static-sampler readback loop skipped the 1.1 OPAQUE_WHITE_UINT row and
#8706's 1.2 UINT_BORDER_COLOR + TRANSPARENT_BLACK row, so both were checked
by their registered S# words only. They now sample the R8G8B8A8_UINT view one
tile to the right (every texel is the border) and expect 1 and 0 in every
channel, alpha included. Unregistered, the lookup falls back to the clamping
sampler and reads the texture's edge, which fails the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:50:51 -03:00
3101e317af Preserve trailing-dot DOS file search patterns on long paths 2026-11-23 16:50:23 -03:00
e66bf242e2 gameinput: include <cstdint> for UINT64_MAX
SetHapticMotorState's saturating end time uses UINT64_MAX, which
gameinput.cpp only got through a transitive include. Include <cstdint>
directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:50:16 +01:00
f57ed9da22 d3d12: a shader path that is not UTF-8 never throws, and LEONIDA_SHADERS is absolute
- A shader_path.txt that is not UTF-8 no longer throws out of Create*PipelineState: MSVC's STL reports the failed
  conversion as std::system_error, not filesystem_error. configured_shader_directory() returns the reason instead,
  and DeviceState::library() catches every std::exception, so the "invalid translated shader path" message prints
  and the pipeline fails. The reader of the file itself is unchanged.
- A relative LEONIDA_SHADERS no longer follows the current directory: gta6rt makes it absolute at startup, next to
  --game-dir and --overlay, and ShaderLibrary::load keeps an absolute folder for the modules it reads later.

Tests: d3d12_shader_path_test (new, Windows, no GPU) and a relative-folder check in shader_library_test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:50:00 -05:00
df62408b84 d3d12_existing_heap_test: a driver may refuse the section-view import (RADV userptr is anonymous-only)
RADV imports host memory through amdgpu userptr, which libdrm creates anonymous-only, so it refuses a
view of a pagefile-backed section with EPERM (RX 9060 XT under Wine, found in review), and the layer
answers with its fallback as designed. The section-view case now accepts that outcome and checks the
fallback resource exists; NVIDIA and AMD's Windows driver still import it, and the readback is still
checked there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:48:47 +01:00
65668002e9 d3d12: buffer addresses in the title's own memory reach a shader through an arena window
A root view or buffer V# may name the title's own memory outside any
slot-133 buffer (a per-frame constant ring, #8862 section 3.5). The
layer now makes a 64 KiB-aligned window of those pages in the GPU
address arena, copies it before every submission like a slot-133
shadow, and names that copy instead: for root views when set, for V#s
the layer writes, and for buffer V#s the title writes into a bound
CBV/SRV/UAV table itself, rewritten in place before each submission.
Counters per kind, LEONIDA_TITLE_WINDOWS_MB caps the windows (64 MiB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:47:45 +01:00
14a459bacb d3d12_descriptor_test: a sampled 2D 128x1 A8_UNORM texture is sized at 64 KiB and 4 KiB alignment
The shape bobcatchris reports from the retail boot on #7403 (2D 128x1, no flags, one sample, the
full mip chain), with Alignment 0 and 4096. On this head it takes texture_format's existing path (an
R8 image, as on main) and GetResourceAllocationInfo sizes it at the default 64 KiB and the 4 KiB
small-resource alignment. Passes on an RTX 3060 and a UHD 750 with Vulkan validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:46:36 +01:00
717f011a00 GPU fixtures for computed writes to exec_lo / exec_hi (SHADER-1264) 2026-11-23 20:45:50 +01:00
d8ba5ff389 local: trace PresentX 2026-11-23 13:40:50 -06:00
7a8ae20ca0 docs: section 3.3 says how shaders reach title-placed buffers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:39:59 +01:00
ab1fbff95d d3d12: shaders reach a title-placed buffer through the root views and buffer V#s the layer writes
Xbox device slot 133 places a buffer at the title's own VA, about 1.5 TiB on
Windows, while a translated shader computes heap_base + console VA with
heap_base the arena's device address. A root view or V# naming that VA
missed the buffer. The layer now translates an address inside a
title-placed buffer where it writes it (root CBV/SRV/UAV, CBV and buffer
SRV/UAV V#s): to the arena offset of the slot-133 shadow, which now lives
in the GPU address arena when it fits, or to an import's device address
minus heap_base. New tests: title_va_alias_test, d3d12_title_va_test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:38:42 +01:00
224fc74f5c d3d12: stage ARRAY_OF_POINTERS instances whose upload VA wraps below the arena
Without Resizable BAR, UPLOAD buffers live in system memory, outside the GPU
address arena. Their VA is (device address - arena base), which wraps when
the buffer's device address lies below the arena's. stage_khr_instances
refused such an entry as an overflow (va > UINT64_MAX - heap_base), so the
whole TLAS build list failed with "invalid copy or resolve" and nothing was
submitted. The unsigned sum heap_base + va wraps back to the buffer's device
address, as the replay's other VA translations already rely on.

Measured on an RTX 5060 (NVIDIA 621.14) on a board without Resizable BAR:
d3d12_indirect_rt failed with "RayQueryKHR ARRAY expected hit=1 miss=0, got
hit=0 miss=0" on every run; LEONIDA_ARENA_LOG=1 shows the upload buffers at
VA 0xfffffffffe07xxxx. Adds d3d12_indirect_rt_upload_sysmem, which runs the
same test with LEONIDA_UPLOAD_SYSMEM=1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 16:37:56 -03:00
17f41ec69c Open long backing paths for guest file shims 2026-11-23 16:37:22 -03:00
c4dc7e2ac4 Merge branch 'pr7535' into local/ladder-frame-wine 2026-11-23 13:36:23 -06:00
bdab731996 Merge branch 'pr7384' into local/ladder-frame-wine 2026-11-23 13:36:23 -06:00
8c5ce53d12 local: wire #8591 into present_state_for 2026-11-23 13:35:55 -06:00
97f0dcd192 Merge branch 'pr8591' into local/ladder-frame-wine 2026-11-23 13:34:47 -06:00
ced3615124 local: merge #7584 (docs conflict: ours) 2026-11-23 13:34:47 -06:00
2cf0ff8b10 Merge remote-tracking branch 'origin/main' into fix/xmem-physical-page-runs 2026-11-23 16:33:18 -03:00
1d080f4a69 d3d12_xs: slot 108 refuses a descriptor count with a null array
A count above zero with no descriptor array now returns {UINT64_MAX, 0}
like the other bad-input paths instead of forwarding a null array to the
PC GetResourceAllocationInfo2. xs_proxy_mock_test checks the refusal and
that PC slot 68 is not reached.
2026-11-23 19:32:58 +00:00
61c95045e4 test(xmem): multi-page unmap across views, remap inside a live run, freed page refused
The coverage gaps isfcrctfs listed on #7584.
2026-11-23 16:30:36 -03:00
9cf192d926 tests: choose an ACP letter with a representable uppercase
ACP 936 represents U+00E9 but not its U+00C9 uppercase, so the
module-name fixture failed on native Windows as well as the loader.
Keep the ANSI case check and require both spellings when selecting
the test letter.

Claim: https://github.com/ItsNotRexed/Leonida/issues/8504#issuecomment-7111536474
AI-assisted (Codex).
2026-11-24 03:25:40 +08:00
ec502356c7 d3d12: a static sampler with the UINT flag on transparent black is registered
register_static_samplers took D3D12_SAMPLER_FLAG_UINT_BORDER_COLOR on
any border colour without a _UINT enum value for a pair D3D12 does not
define, and skipped the sampler: CreateRootSignature succeeded, the S#
was never registered and the shader sampled through the fallback
sampler.

The static enum has no transparent _UINT value, so the 1.2 flag on
TRANSPARENT_BLACK is how a root signature writes the integer border
(0,0,0,0). D3D12 serializes and creates it; the pairs it refuses are the
flag with the float OPAQUE_BLACK and OPAQUE_WHITE, which stay refused.

d3d12_descriptor_test gets a fifth static sampler row for it.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-23 20:19:07 +01:00
ccf9f87fc3 local: merge #7286 with list-array unwrap 2026-11-23 13:17:23 -06:00
ba5e9a39c9 local: merge #7604 2026-11-23 13:08:38 -06:00
ec41c2201c shims: find_title_window, the title's own window that PresentX shows its frames in
A GDKX title makes its own top-level Win32 window before its first PresentX, and PresentX names no window: on the PC
the frames belong in that window. Measured on a retail executable: by the first PresentX the process has one visible,
unowned top-level window on a thread of its own, and only hidden windows besides (IME, a driver's dummy window). The
PresentX wiring (#2490) built a hidden window of its own instead, so a running title showed a blank window.

find_title_window picks the visible, unowned, non-tool top-level window of the process with the largest client area.
It sends no message: a lookup that read window titles with GetWindowTextW (a WM_GETTEXT sent across threads) stopped
the retail title at its first PresentX, because the title's window thread was not pumping at that moment.

title_window_test makes the windows on a thread that never pumps; the negative control shows a sent WM_GETTEXT times out
there, while the lookup answers at once and skips the larger hidden, owned and tool windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:02:18 +01:00
d5fa829488 d3d12_xs: keep the fence mirror's event open while the real fence lives
The mirror's last SetEventOnCompletion can still be pending on the real
fence when the proxy goes away, and no call cancels it. Closing the event
then lets a later completion set a closed or reused handle whenever
another reference keeps the real fence alive. Close it only when the
proxy's Release destroyed the fence. Reported by Hiiva in review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:02:15 +00:00
ea3d014c3c Merge branch 'pr7180' into ladder-frame
# Conflicts:
#	docs/README.md
2026-11-23 20:00:36 +01:00
7b2054b38a ladder: kXboxFlag is const, not constexpr (clang rejects 0x20000 for the unfixed enum; aapolipponen)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:00:25 +01:00
a5379729d0 Merge branch 'pr7501' into ladder-frame 2026-11-23 19:56:02 +01:00
9995563996 Merge branch 'pr7474' into ladder-frame 2026-11-23 19:56:01 +01:00
49dd742828 Merge branch 'pr7685' into ladder-frame
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
2026-11-23 19:56:00 +01:00
bd6b147b16 Merge branch 'pr7880' into ladder-frame
# Conflicts:
#	runtime/shims/d3d12_xs_device.cpp
#	runtime/shims/d3d12_xs_device.h
#	runtime/test/xs_proxy_mock_test.cpp
2026-11-23 19:55:34 +01:00
718e27ba6a docs: public D3D12.X presentation/device slots and x64 layouts (#6522)
Squash-merged after diff review of PR #6522
2026-11-23 12:54:03 -06:00
bee47186f6 ladder: kXboxTiledResourceLayout is inline const, not constexpr (clang-cl rejects 0x101 for the unfixed enum)
Reported by YaBulochka and sovljanskii on #7154; #7110's current head has the same form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:51:21 +01:00
3ca3c4725d tiny_game_abort_test: the native reference accepts Wine's abort() exit code 3 (#6539)
Squash-merged after diff review of PR #6539
2026-11-23 12:50:05 -06:00
57a0fc4caf d3d12_xs: declare console_to_pc_list_slot and verify slot mapping 2026-11-23 19:48:12 +01:00
b3a53b870b gfx10_descriptors: the A8 row keeps the table's comment form; the table test reads a _KHR format
tests/test_gfx10_descriptors.py parses every format row and failed on the A8 row (found by
dcastell1 on #7403): its trailing comment had a parenthetical, so the row was not read (94 != 95),
and once read, gfx10_name() derived "8_KHR" from VK_FORMAT_A8_UNORM_KHR. The row's comment is now
exactly GFX10_FORMAT_8_UNORM, with the explanation on the line above, and gfx10_name() drops an
extension suffix (_KHR, _EXT) before reading the layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:48:02 +01:00
713a949b5b runtime(spirv_stores): check every declared member [0, total) is NonWritable (#6550)
Squash-merged after diff review of PR #6550
2026-11-23 12:47:18 -06:00
56fafc6896 GPU tests: exit 77 when maxPushConstantsSize < push_bytes in vk_compute_test, vk_store_test and vk_sampler_test (#6554)
Squash-merged after diff review of PR #6554
2026-11-23 12:46:09 -06:00
7e1571a96f test: root UAV s4:s5 in the counted indirect dispatch shader (#6566)
Squash-merged after diff review of PR #6566
2026-11-23 12:42:57 -06:00
0c6ff794c2 resource_detile: prevent uint32/size_t size wraparound and reject overlapping spans (#6567)
Squash-merged after diff review of PR #6567
2026-11-23 12:42:41 -06:00
a86d7f9508 d3d12: an integrated GPU reports UMA and refuses MEMORY_POOL_L1 heaps, as the host does (#6569)
Squash-merged after diff review of PR #6569
2026-11-23 12:42:09 -06:00
b487b6d8cc Merge branch 'pr7746' into ladder-frame
# Conflicts:
#	make_game.py
#	runtime/src/shader_library.h
#	runtime/test/shader_library_test.cpp
2026-11-23 19:39:53 +01:00