Commit Graph

929 Commits

Author SHA1 Message Date
0bc810504a Merge pull request #1028 from quartz-heron-58/device-fault
vulkan: print the driver's fault report when the device is lost (RT-DEVICE-FAULT-INFO)
2026-11-25 04:19:16 +01:00
427abf2613 vulkan_backend: name only the driver versions the counter loss was seen on
A comment-only change: 621.24 was measured, 617.14 was reported by another tester.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 10:52:29 +08:00
cf4f434d23 Merge main (82f033512) into device-fault; keep only the fence-counter loss
Main now has its own device-fault report (LEONIDA_DEVICE_FAULT=1, from #984)
and #980's device-lost line, so this branch's vulkan_device_fault.h, its
report code and vk_device_fault_test are dropped in favour of main's.

What stays is the case main does not cover: a loss the driver shows only as
a timeline counter of UINT64_MAX. VulkanFence::completed() then asks
vkDeviceWaitIdle through observe_result, so main's report runs, and marks
the device lost when that returns VK_ERROR_DEVICE_LOST.
vk_fence_lost_by_counter_test is adapted to main's reporter.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 10:50:03 +08:00
b8563e949e Merge main into D3D-448-GRAPHICS (#974)
main already lays graphics root arguments out in the console layout (from s8, one dword per table: #939's
graphics-root-layout patch in #984's form, pack_stage(Stage::Pixel), RootArgumentLayout::graphics_console,
graphics_arguments_end, LEONIDA_GRAPHICS_STAGE_LAYOUT=0 for pack()). That form stays. What this pull request adds
beyond it is carried onto it: the mesh-shader root window (translator, index "root_window", mesh_ok, the two
refusals) and its tests. Its own graphics spill handling (Spill::block) and LEONIDA_GRAPHICS_ROOT_LAYOUT=pc are not
carried: main keeps pack()'s s0 layout for a graphics signature past s31, and its switch does what =pc did.

Conflicts:
- runtime/src/root_signature.h, root_signature.cpp: main's pack_stage (compute spill array, spill_dword); the
  Spill enum, first_spilled and spilled_dwords dropped. The header keeps the PR's evidence note, with Stage::Pixel.
- runtime/shims/d3d12_com.h: main's comment and members, with the mesh window described; mesh_ok added (false by
  default, set only for a console-layout signature that Stage::Mesh also places); the PR's second graphics_console
  dropped.
- runtime/shims/d3d12_vulkan_device.cpp (CreateRootSignature): main's pixel/packed form; the PR's Stage::Mesh pack
  and its log line added, mesh_ok = pixel.ok && mesh.ok. The mesh-shader refusal without "root_window" (no
  conflict) stays.
- runtime/shims/d3d12_com.cpp: DispatchMesh keeps main's any_nonempty_viewport() and graphics_user_data() after the
  PR's mesh_ok check; address() keeps main's comment. The PR's kNoSgpr guard in constants()/address() stays,
  reworded: in main a spilled compute parameter has first_sgpr kNoSgpr, and kNoSgpr + offset wrapped round to s0.
- runtime/src/shader_library.h: both (main's wave64_graphics, the PR's root_window).
- runtime/test/d3d12_mesh_test.cpp: main's mesh shader-kind byte on both containers (also the PR's ms_old); the
  PR's two-parameter signature replaces main's 25-dword padding onto the s0 layout; both test blocks kept (the
  PR's window refusals, main's DISPATCH_MESH command signature), each in its own scope. The =pc case is dropped
  (main's switch is read once per process).
- runtime/CMakeLists.txt (no conflict): the mesh test uses ps_draw.spv again; the ps_draw_s0.spv rule is gone.
- runtime/test/glsl/ps_draw.frag, vs_depth.vert, vs_draw.vert, vs_draw_int.vert, ps_depth_write.frag and
  runtime/test/shaders/ps_m15, ps_m2, ps_m2_array, ps_m2_literal, ps_m2_uoff, ps_m3, ps_m3_post, ps_m3_query,
  vs_m15, vs_m3 (.asm): main's (the same s8 rewrite done twice); ps_draw.frag's mesh-test note updated.
- runtime/test/root_signature_test.cpp (no conflict): the Spill::block cases dropped, the window cases kept.
- docs/design.md: main's rows (loop guard, direct resource heap) and the PR's user-data row.
- docs/d3d12_vulkan.md (no conflict): section 3.5 and the CreateRootSignature bullet rewritten for main's form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 21:44:23 -05:00
3d59ad3e3f Attribution: native_pso.h names its source, licence and what could not be checked
The slot 57 native pipeline description is adapted from enx/leonida at 5c175db90 on the original author's git mirror. The header now says so with the commit, GPL-3.0-or-later as a fork of this project, what was changed as #939 describes it, and that the server could not be reached on 2026-11-25, so the source and its licence were not read there. Comment only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 21:06:15 -05:00
4770a7673c Attribution: the VIctory port is GPL-3.0-or-later, translated from Rust and changed
runtime/src/console_texture_layout.h, the second computer in runtime/shims/xg_xs.cpp and its test said GPL-3.0 for Marvisak/VIctory. The project is GPL-3.0-or-later, and the notices now also say that the code was translated from Rust to C++ and changed for Leonida. docs/runtime_imports.md follows. Comments only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 21:05:22 -05:00
a3d4db807c Attribution: four patches of graphics-runtime-patches at d9a0bc1b (GPL-3.0, smg)
graphics-root-layout, descriptor-table-refresh, descriptor-write-through and sampler-table-refresh of Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches are in #939 almost as published, about 390 lines, and only one sentence of docs/first_run_ui.md said so. That sentence now names the four, their licence and author and the files they are in, and each code region carries a comment naming its patch. Comments and one doc paragraph only.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 21:05:02 -05:00
a127c11a84 GPU labels reach a title page the D3D12 layer keeps read-only while it watches it
A completed label was stored only into a page that was read-write at that moment and dropped otherwise. The
base makes title pages read-only while a shadow or the geometry watch waits for the title's next write, so a
label for such a page was lost, and a title that waits for a completion label then waits for ever. The store
now announces the write the way a kernel write is announced (kernel_writes::begin_write): the layer opens the
pages it guards and copies them again at its next refresh. A page that is still read-only after that is the
title's own doing and the label is dropped as before; so are guard, no-access and decommitted pages and a
released allocation. The store moves out of the class as label::store_value so that it can be tested.

gpu_label_store_test (CPU only, registered as gpu_label_store) covers each of those cases with a stand-in for
the layer's opener.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:58:44 -05:00
0ce9f8992c first-run-ui: a variable that is set but empty does not count as the caller's setting
run_tiny_first_run_ui clears two variables by passing them empty. Windows cannot hold an empty variable, so there they are unset; under Wine they exist, and the profile's size-only query reported them as set and kept them. The test failed that way on #939's head too. The profile now reads the first character, so an empty value gets the profile's default on both.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:53:47 -05:00
85caf5815b A submission scans its tables with its own device's scanner
The merge had taken the base's process-wide scan hook (title_va_aliases), which belongs to the first device that registered. A second device over the same GPU then had its tables scanned by the first: d3d12_rebound_second_device, a test of #939, failed on it. #939 scans through the context of the device (VulkanContext::set_table_scanner), which the merged device still registers. That one is asked first now and the process-wide hook serves a context without a scanner.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:53:43 -05:00
22171d092f B4G4R4A4 targets stored as RGBA8 carry #939's flag: clears quantised, footprint copies still made
The base's early return for such a target came before #939's lines, so Format::rgba4_render_fallback was never set: #939's pixel-shader quantisation ran (it keys on the pipeline), its clear quantisation and its refusal of footprint copies did not. The flag is set now, so a clear stores what a draw would. The refusal of footprint copies is not taken as the default: the story-load boots of #984 ran with those copies made; LEONIDA_RGBA4_COPY_REFUSE=1 gives #939's refusal. Neither test device here lacks a 4444 colour attachment, so this path is exercised only on a GPU that does (NVIDIA).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:46:02 -05:00
38bd89d44e Merge the #984 result as of 71a783e56 into the #939 merge
Fourteen commits the #984 merge gained after 8a242efeb: its own failing tests (xmem_test under Wine, check_tls_index0, vk_bindless_grow, xs_present_lazy_test), the console-heap probe and the poke experiment behind their switches, Python tool fixes, and the title watchdog default. No conflicts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:37:26 -05:00
71a783e56f main: the title's hang watchdog stays armed unless LEONIDA_TITLE_WATCHDOG=0
The retail title runs its own hang watchdog: when the game's main loop has
not reported for 30 seconds, it ends itself. #984 kept that watchdog from
firing by default, because under the runtime the game thread can wait
longer than that, for example while the driver compiles pipelines on the
first boot after a driver update.

By the maintainer's decision the watchdog now stays armed by default, as on
the console, so a real hang still ends the run. LEONIDA_TITLE_WATCHDOG=0
turns on the runtime thread that keeps it from firing; as before, it only
acts in the build the watchdog was measured in. The README's environment
table and the log line say the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 20:32:26 -05:00
154e4ec034 Merge the #984 result (main + RT-PROTON-STORY-LOAD) into #939
The base is 8a242efeb, the merge of main and #984. 68 files conflicted; they were resolved in seven groups by
one rule: the same change in two forms keeps the base's form, everything only #939 has is kept, and where the
two solve one problem in two ways the base's is the frame and #939's plugs into it.

A, the Xbox proxy (d3d12_xs_device.cpp/.h, d3d12_xs.cpp, d3d12_xs_pso_stream.cpp/.h, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, device_proxy_test.cpp, queue_proxy_test.cpp): the base's files with #939's additions
ported in. Device slot 57 asks #939's NativeGraphicsFactory first and falls back to the base's
proxy_create_graphics_pipeline_from_native_code on E_NOTIMPL. Kept from #939: the providers (texture lease,
raw texture view, resource by address, constant view, descriptor mapping, depth-stencil UAV, texture pages),
the title-backed descriptor mirror, slot 13's feature answers, GPU labels on list slots 71/72. Dropped: #939's
duplicates of the boot ladder routes, its fallback window, its slot 133 stand-in.

A2 (xs_proxy_mock_test.cpp): the base's test with #939's slot 70 raw-buffer case; presentation cases follow
#939's rule that a device which ever had a handler has no queue fallback.

B1, the Vulkan device (d3d12_vulkan_device.cpp, d3d12_com.cpp/.h, shader_library.h, queue_families.h,
pipeline_cache_file.h, startup_trace.h): one lazy-pipeline mechanism, the base's; #939's pending_base_compile
and first_use_backend_pipelines dropped, prepare_on_bind and cold_graphics_compile kept. create_texture keeps
the base's signature; #939's deferred backing is folded into the base's placed-memory binder. #939's quad
lists as triangle indices.

B2, the D3D12 tests (d3d12_existing_heap, a8_dimensions, pipeline_cache_seed, title_va, rect_list,
shader_library, loader_tls_index0, draw, compute, xmem_placed, shader_library_corpus): the base's tests where
both carry the same case, #939's cases added (rebound tables, linear texture map, large vertex batch,
executable shaders, default A8 views).

C, the backend (vulkan_replay.h, vulkan_backend.h, vulkan_bindless.h, vulkan_scratch.h, vulkan_present.h,
rect_list_geometry.h, vk_test_device.h, vk_pipeline_check.cpp, vk_store_test.cpp, bindless_sizing_test.cpp,
replay_texture_barrier_test.cpp): the base's prepare_draw and lazy compute, its #1055 release rule and its
rectangle generator; #939's rectangle variants, GPU quad index expansion, 1D/3D and depth-stencil UAVs, the
label fence on the base's submit.

D, memory, services, presentation (xmem.cpp/.h, xg_xs.cpp, xg_xs_test.cpp, title_va_alias.h and its test,
main.cpp, frame_pacer.h, xbox_present.cpp/.h; xgameruntime_offline.cpp for one comment): the base's xmem with
#939's label hooks, file-backed sections and pin_mapped_data; both texture computers in xg_xs.cpp, the base's
answering first; --first-run-ui kept without host speech in its profile.

E, build, tools, docs (runtime/CMakeLists.txt, make_game.py, tools/rdna2spirv.py, tools/shader_disasm.py,
scripts, tests, docs; docs/README.md and tests/test_exe_shaders_stage.py beyond the conflicts): the base's
v_dot4 decode, #281's disassembler form and tests/semantic/test_fspx_dot4_op_sel_disasm.py dropped; the
base's executable-shader step with #939's cache fix; 366 registered tests.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:26:00 -05:00
68eee6b71a gfx10_descriptors.h: the A8 row in the form the format table test reads
tests/test_gfx10_descriptors.py checks every row of the format table against Mesa's names and fails when a row does not have the form it parses. #984's A8 render target row carried a remark after the GFX10 name, so it was counted but not read (94 of 95 rows; fails on #984's head too). The remark is a comment line above the row now, and the row is checked like the others (the test already knows an extension's suffix is not part of the layout).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:07:54 -05:00
869c889796 Stage copies between the two A8_UNORM backings through a buffer
An A8_UNORM render target is a VK_FORMAT_A8_UNORM_KHR image and any other
A8_UNORM texture an R8_UNORM image. CopyResource and CopyTextureRegion
between the two issued vkCmdCopyImage on that pair, which Vulkan does not
count as size-compatible: VUID-vkCmdCopyImage-srcImage-01548, although the
bytes came out right on the drivers tried. moffington reported it in the
review of #428 and Dezmonius confirmed it on native Windows with the
validation layer.

Such a copy now takes the replay's existing image -> transfer scratch ->
image route, the one depth <-> colour copies use, with one byte per texel
on both sides. Same-backing copies still copy image to image. This is the
approach of Dezmonius's proof of concept, which they described on the pull
request but did not publish; written here from that description.

d3d12_a8_copy_test copies A8 render target -> A8 texture and back, whole
(CopyResource) and a 3x3 box from a nonzero source offset to a nonzero
destination offset (CopyTextureRegion), and checks every texel read back:
the source bytes inside the box, the destination's own outside it. It wraps
vkCreateImage and vkCmdCopyImage behind the instance-proc pointer it hands
the layer and fails on any vkCmdCopyImage between VK_FORMAT_A8_UNORM_KHR and
another format, so it fails without this change even where the validation
layer is not installed; with LEONIDA_VK_VALIDATION=1 the layer's errors fail
it too. A8 -> A8 and R8 -> R8 copies are the controls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 19:54:27 -05:00
d125b369fd Boot diagnostics behind LEONIDA_LOCAL_DIAGNOSTICS, off by default
#984 carries the probes its author followed a frame of the retail title with, marked LOCAL DIAGNOSTIC and in places 'not for upstream'. Several wrote to stderr with no switch from paths that run for every draw: record_draw (a mutex, a set lookup and up to a dozen lines per draw), ClearRenderTargetView, the submission's table dump, PresentX (present_diag and the plane dump), the presenter's path line, the heap and CopyDescriptorsSimple lines of the device proxy, the per-view CBV and SRV lines, the per-pipeline description string and the console-heap census.

They stay, for the next person who has to follow a frame, behind one switch: LEONIDA_LOCAL_DIAGNOSTICS=1 (runtime/src/local_diagnostics.h, a row in runtime/README.md). Unset, none of them runs. Not changed: the diagnostics that already had a switch of their own (LEONIDA_CAPTURE_SOURCE, LEONIDA_MEM_PROBE, LEONIDA_XG_TRACE, --trace) and the replay's unresolved/unsupported lines, which report a dropped draw or list at the 1st, 2nd, 4th... occurrence.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:52:07 -05:00
39879ce0fd Merge main into RT-PROTON-STORY-LOAD (#984)
Merges main at 1154976d4 into the integration branch at 273b3bdf9 (merge base ece4ba5b3). 42 files conflicted;
this commit is the resolution only. Build and test repairs follow in their own commits.

Rule of resolution: where both sides added different things, both stay; where both made the same change in two
forms, main's reviewed form stays and whatever #984's form did in addition is carried into it; where the two
changed the same code for different purposes, both purposes are kept.

Xbox proxy code (runtime/shims/d3d12_xs_device.cpp, d3d12_xs_device.h, d3d12_xs.cpp, d3d12_xs_alloc_size.h,
d3d12_xs_desc_clean.h, registry.cpp):
- d3d12_xs_device.cpp is #984's file with main's differing pieces ported in: env_slot and the configurable device
  routes, XboxQueueSlotRoutes, PresentationHandler / set_presentation_handler, the console caller rule for device
  slots 61 and 74 (#383, #385), route_xbox_device_slot, slot 81 as GetFrameStatisticsX, create_host_device, the
  console-form rule for slots 25 and 56, the console list IID of #359, and the forms of queue slot 18 (#403) and
  list slot 139 (#396).
- Kept from #984: the list proxy with handle translation, queue slots 16/17 as Signal/Wait, the fence's
  completed-value mirror, the shared FrameTokenSource, PresentX through queue_present_x when no handler is
  attached (slot 30, or 32 on a queue detected as the newer layout), slots 27/53/55/57/70/71/133, the wider
  pc_resource_desc, S_OK for queue slots past the PC table.
- Dropped: #984's GetFrameEventsX and LEONIDA_XS_FRAME_EVENTS_SLOT, its second-word rule for slot 61, its
  undetected-layout rule for queue slot 18, its list IID mapping to GraphicsCommandList6; main's copy of the base
  list proxy, its null-view slot 70 and its refusing slot 133.

Proxy tests (runtime/test/xs_proxy_mock_test.cpp, device_proxy_test.cpp, queue_proxy_test.cpp):
- Checks of both sides, each run once; main's forms of the render-target size and layout checks with #984's extra
  cases added; main's --env-slots-74 and #984's --env-slots-70.
- Adapted to the merged code: the queue tail answers S_OK, slot 73 answers an unknown IID with the list proxy,
  the queue slot 18 case installs a console caller. Dropped: #984's slot 81 GetFrameEventsX cases.

D3D12/Vulkan layer (runtime/shims/d3d12_com.cpp, d3d12_vulkan_device.cpp, runtime/src/command_list.h,
frame_pacer.h, shader_library.h, vulkan_backend.h, vulkan_replay.h, runtime/test/command_list_test.cpp,
d3d12_close_parity_test.cpp, d3d12_execute_indirect_validation_test.cpp, replay_texture_barrier_test.cpp,
vk_pipeline_check.cpp, vk_test_device.h):
- Resource::create_texture: #984's title images (deferred placed, pending streamed, title pool) and main's
  ordinary textures (#1413 shared blocks, #1364 staging fallback) are exclusive branches chosen by the texture's
  origin, so both pools run on disjoint sets of textures.
- frame_pacer.h is main's pacer (#402) with #984's FrameTokenSource as the token counter.
- main's forms kept for ExecuteIndirect (#1066, #377), the barrier into LAYOUT_UNDEFINED (#1055), the B4G4R4A4
  stand-in, per-face stencil masks, the unaligned tile staging (#528) and the device-lost flag (#980).
- shader_library.h: main's block inflate; #984's `bulk` parameter now defaults to true so main's callers keep it.
- Dropped: #984's B8G8R8A8 stand-in for B4G4R4A4 targets, its refusal of separate stencil masks, its zero-count
  refusal in ExecuteIndirect, its wider UNDEFINED -> UNDEFINED release and the test case for it.

Other shims (runtime/shims/dstorage.cpp, file_system.cpp, gameinput.cpp, xgameruntime_offline.cpp,
runtime/test/xgameruntime_offline_test.cpp, xmem_test.cpp):
- ReadFile and DirectStorage reads: #984's pinned kernel_writes read, then main's touch_pages retry on
  ERROR_NOACCESS. main's rt::fs::read_file is folded into #984's read_file.
- gameinput: main's strict LEONIDA_INPUT_SCRIPT parser with #984's rsup/rsdown entries.
- Speech synthesis: main's one silent voice and handle checks; #984's accept-anything form dropped.

Build, tools, docs (runtime/CMakeLists.txt, runtime/cmake/translator_deps.cmake, scripts/build_runtime.ps1,
make_game.py, tools/rdna2spirv.py, shader_disasm.py, shader_ir.py, shader_library.py,
runtime/test/shaders/cs_imgload_tfe.asm, cs_imgload_d16_tfe.asm, docs/README.md, boot.md, d3d12_vulkan.md,
runtime/README.md):
- Unions of the test, target and source lists; spirv_loop_guard.py added to translator_deps.cmake.
- rdna2spirv.py: main's DPP compare rule (#957), SMEM vcc base (#647) and widen_wave64_masks (#1021); #984's
  restore_skipped_instructions and restore_dot4_inline_sel. #984's duplicate widen_wave64_valu_masks dropped.
- shader_disasm.py and shader_ir.py: main's structure with #984's one-line-per-dword llvm-mc input and wave flags.
- shader_library.py: main's structure with #984's --compute-hashes and per-state compute variants.

One file that did not conflict is changed here: tools/rdna2_decode.py. Git kept both sides' decoders for a VOPC
compare with a DPP operand, and #984's narrower one shadowed main's; it is main's file again.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 19:38:04 -05:00
1154976d49 Merge pull request #1413 from TheGeogeo/perf/image-memory-pool
d3d12_vulkan: textures share blocks of device memory (VK-IMAGE-MEMORY-POOL)
2026-11-25 01:03:00 +01:00
706f5429e1 Merge pull request #1154 from PyZikYG/copy-queue-timestamp-support
Merging.

**Why merged:** D3D-COPY-TIMESTAMP-CAPS: timestamp bits are tracked per queue family, and transfer-only families count as 0 bits because they can't reset or resolve queries. This was the first native Windows run of the fixed head; madhyn's Wine run was on an older head, and KernelSmoker ran vk_queue on Linux. Behaviour change: OPTIONS3.CopyQueueTimestampQueriesSupported can now be TRUE, and a copy queue that gets a transfer-only family returns E_FAIL from GetTimestampFrequency and GetClockCalibration instead of borrowing the graphics family's bits.

**Why it's good:** d3d12_vulkan_device, d3d12_query_rules, vk_queue, vk_queue_query_sync and vk_queue_constructor_oom: 5/5 both plain and under validation on the 4070 SUPER.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: 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 19:02:38 -05:00
af868171d9 Merge pull request #1081 from Kadamitas/perf/inflate-output
Merging.

**Why merged:** RT-INFLATE-MATCH-COPY: the inflater copies repeated matches in blocks (doubling memcpy that only reads finished output; distance at least 1 and bounds-checked) and reduces Adler-32 every 5552 bytes (the standard NMAX). sodove measured it 8-14x faster, and whoalin1's host tests pass.

**Why it's good:** shader_library, startup_trace, dstorage and d3d12_pipeline_library* pass both plain and under validation; shader_library_corpus is skipped, the same as on main.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: 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 19:02:26 -05:00
fec45f0a13 Merge pull request #1099 from Moriz82/split/rt-stream-transfer-barrier
Merging.

**Why merged:** RT-STREAM-TRANSFER-BARRIER: a transfer-write → transfer-read/write barrier goes before every vkCmdCopyBuffer, so back-to-back streamed copies are ordered. moffington measured SyncVal at 10 errors on the base and 0 on the head. Plaaasma (4070 Ti), iFeyz (RX 9070 XT) and whoalin1 (gfx1035) passed it. LEONIDA_ORDER_BUFFER_COPIES=0 turns it off (documented in docs/d3d12_vulkan.md).

**Why it's good:** replay_*, vk_bc_zero_init, vk_queue* and d3d12_close_parity: 16/16 both plain and under validation. A negative control on the cumulative build checked that the test really catches a missing barrier: with the barrier on, `--expect-unordered` fails; with the env var at 0, the ordered check fails and `--expect-unordered` passes. It also passes on top of #1055's vulkan_replay.h change. It adds one barrier per buffer copy, a small sync-policy cost with an opt-out.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: 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 19:02:14 -05:00
3943b04d53 Merge pull request #528 from tahffo68hk-hash/fix/vk-zero-init-fill-align
Merging.

**Why merged:** VK-ZERO-INIT-FILL-ALIGN: zero_compressed_image aligns the fill to max(4, fmt.bytes) and rounds the usable size down, so vkCmdFillBuffer's offset and size are 4-aligned. That also makes the copy offset 4-aligned on transfer queues, which closes the VUID-07737 gap noted on #434. kawaii-shakal (ASan mock) and Sangonapou (RTX 3080 Ti) checked it.

**Why it's good:** vk_bc_zero_init, vk_queue and the replay_* tests: 12/12 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. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: 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 19:02:01 -05:00
2dabfc9585 Merge pull request #980 from CLHelper/runtime/device-lost-log
Merging.

**Why merged:** RT-DEVICE-LOST-LOG: when the device is lost, the layer prints one stderr line per device. An atomic exchange keeps the context path and the dispatcher path from both printing. KernelSmoker approved it (llvmpipe and RTX 3090).

**Why it's good:** vk_fence_dispatcher_sync, vk_queue and vk_queue_query_sync 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. Merged alone onto main 0f98d193c, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative with the rest of this batch on main 507029d1e: the repo-consistency set gives 578 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 317/318 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The semantic suite has only the known environment-only failure. git merge-tree against current main 9c5e70661: 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 19:01:49 -05:00
2b72fb53d1 d3d12_vulkan: textures share blocks of device memory (VK-IMAGE-MEMORY-POOL)
Every committed and placed texture made its own vkAllocateMemory and
released it with its own vkFreeMemory, about 100 us and 200 us on an
RTX 3080. Small device-local textures now take ranges of 64 MiB blocks
(runtime/src/image_memory.h). Render targets, depth buffers, CPU-visible
textures and textures over an eighth of a block keep their own
allocation. A range goes back to its block through the deferred
deletion queue, and a texture in a reused range is zeroed before a
shader reads it.

Tests: image_memory (CPU) and d3d12_texture_memory (GPU).
2026-11-25 00:25:24 +01:00
cdb003ea19 Merge pull request #1055 from milk4sale/d3d12/barrier-into-undefined
d3d12: an enhanced texture barrier into LAYOUT_UNDEFINED closes and keeps the layout (D3D-BARRIER-INTO-UNDEFINED)
2026-11-25 00:24:32 +01:00
28a32e190e Merge pull request #377 from Mumogg/slot41-command-signatures
d3d12: the title's startup command signatures are created (argument type 105, DISPATCH_MESH), again (RT-SLOT41)
2026-11-24 23:52:04 +01:00
2a5ff9714c Merge pull request #615 from tahffo68hk-hash/fix/vk-xdxr-postbuild-readback-stage
Merging.

**Why merged:** VK-XDXR-POSTBUILD-READBACK-STAGE: in vulkan_replay prepare(), an XDXR postbuild that has sources now sets wrote_readback and adds the COMPUTE_SHADER stage to the readback flush, so its results are visible to the CPU read. kawaii-shakal independently ran it 8/8 both plain and under validation.

**Why it's good:** vk_xdxr_postbuild_readback, replay_readback_stages, xdxr_* and d3d12_xdxr_rt*: 9/9 plain and 9/9 under validation. The new vk_xdxr_postbuild_readback is the extra test in the cumulative count.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 4a50cafc7, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main 540d5111f: the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 316/317 with the usual 11 skips; the only failure is main's pre-existing d3d12_depth_resolve. All d3d12_* tests under validation: 119/120 with 0 VUIDs. The full semantic suite has the same single environment-only failure as main. git merge-tree against current main 51a6074d2: 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 17:31:11 -05:00
59dcc9e917 Merge main into d3d12/barrier-into-undefined
Brings the branch up to date with main 68d1331e5. No conflicts; the merged tree was tested before the push (every standalone
test file under tests/ passes except tests/test_ci_registration.py, which fails on main alone since #930).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 16:31:07 -06:00
438859b525 Merge main into RT-SLOT41 (#377)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 17:15:39 -05:00
d15a916010 Merge main into RT-XMEM-LEASE (#375)
One conflict, runtime/shims/d3d12_xs.cpp: functions added after
create_root_signature_deserializer on both sides, both kept: main's
create_versioned_root_signature_deserializer, then this branch's
xmem_descriptor_heap_alloc/free (the bridge to the title's XMem hooks that
D3D12XboxCreateDevice installs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 16:38:30 -05:00
3bc03ba69f Merge main (4a50cafc) into device-fault
Brings in the RSSetScissorRects fix (#1286) that d3d12_close_parity needs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 05:36:07 +08:00
d43a847903 Merge pull request #902 from narekshaghoyandev/ubiq-active-input-debounce-and-nan
Merging.

**Why merged:** RT-ACTIVE-INPUT-DEBOUNCE-NAN: active_input ignores an out-of-order timestamp in the debounce and ignores NaN/Inf stick and trigger samples. KernelSmoker's note that the new case wasn't registered doesn't apply at this head: it's in cases[] and runs ("8 of 8 cases pass"), as the author replied.

**Why it's good:** Header-only logic. active_input 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. Merged alone onto main 66d4f5aa3, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main 0b45fdc21: the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The only failures are main's: d3d12_depth_resolve (pre-existing) and d3d12_close_parity (the #510 regression, fixed by #1286). All d3d12_* tests under validation show 0 VUIDs. git merge-tree against current main 6261ca916: 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 16:26:33 -05:00
5237898a97 Merge pull request #923 from TuroYT/fix/arena-negative-mb
Merging.

**Why merged:** ARENA-NEGATIVE-MB: LEONIDA_ARENA_MB is parsed with strtoll, so a negative value clamps to the 16 MiB floor instead of wrapping around to the 4095 MiB maximum. KernelSmoker approved this exact head.

**Why it's good:** A 3-line parse change. arena_size 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. Merged alone onto main 66d4f5aa3, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative of this batch (13 PRs) on main 0b45fdc21: the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The only failures are main's: d3d12_depth_resolve (pre-existing) and d3d12_close_parity (the #510 regression, fixed by #1286). All d3d12_* tests under validation show 0 VUIDs. git merge-tree against current main 6261ca916: 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 16:26:21 -05:00
ef0cc4254f Merge main (6261ca91) into device-fault
Brings in the tfe fixture fix (#892) that the Runtime workflow's GPU tests need.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 05:06:43 +08:00
94f2773c1f Merge main into RT-XMEM-LEASE (#375)
One conflict, runtime/test/xs_proxy_mock_test.cpp, neighbours added on both
sides, both kept: the mock's `held` (this branch, slot 5 private data for the
committed-resource leases) next to main's `max_level` (FEATURE_LEVELS answer),
and this branch's five checks in main()'s list before main's
check_presentation_wiring().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 15:51:38 -05:00
ab4085fb9a Merge pull request #907 from TheGeogeo/fix/uav-clear-pack16
Merging.

**Why merged:** VK-UAV-CLEAR-PACK16: B5G6R5, B5G5R5A1 and B4G4R4A4 join the UAV-clear layout table, with conversion checks and an exhaustive 65,536-word round trip. Timon360SB (2060S and 5070, 60/60) and SweatierKey approved. The current head b67109eb3 is a content-identical rebase of the reviewed one.

**Why it's good:** uav_clear, short_uav_clear, b5g5r5a1_uav and replay_uav_clear_offset 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. Merged alone onto main, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #517, #907, #927, #954 and #1074 merged onto main 32a5d9698 (after aslan2142's runtime merges). There the repo-consistency set gives 573 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 314/316 with the same 11 skips. The 2 failures are d3d12_depth_resolve (pre-existing) and d3d12_close_parity, which fails on plain 32a5d9698 too: a regression from #510, reported there, not from these PRs. git merge-tree against current main: 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 15:44:08 -05:00
ccd9c5f369 Merge pull request #510 from jujumoneylol/pr/d3d12-multi-viewport
d3d12/vulkan: implement multi-viewport and multi-scissor rendering (D3D-MULTI-VIEWPORT)
2026-11-24 21:31:21 +01:00
e0f171958f Merge pull request #1066 from klikso/carry/d3d-execind-range
d3d12: ExecuteIndirect accepts the argument ranges newer D3D12 runtimes accept (D3D-EXECIND-RANGE-CARRY)
2026-11-24 21:31:10 +01:00
0445a47b56 Merge pull request #831 from Maticcm/fix/crt-timed-wait-early-timeout
runtime: map early OS ERROR_TIMEOUT to _Timedout in _Cnd_timedwait_for_unchecked (RT-CRT-TIMED-WAIT-EARLY-TIMEOUT)
2026-11-24 21:30:37 +01:00
f7d18627bd inflate: expand repeated matches in blocks and batch Adler reductions 2026-11-24 14:17:02 -06:00
b67109eb3e vulkan_replay: clear packed 16-bit UAV textures
uav_clear.h had no layout for R5G6B5, A1R5G5B5 and A4R4G4B4 (D3D12 B5G6R5,
B5G5R5A1 and B4G4R4A4), so ClearUnorderedAccessView on such a texture was
refused at replay and the whole submission was dropped.
2026-11-24 20:57:36 +01:00
be010a409c d3d12: check the copy timestamp fallback family explicitly 2026-11-25 00:23:37 +05:00
00fc23b9a9 D3D-448-GRAPHICS: a graphics signature past the console window keeps its inline part; the rest goes to the argument block
On the console the parameter that does not fit and every one after it go to the argument block behind
s[0:1], the ones before stay inline. No VS, PS or GS of 1.0.2.1 reads s[0:1] as an address
(root_spill_census), so the graphics bind point now lays the inline part out from s8 and stores nothing
for the rest (rt::rootsig::Spill::block), instead of giving the whole signature the PC layout. A write
to such a parameter is dropped before kNoSgpr plus an offset could wrap to dword 0. The retail start-up
signatures (25 and 30 dwords, every parameter visible to every stage, #974 review) are the case; the
per-visibility log line is gone, LEONIDA_GRAPHICS_ROOT_LAYOUT=pc stays. Compute still refuses a spill.
2026-11-24 19:53:18 +01:00
8c1b8da152 Merge main into d3d12/barrier-into-undefined
main gained its own Part K in vk_command_replay_test and a sentence in the
same bullet of docs/d3d12_vulkan.md (D3D-838, pull request 751). Both stay as
they are on main; this branch's release test becomes Part L, and the doc
bullet for LayoutAfter = UNDEFINED names it so.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 12:45:05 -06:00
6293c1c4f8 Merge pull request #935 from narekshaghoyandev/ubiq-retire-tickets-dedup-wait
Merging.

**Why merged:** RT-RETIRE-TICKETS-DEDUP-WAIT: pending_through() merges entries per semaphore to the highest value, and completed_ can no longer move backwards. moffington (ASan/UBSan, with a differential test that fails on the base), Timon360SB, KernelSmoker and SweatierKey checked it independently.

**Why it's good:** retire_tickets 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. Merged alone onto main 32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e224: no conflicts, and none of these touch the files #891/#882 changed. 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 13:38:54 -05:00
9ca049ebc3 Merge pull request #751 from abnalstlll-byte/restore/old-10048-sync-copy-clear-stage
Merging.

**Why merged:** OLD-10048: SYNC_COPY maps to COPY|CLEAR, so WriteBufferImmediate (vkCmdUpdateBuffer) and the query zero-fill are ordered before later copies. moffington reproduced the read-after-write hazard on the base, and Timon360SB and SweatierKey checked it independently. Part K of vk_command_replay_test covers it.

**Why it's good:** vk_command_replay, d3d12_state_map and replay_query_edges 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. Merged alone onto main 32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e224: no conflicts, and none of these touch the files #891/#882 changed. 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 13:38:42 -05:00
4c8efebcf6 Merge pull request #535 from tahffo68hk-hash/fix/vk-sampler-unnorm-bias
Merging.

**Why merged:** VK-SAMPLER-UNNORM-BIAS: an unnormalized-coordinates sampler gets mipLodBias 0, which VUID-VkSamplerCreateInfo-unnormalizedCoordinates-01074 requires. kawaii-shakal ran it under ASan/UBSan and showed the new check fails on main.

**Why it's good:** gfx10_descriptors and d3d12_descriptor 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. Merged alone onto main 32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e224: no conflicts, and none of these touch the files #891/#882 changed. 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 13:38:30 -05:00
3f20394739 Merge pull request #516 from sodove/fix/d3d12-clear-depth-range
Merging.

**Why merged:** D3D-CLEAR-DEPTH-RANGE: enables VK_EXT_depth_range_unrestricted where the device has it, so depth clears outside [0,1] (and NaN) behave like D3D12 instead of being clamped. Without the extension it keeps clamping, and NaN becomes 0. Four independent passes; on AMD (660M, 7900 XTX), d3d12_clear still fails only on the NaN rows, which is the driver issue tracked in #307, not this PR.

**Why it's good:** On the 4070 SUPER with validation on, main's d3d12_clear_test exits 1 with 4x VUID-VkClearDepthStencilValue-depth-00022. With this PR it exits 0 with no VUIDs, and the 1.5 / -0.5 / NaN clears match WARP. The new d3d12_clear_restricted_depth passes, and so do d3d12_clear and d3d12_clear_formats.

Tested on Windows 11 / RTX 4070 SUPER (NVIDIA 621.24), VS 2022 + Ninja RelWithDebInfo, Vulkan SDK 1.4.363.0. Merged alone onto main 32950551e, its ctests pass both plain and with LEONIDA_VK_VALIDATION=1. Cumulative: #516, #535, #751, #935 and #662 merged onto main 955d9be34. There the repo-consistency set gives 571 passed / 5 skipped / 0 failed, compileall is clean, and full ctest is 307/309. The 2 failures are the same pre-existing ones as main (d3d12_execute_indirect_validation, d3d12_depth_resolve), with the same 11 skips. git merge-tree against current main 71f99e224: no conflicts, and none of these touch the files #891/#882 changed. 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 13:38:18 -05:00
3ba069ebea Merge pull request #891 from SweatierKey/feat/bl6-frame-pacing-drift
runtime: frame pacing drift and latency percentile reporting (BL-6)
2026-11-24 19:24:15 +01:00