Commit Graph

4696 Commits

Author SHA1 Message Date
fce586c6d6 Merge pull request #877 from UwUCammie/pr/xma2-synchronization-lib
build: link synchronization for the Rust XMA2 decoder (BUILD-XMA2-SYNCH-LIB)
2026-11-24 17:58:15 +01:00
35e38baee3 vulkan: a loss the driver shows only as a counter of UINT64_MAX is recorded
VulkanFence::completed() passed a counter of UINT64_MAX on to the title
when vkGetSemaphoreCounterValue succeeded with it, so the layer never
learned its device was lost. It now asks vkDeviceWaitIdle under the
submit lock and records the loss on VK_ERROR_DEVICE_LOST, after which
the driver answers vkGetDeviceFaultInfoEXT.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 00:57:36 +08:00
8f8b34896b Merge main into claude/bl1-tls-index0: keep row 4's note and #741's new row 4a
#741 added row 4a (the Wine-only gameinput.dll ordinal 1 stop) directly under row 4 of
docs/retail_boot_chain.md, which this branch edits. Both rows are kept unchanged.
tests/test_docs_*.py: 47 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-24 11:53:29 -05:00
74e55acfbc D3D-448-GRAPHICS: a graphics signature past the console window keeps the PC layout instead of being refused
Measured by madhyn on the retail title with this pull request (#974
review): one of its start-up root signatures is past the console's
inline graphics window (24 dwords from s8) and the compute one (28 from
s4), so CreateRootSignature refused it outright and the title stopped
with an unhandled exception before the frame loop it reached without
this change.

On the console such a signature goes to the argument block behind
s[0:1], modelled for compute only (ROOT-SIG-SPILL-MODEL, #1009). Until
it is for graphics, the graphics bind point keeps pack()'s layout for
it (from s0, two dwords per table), what the layer did before the
console layout, so no signature is worse off than on main. The new
RootArgumentLayout::graphics_console tells address() which layout the
table is in; a mesh shader still refuses such a signature.

d3d12_mesh_test: a 30-constant signature is created and DispatchMesh
with it invalidates the list.
2026-11-24 17:52:02 +01:00
acef4fa6b5 Honor wave64 graphics tiers on fixed 32-wide devices (RT-WAVE64-GRAPHICS-TIER) 2026-11-24 21:46:40 +05:00
e55b3be88a tests: fail when a subgroup warning precedes a dispatch error 2026-11-24 11:43:12 -05:00
da74b96810 vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO)
Where the device has VK_EXT_device_fault, enable it and, the first time the
device is lost, query vkGetDeviceFaultInfoEXT and print the description, the
address faults and the vendor faults after the "device was lost" line.
Nothing is printed and nothing changes without the extension.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 00:42:48 +08:00
b358f4788b Tests: heap properties, residency and typeless depth check the layer on its own (TEST-WINE-HOST-GUARDS)
With no host to compare with (no host device, or Wine's), d3d12_heap_properties and d3d12_residency only printed
the layer's record, so a wrong answer of the layer still passed, and d3d12_typeless_depth exited 77 without looking
at the layer at all. Each now checks the layer by itself, on every host, before any comparison:

- d3d12_heap_properties: for every committed or placed resource the layer created, GetHeapProperties succeeds
  with both outputs, with the properties alone and with the flags alone, Type is the heap type it was created
  with (for a custom heap the CPU page property and memory pool too), and a call asking for one output reports
  what the call asking for both does. For a reserved resource the call fails.
- d3d12_residency: no call raises an exception, the plainly valid calls succeed, the device is never removed, and
  after EnqueueMakeResident the fence holds the value asked for (or stays put for a lower one, or after a failure).
- d3d12_typeless_depth: the layer's readback has to hold the cleared depth and stencil at every texel. Under Wine
  that is now the whole check and the test passes instead of exiting 77; elsewhere it runs before the comparison
  with WARP.

With LEONIDA_D3D49_VERBOSE=1 the first two print the layer's record when there is no host. dxgi_swapchain says
why it compared nothing under Wine instead of "no host D3D12 device".

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 10:42:39 -06:00
50407827cd tests: GPU readback for the binary64 vector compares, v_cmp_*_f64 and v_cmpx_*_f64 (GPU-CMP-F64)
The v_cmp_*_f64 / v_cmpx_*_f64 row of docs/design.md was CPU-checked and measured on native gfx1100, and no
fixture in runtime/test/shaders used a binary64 compare, so the SPIR-V those 32 ops translate to had not run on a
driver.

cs_w32_cmp_f64 is memory-fed, like cs_w32_shift64: check.py seeds 256 operand pairs, the product of 16 values
(+-inf, +-max, the 1-ULP neighbours of +-1, the smallest subnormals, +-0, the smallest normal, a NaN whose payload
is only in the low dword, a negative quiet NaN), and each of 128 threads loads two of them at run time. Per pair it
stores a v_cmp_ word (through VCC) and a v_cmpx_ word (through EXEC): one bit per predicate in opcode order, a bit
for tru run with the odd threads turned off (an inactive lane gets VCC 0 and stays off through v_cmpx_), and two
bits for lt and nge with VOP3 abs/neg. The expected words come from Python floats. Both GPU runners compare all
1536 heap words, the unchanged inputs included.

tests/test_gpu_cmp_f64.py checks, without a GPU, the oracle against an independent restatement of the 16
predicates, a few words worked out by hand, that the assembly gives every predicate the oracle's bit, and the
readback and runner verdicts. docs/testing.md describes the fixture and the row names it.

No translator or runtime change.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 10:41:43 -06:00
9f087c96b9 ci: link synchronization for the XMA2 ABI smoke test
Adapted from LeonidaReforge/Leonida#23 (e932888842afccb38695cab4ce6c4ff6ca8b0dd7). AI-assisted (Codex).
2026-11-24 19:40:05 +03:00
93bf348eb8 Merge pull request #670 from LouisRiverstone/carry-old-9943
vk_compute_test: VKC_HEAP_FILE refuses an offset of 2^32 and a file past the 4 GiB heap (RT-439) (OLD-9943)
2026-11-24 11:39:26 -05:00
50a02d95bd Merge pull request #618 from KarolKurzyna/fix/sparse-queue-family-single-family
check_sparse_queue_family: skip CONCURRENT contract on single-family GPUs (OLD-7268)
2026-11-24 11:39:21 -05:00
259fdbd179 Merge pull request #617 from KarolKurzyna/fix/dxr-validation-khr-skip
d3d12_dxr_validation_test: skip before allocating AS buffers on non-RT GPUs (OLD-7241)
2026-11-24 11:39:16 -05:00
34e6b29682 xgameruntime_gamesave: undo a partly applied update instead of leaving it (RT-GAMESAVE-COMMIT-ROLLBACK)
commit() replaced blobs one rename at a time. When a later rename failed (the blob held open by another
process without FILE_SHARE_DELETE), the earlier renames stayed, the update returned
E_GS_OUT_OF_LOCAL_STORAGE and the container was left half new, with "<blob>~" temporaries behind.

Each op now copies its blob to "<blob>~b~" before it changes the blob. A failed op undoes the applied ones,
newest first. Deletes are applied in the same ordered pass, so a failed write also undoes a delete. The
scratch names end in '~', which encode_name never produces and decode_name rejects, so enumeration and the
quota never see them. A backup whose restore failed is kept, and later commits only remove backups they
wrote themselves. A commit drops the temporaries of one that died midway. A blob never leaves its name, so a
process that dies midway leaves each blob old or new, as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:33:10 +01:00
3ed8e50b75 Merge pull request #488 from xroneyaa/fix/vulkan-host-at-aliasing
Merging.

**Why merged:** host_at passes the byte length to BufferVaIndex::find, so aliasing placed buffers resolve over the full range rather than at the start address only. The CMake change only adds the new test target.

**Why it's good:** vk_host_at_aliasing, buffer_va_index and vk_buffer_registration_oom all pass both plain and under validation.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:25:49 -05:00
b9c7fc8620 Merge pull request #486 from xroneyaa/fix/shader-library-bounds-and-keys
Merging.

**Why merged:** shader_library gets an overflow-safe zlib limit, Adler-32 checks and strict parsing of f16_halves keys, so malformed library input is refused instead of misread.

**Why it's good:** shader_library passes both plain and under validation.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:25:37 -05:00
55516f710f Merge pull request #485 from xroneyaa/fix/xdxr-builder-validation
Merging.

**Why merged:** The xdxr builder checks the BLAS triangle total and null addresses before anything is recorded, and the dispatch-count overflow is fixed. The CMake change only adds the new test target.

**Why it's good:** xdxr_builder_validation, xdxr_build, xdxr_build_output and xdxr_descs all pass both plain and under validation.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:25:26 -05:00
7b5f8042e4 Merge pull request #470 from Kokonotcu/pr/submission-barrier
Merging.

**Why merged:** Every queue submission now starts with a full memory barrier, which matches D3D12's ExecuteCommandLists boundary. Under synchronization validation, main's vk_queue_test fails with 10 WRITE_AFTER_WRITE errors; with this PR it reports "4 of 4 submissions start with a full memory barrier" and 0 errors. Three independent NVIDIA checks agree (kawaii-shakal, Timon360SB, DesertGamer).

**Why it's good:** Cost, measured here because it was the open question: d3d12_bindless_churn (96 frames, many ExecuteCommandLists on 2 queues), 5 alternating runs, median, main vs PR: deferred 437.7 vs 433.8 ms, async 432.6 vs 437.3 ms, old-wait 438.3 vs 433.4 ms, old-wait async 440.2 vs 443.6 ms. vk_queue_test: 0.374 vs 0.370 s. All within run-to-run noise (about ±2%). These are synthetic tests, so there's no game-load number yet.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:25:15 -05:00
f5928c6b6b Merge pull request #434 from tahffo68hk-hash/fix/vk-tile-copy-align
Merging.

**Why merged:** tile_footprint staging now follows the format's real alignment, block size and depth. Before, it assumed 2D RGBA8, which was wrong for 8- and 16-byte texels, BC formats and 3D. moffington showed 7 new asserts fail on the base, and Dezmonius passed it on Windows with an RTX 5070.

**Why it's good:** replay_copy_offset, replay_texture_barrier and d3d12_texture_tiles all pass both plain and under validation. A possible follow-up, not a blocker: staging now triggers on offset % fmt.bytes, so an R8/R16 tile copy at an offset that isn't a multiple of 4 is no longer staged. On a transfer-only queue that would hit VUID-vkCmdCopyBufferToImage-commandBuffer-07737. main's non-tile path already behaves that way, and the old *4 staging was wrong for R8/R16 anyway; max(4, fmt.bytes) for colour formats would cover both.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:25:04 -05:00
fd635819cf Merge pull request #421 from oscarlosu-lab/pr/clzero-loop-fastpath
Merging.

**Why merged:** The CLZERO zeroing loop is emulated as one step instead of one #UD per 64-byte line, which is a large cut in exception traffic on that path. sodove's flag findings were fixed in this head, and he re-confirmed 5/5 against native CLZERO.

**Why it's good:** cpu_emulation passes both plain and under validation.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:24:52 -05:00
8a86036f38 Merge pull request #418 from tahffo68hk-hash/fix/vk-uav-clear-align
Merging.

**Why merged:** A buffer UAV clear whose backing buffer_offset is misaligned for 2-, 4- or 16-byte elements is now refused before vkCmdFillBuffer/vkCmdUpdateBuffer, instead of recording an invalid command. R8 still replays. moffington showed the new assertions fail on the merge base.

**Why it's good:** replay_uav_clear_offset passes both plain and under validation, with 0 errors.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Alone on main, its tests passed both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #388, #418, #421, #434, #470, #484, #485, #486 and #488 merged onto main 1504c1af6 (a225e593e). There the repo-consistency set gives 566 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 306/308. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same skip set. git merge-tree against current main 98a977b4b: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 11:24:40 -05:00
ed1de62abb vk: make the host-region probe skip where it cannot import
Every capability result now exits 77 with one SKIP line: a usage or handle
type the driver reports as not importable (the Vulkan 1.1
vkGetPhysicalDeviceExternalBufferProperties query, before anything is
allocated), an import or bind the driver refuses with
VK_ERROR_OUT_OF_DEVICE_MEMORY, VK_ERROR_OUT_OF_HOST_MEMORY or
VK_ERROR_INVALID_EXTERNAL_HANDLE, and a VirtualAlloc that fails for want of
commit. VK_ERROR_DEVICE_LOST and every other VkResult stay exit 1, so a lost
device or a coherence mismatch still fails the test. Before, an allocation
refusal exited 0, which read as a pass.

The copy whose destination the CPU compares now ends with the same
transfer -> host barrier the fill path already had: without it the copy's
writes are not made available to the host read.

VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT is honoured with
VkMemoryDedicatedAllocateInfo, so the probe follows the driver instead of
skipping a device that requires it.

runtime/CMakeLists.txt adds vk_host_region_import_validation, the same 185
MiB import under VK_LAYER_KHRONOS_validation and synchronization validation;
the binary skips it when the layer is not installed, so a machine without
the SDK does not fail it. The default case is unchanged: 185 MiB, 77 skip
code, 120 s timeout.
2026-11-24 17:22:18 +01:00
98a977b4b7 Merge pull request #335 from milk4sale/gpu-test/cube-store
Tested 0d27fdcf9 merged locally onto main 1504c1af6: cs_imgstore_cube passes everywhere, and nothing else changes state.

Devices: RADV, Mesa 26.3.1, Linux:
- AMD Radeon RX 7900 XTX (RDNA3, gfx1100);
- Ryzen 9 7950X3D iGPU (RDNA2, gfx1036);
- llvmpipe.

New fixture, 10 runs each with run_gpu_tests.py --filter cs_imgstore_cube --require-pass:
- 10/10 natively and 10/10 with LEONIDA_W64_EMULATE=1 on all three devices, 0 bad for all three cube images;
- the validation layer, with sync validation on, reports nothing on either AMD GPU.

Regressions, main vs main + #335:
- Full run_gpu_tests.py on both GPUs, native and emulated: 232/250 → 233/251. The only change is the new PASS.
- Every existing vk_store_test fixture keeps its state.
- tests/test_shader_checks.py and tests/semantic/test_image_cube_store_glc.py pass on both trees.

CI: this head's checks are still queued on GitHub, so I ran the Linux jobs locally. They give the same result on both trees. The only failures are already on main:
- cs_imgload_tfe and cs_imgload_d16_tfe (#31, fixed by #892);
- tests/test_tool_stdout_encoding.py.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 17:21:28 +01:00
cf4c00cbad Merge pull request #345 from milk4sale/gpu-test/image-atomics
Tested 367d91ef (merged locally onto main 0af7753c) on RDNA3 and on an RDNA2 iGPU: pass.

Setup:
- AMD Radeon RX 7900 XTX (RDNA3, gfx1100)
- Ryzen 9 7950X3D iGPU (RDNA2, gfx1036)
- Mesa llvmpipe
- RADV Mesa 26.3.1, Linux
- Runtime built from main; this PR doesn't change any runtime/ C++. No game files.

Results:
- run_gpu_tests.py --filter cs_imgatomic_ext --require-pass passed 3/3 native and 3/3 with LEONIDA_W64_EMULATE=1 on each GPU, and 1/1 on llvmpipe. Every run printed "all 64 words of the uint image, the sint image and the volume exact".
- --filter imgatomic passed 4/4 on both GPUs (cs_imgatomic, cs_imgatomic3d, cs_imgatomic_ext, ps_imgatomic).

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 17:16:23 +01:00
42d705c85b Merge pull request #484 from xroneyaa/fix/xdxr-stream-record-bounds
XDXR-STREAM-RECORD-BOUNDS: require complete 16-byte StreamRecords in find_stream_record
2026-11-24 11:11:50 -05:00
919abedf28 Merge pull request #518 from xroneyaa/fix/mods-parse-empty-hex-prefix
MODS-PARSE-HEX-PREFIX: reject bare 0x/0X prefix in parse_model_id
2026-11-24 11:11:19 -05:00
5c1f77e1d4 vulkan: say once when the device is lost (RT-DEVICE-LOST-LOG)
VulkanContext::mark_device_lost() and the fence dispatcher's two VK_ERROR_DEVICE_LOST paths only set the device's lost
flag. From then on every fence reads UINT64_MAX and device calls return DXGI_ERROR_DEVICE_REMOVED, so a title takes its
own device-removed path (on the retail boot an int3 at game_scarlett_master.exe+0x2474606, reached from its frame wait
reading a fence's completed value as ~0), and nothing in the log said the device had gone first.

set_device_lost() sets the flag with an exchange and, the first time for a device, prints one stderr line saying where
the loss was seen. mark_device_lost() takes that place as an optional argument; the dispatcher passes its own two.
device_lost_reports counts the lines for tests.

Tests: vk_fence_dispatcher_sync_test cases 3 and 4 check one line per device, from mark_device_lost() and from the
dispatcher's vkGetSemaphoreCounterValue path, and none from a later call on the same device.

AI-assisted.
2026-11-24 16:09:38 +00:00
f2268abead d3d12_xs: queue slot 31 is CopyPageMappingsBatchX, mapped through xmem (RT-QUEUE31)
The retail title calls its command queue's slot 31 (game_scarlett_master.exe+0xf2cc7f) with a batch count, 24-byte
batches {destination, range count, ranges}, the base and page count of its physical-page pool, and 0. Each 12-byte
range {kind, start, count} maps pool pages at the destination: 0 a run, 1 one page repeated, 2 unmapped, 3 unchanged.
main refused the slot with E_NOTIMPL; the title does not test the result and goes on to read the destinations.

Each range now reaches rt::xmem::copy_page_mappings_fn, which maps the physical page behind every source page at its
destination page (a second view of the same section, so both addresses are one memory) and unmaps where the source has
nothing or the kind is 2. The hook is set by xmem.cpp; tests that compile the proxy alone keep the old refusal.

Tests: xmem_test (a run, one page repeated, an unmapped source page, a null source, an overlapping range, bad
addresses) and xs_proxy_mock_test (the four kinds, a range past the pool, an unknown kind, xmem refusing, no xmem).

AI-assisted.
2026-11-24 15:58:40 +00:00
5fdd6abbc0 D3D-448-GRAPHICS: graphics root arguments in the console layout, mesh shaders through a window
The graphics bind point laid root arguments out with pack() (from s0, two
dwords per table), while the console starts them at s8 for VS/PS/GS with
one dword per table (the corpus census, and the retail frame loop reading
its tables at s8..s10). Compute already took the console layout (D3D-448);
graphics waited because a mesh shader (s16) and a pixel shader (s8) share
one push-constant block.

- translator: user_data_dword() - a mesh shader loads s16..s31 from push
  dwords 8..23, s8..s15 as 0, s0..s7 unchanged, so root dword k is push
  dword 8 + k for every graphics stage; index.json records the window as
  "root_window" on mesh shaders. VS/PS/GS/CS are unchanged.
- runtime: CreateRootSignature lays graphics out with
  pack_stage(Stage::Vertex) and checks Stage::Mesh (mesh_ok); a table is
  one dword at both bind points; DispatchMesh with a signature past the
  16-dword mesh window invalidates the list; a mesh PSO whose mesh shader
  has no root_window (translated before) is refused with a log line.
- fixtures: the GLSL stand-ins read the root arguments at push dword 8 + k;
  the M1.5/M2/M3 asm read their tables as one dword from s8.
- tests: tests/semantic/test_ms_root_window.py (MeshEXT and --mesh-compute
  on the CPU interpreter), graphics-window cases in root_signature_test,
  the two refusals in d3d12_mesh_test.
- docs: d3d12_vulkan.md 3.5, design.md user-data row.
2026-11-24 16:50:49 +01:00
d4b3a001d2 Merge pull request #572 from DeSunShine/fma64-rt
rdna2spirv, docs: NVIDIA splits a binary64 Fma only when folding an all-constant one; add cs_div_fmas_f64_rt (FMA64-RT)
2026-11-24 10:50:14 -05:00
d046559435 rdna2spirv, shader_disasm: VOPC compares in DPP form (SHADER-VOPC-DPP)
Three pipeline-library compute programs of 1.0.2.1 hold v_cmp_gt_f32 with a
DPP16 or DPP8 src0. llvm-mc has no gfx10 decoding for the pair, so the
listing dropped the words and the programs were refused.

shader_disasm.py prints the pair through a VOP2 stand-in that takes the same
DPP word, rdna2_decode.py decodes it directly, and Gen.dpp_insn translates
the compare for the forms where every lane writes its bit. Other forms and
v_cmpx are refused: what an unwritten lane does to VCC is not measured.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 23:41:08 +08:00
119d5b920c runtime: run a /GA build of tiny_game under gta6rt (run_tiny_game_ga_tls)
loader_tls checks the /GA rewrite inside a test EXE that links pe_loader.cpp. The stop BL-1 describes is in
gta6rt itself: there module TLS index 0 holds gta6rt.exe's own TLS, which the runtime uses on every thread,
and the title's entry point runs on a thread gta6rt starts. Nothing ran a /GA image through that path.

tiny_game_ga is tiny_game.cpp built with /GA (and /INCLUDE:_tls_used, as tiny_ga_tls has, because /GA can
drop the last _tls_index reference). run_tiny_game_ga_tls runs its `tls` mode through gta6rt --run:
thread_local on the entry thread and on a thread the game starts.

It passes on main as it is; no loader change. With LEONIDA_TLS_GA_PATCH=0 the same run fails its thread_local
check and exits 1, while the non-/GA tiny_game still passes with the rewrite off, so the test separates the
two shapes. That run writes into gta6rt's own TLS, so it is not registered as a test.

Tested on Windows 11, MSVC 19.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, NVIDIA RTX 4070 SUPER driver
621.24: run_tiny_game_ga_tls passes, 30 runs in a row; ctest -R run_tiny_game 11 of 11; full ctest 305 of
307, the two failures main has (d3d12_execute_indirect_validation, d3d12_depth_resolve), and the per-test
results differ from main's only by the new test. tests/test_ctest_registration.py passes. Not run on the
retail executable: that needs game files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-24 10:24:51 -05:00
b2360deeb6 loader_tls: a /GA executable beside a second TLS module, on the loading thread and on a new one (BL-1)
BL-1 (docs/boot_leads.md) says code built with /GA reads its TLS at module index 0 and that main stops there.
main already carries a fix (b7a3fed28 and 4710549af: load() rewrites the executable's gs:[58h] reads to a
per-thread view with the image's block at [0]), but no test maps a /GA executable and a second TLS module at
the same time, and no test shows that the fixture's code really has the index-0 shape: the CRT objects linked
into it read gs:[58h] through _tls_index, so "some reads were rewritten" holds for a non-/GA build too.

tiny_ga_tls gets ga_tls_address(), which returns where its code looks for its variable without touching it.
The new case uses it three ways. With LEONIDA_TLS_GA_PATCH=0 the address lies in this test EXE's own block at
index 0: the stop-4 shape, shown without reading or writing another module's TLS. By default it lies in the
fixture's own block, on the loading thread and on a thread started after load(), while tiny_tls.dll mapped
beside it keeps a block at its own index, gets its thread attach and detach, and this EXE's block and value
stay at index 0 of each thread's real TLS array. ~Loader takes the view out again.

No loader change: the case passes on main as it is, which is the finding. pe_loader.cpp and tls_host.cpp are
untouched.

Tested on Windows 11, MSVC 19.44 (VS 2022 Build Tools), Ninja, RelWithDebInfo, at main 8f05e09e2:
loader_tls_test OK (118 checks, 95 before), 40 runs in a row; with LEONIDA_TLS_GA_PATCH=0 set for the whole
process, 8 checks fail, as they should (7 existing ones and "by default load() rewrites the EXE's index-0
TLS reads"). MSVC emits the index-0 read for ga_tls_address at /Od and at /O2 (checked in the listing). Full
ctest: 304 of 306, the same two failures as main (d3d12_execute_indirect_validation, d3d12_depth_resolve).
Not run on the retail executable: that needs game files.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf
2026-11-24 10:24:51 -05:00
9392bbd9e0 retire_tickets: coalesce pending_through per semaphore and guard completed_ monotonicity 2026-11-24 15:16:22 +00:00
e82ca07b79 vk: probe whole title-region host imports
Add a Windows Vulkan test that imports one committed host allocation as a BDA buffer with VK_EXT_external_memory_host and verifies CPU/GPU coherence in both directions. The default 185 MiB case passes on RTX 3070; manual runs through 14 GiB also pass.
2026-11-24 16:13:12 +01:00
49e6392c9e arena_size: parse LEONIDA_ARENA_MB as signed so negatives hit the floor (ARENA-NEGATIVE-MB)
strtoull("-5") wraps to 2^64-5, so decide_arena_size clamped it to the
4095 MiB maximum. strtoll clamps "-5" and "-99999999999999999999" to the
16 MiB floor, as the header comment documents.
Adds checks for "-5", the huge negative and the huge positive to
arena_size_test. Other inputs keep their results.
2026-11-24 16:11:47 +01:00
eb6a08cd35 Sync upstream documentation, GPU reports and the Windows test correction 2026-11-24 23:10:50 +08:00
245c959ea0 d3d12_xs: ask the host D3D12CreateDevice for feature level 11_0 (BL-2)
The host path of D3D12XboxCreateDevice asked the PC D3D12CreateDevice for
minimum feature level 12_0, which a comment called the least restrictive
floor. It is the other way round: the minimum refuses every adapter below
it, so a host that tops out at 11_x failed with E_INVALIDARG
(docs/boot_leads.md BL-2). rt::d3d12_xs::create_host_device asks for
kHostDeviceFloor = 11_0, the lowest level D3D12 creates a device at; the
device keeps its highest level, which FEATURE_LEVELS reports and the log
prints (max_feature_level).

xs_proxy_mock_test drives it with mock hosts that top out at 11_0, 11_1,
12_0, 12_1 and 12_2. Each one is created at 11_0, the device proxy's slot
13 reports the host's own top level, and the failure paths (no host
function, failing host, S_OK with no device) clear the output. With 12_0
as the floor the 11_x hosts fail. The Vulkan-backed device takes no feature
level and stays at 12_1 (no ray tracing tier, no sampler feedback).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 20:10:05 +05:00
27c930020f active_input: guard timestamp underflow in debounce and ignore non-finite axes 2026-11-24 15:05:47 +00:00
00fc275459 Keep the Xbox list contract and explicitly managed presentation routing distinct
The known Xbox list interface can wrap a base desktop list and checks each forwarded slot. Detaching a managed presenter no longer falls back to a second window. Reset the integrated list counters with the rest of the device diagnostics.
2026-11-24 23:03:55 +08:00
7bb915dd3e runtime: frame pacing drift and latency percentile reporting (BL-6) 2026-11-24 15:58:13 +01:00
8afbba14b9 tests: expect resident image_load tfe to preserve seeded status VGPRs (SHADER-1266) 2026-11-24 09:56:57 -05:00
77b2d2eb7b Merge pull request #380 from lines9686-rgb/runtime-stale-comments
Merging.

**Why merged:** Comment-only fix in d3d12_vulkan_device.cpp: four stale comments now describe what the code actually does. Oliwettoo checked each one against the code ("Ship").

**Why it's good:** No code change: the diff touches only comments.

Tested on Windows 11 / RTX 4070 SUPER: merged alone onto main 47c651174, where the repo-consistency set (cmake/translator-deps, shader_stage_resume, runtime_paths, docs, make_game, no-game-data, run_semantic_tests) gives 566 passed / 5 skipped / 0 failed with this PR in. git merge-tree against current main 8f05e09e2: no conflicts. Security read of the three-dot diff: no binaries, game data, downloads, network calls or CI changes.

AI-assisted (Claude Code, Claude Opus 5.5).
2026-11-24 09:54:11 -05:00
1e3ee5e2dc Merge upstream device-loss and scratch bounds checks into the verified UI branch 2026-11-24 22:54:10 +08:00
673dd15d0e d3d12: use legal Vulkan depth clear values (D3D-CLEAR-DEPTH-RANGE) 2026-11-24 19:54:01 +05:00
efe544dac0 build: link synchronization for the Rust XMA2 decoder (BUILD-XMA2-SYNCH-LIB)
Rust's std imports WaitOnAddress, WakeByAddressSingle and WakeByAddressAll from
synchronization.lib. A clang-cl build against an xwin SDK does not pull that
library in on its own, so gta6rt and acphal_test failed to link with
lld-link: undefined symbol __declspec(dllimport) WaitOnAddress once cargo built
runtime/xma_decoder. Name it next to the decoder's other link dependencies.
2026-11-24 14:53:36 +00:00
2d9987f3cd Merge the upstream offline services, frame events and queue ABI into the Windows UI integration
Retain the first-run origin-token poll and shared tokens alongside standard origin, vblank and flip events. Route attached presenter callbacks before the fallback window and dispatch local speech through the Windows provider with the upstream offline fallback.

The offline pipeline checker now enables the runtime mesh query feature for cache-producing runs. A controlled GPU comparison with the same compute shader changed from a miss to an application cache hit.
2026-11-24 22:51:02 +08:00
a7d86d8c76 d3d12: separate front and back stencil masks (D3D-STENCIL-FACE-MASKS)
A DEPTH_STENCIL2 subobject whose FrontFace and BackFace masks differ was
refused with E_NOTIMPL, and OPTIONS14 reported
IndependentFrontAndBackStencilRefMaskSupported = FALSE although the
per-face references of OMSetFrontAndBackStencilRef already reach the
draw. Vulkan has a compare and a write mask per face in VkStencilOpState.

parse_pipeline_stream keeps the front face's masks in the description and
the back face's beside it (PipelineStream::back_stencil), create_graphics
takes them as an optional argument for depth.back, and OPTIONS14 now
reports the cap. The classic CreateGraphicsPipelineState path and its
cached-PSO key are unchanged: D3D12_DEPTH_STENCIL_DESC has one mask pair.

d3d12_state_sweep_test builds 16 more PSOs from a stream with
DEPTH_STENCIL2 (same, split, front-only and back-only masks; one reference
or two through OMSetFrontAndBackStencilRef; front- and back-facing) and
compares the colour and stencil readback with the host D3D12 device: 498
cases, 0 differ on an RTX 5070 Ti. Giving the back face the front face's
masks makes 6 of them differ. d3d12_vulkan_device_test expects the cap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 19:49:09 +05:00
bc9d0a5f8f runtime: map early OS ERROR_TIMEOUT to _Timedout in _Cnd_timedwait_for_unchecked 2026-11-24 15:48:18 +01:00
ac73a84127 d3d12_xs: configured Xbox device routes take precedence over the fixed slot 86, 101 and 108 handlers
The fixed handlers for slots 86, 101 and 108 were matched before the generic branch, which is where xbox_device_slot_routes() is read, so a route that LEONIDA_XS_FRAME_STATISTICS_SLOT or another LEONIDA_XS_*_SLOT variable put on one of those slots never ran. After the rebase onto main, xs_proxy_mock_env_slots failed for that reason: slot 101 reached CreateStateObject instead of GetFrameStatisticsX.

The three handlers now sit after the route checks and before the refusal for slots beyond the PC device table, and their own note_slot calls are gone because the generic branch already counts the slot once, so the hit counters stay at 1.
2026-11-24 18:45:06 +04:00