Commit Graph

1140 Commits

Author SHA1 Message Date
9d41505a44 d3d12/vulkan: staged VRAM arena, DMA readback batching, parallel shadows, stream-pool fix
On top of PR #2566 (8db8335d2), combines verified runtime performance and
correctness improvements for non-ReBAR Vulkan GPUs (tested on Linux / Wine /
RTX 3090 24 GB, BAR1 = 246 MiB, driver 590.48.01):

- Stage 4 GiB GPU address arena + overflow TitleBufferWindows slabs in
  DEVICE_LOCAL VRAM with HOST_VISIBLE staging mirrors (arena_staging.h,
  arena_staging_test.cpp).
- Fix startup glibc realloc() race by caching max_compute_shared_memory_size,
  sharing mutex-guarded VkPipelineLayouts, and eagerly loading pipeline_cache()
  during single-threaded Device construction.
- Stage 9a-1: batch retired arena + external window host readbacks into a
  single copy_buffers_sync() submission on the dedicated DMA copy queue
  (wb: 27.6 ms -> 2.35 ms/frame).
- Stage 9a-2: parallelize ShadowPages::refresh across 4 persistent threads
  via ShadowRefreshPool (shadows: 26.9 ms -> 10.2 ms/frame).
- Fix resolve_pool_memory() zeroing out root descriptors probed with
  kRootViewBytes (64 KiB) near the end of committed stream-pool blocks
  (stream pool unbacked: 131,072 -> 16-33, root view unbacked: 0).

AI-assisted. Verified with 151/151 portable Linux CTest passing and Windows
MSVC build + retail boots on RTX 3090 (590.48.01).
2026-12-01 16:37:00 +02:00
beefb8927a Merge pull request #1880 from thiefyzheng/fix/texel-copy-fixedwidth
xg_xs copy_elements: dispatch fixed element widths 1/2/4/8/16 to a compile-time-sized copy loop (RT-TEXEL-COPY-FIXEDWIDTH)
2026-12-01 12:11:20 +01:00
47fa73a566 runtime: make a missing return an error, not a warning (#2748)
* runtime: make a missing return on some paths an error

MSVC has two codes for a function that reaches its closing brace: C4716 whenthere is no return at all, already an error by default, and C4715 when somepaths return and others do not, which is a warning at the default warning level(measured: cl /EHsc alone reports it, /W4 is not needed). A change in this treedropped a return out; from a function with early returns, so it was C4715, andthe build stayed green. A full Release build of this commit reports none, sothe flag costs nothing today.

* runtime: keep /we4715 out of the assembler command

merzleckeier measured it on Windows Server 2025: add_compile_options
(/we4715) puts the switch on ml64's command line too, and MASM answers
'warning A4018: invalid command-line option : /we4715' - the same reason the
/utf-8 line above this one carries a COMPILE_LANGUAGE filter. Reproduced here:
unfiltered, one A4018 line from abi_probe.asm; filtered, none, and the C++
half still reports error C4715 when a return is removed.

---------

Co-authored-by: fiestorra <fiestorra@users.noreply.github.com>
2026-12-01 11:49:12 +01:00
4902100668 d3d12_queue_wait_timeout: the same 60 s budget as d3d12_queue_wait (#761)
The control runs create_vulkan_device_standalone before it waits its 20 ms, so its TIMEOUT covers the whole device bring-up, exactly like the positive test above it (TIMEOUT 60). Under a parallel ctest that bring-up can pass 10 s, and CTest then kills the process: WILL_FAIL inverts an exit code but not a ***Timeout, so the negative control failed for a reason it does not control.

OLD-2970 / TEST-586

Co-authored-by: whoalin1 <207920491+whoalin1@users.noreply.github.com>
Co-authored-by: Gemini 4 Neon <noreply@google.com>
2026-12-01 11:48:32 +01:00
1cd6eaf7c6 copy_elements: dispatch fixed element widths 1/2/4/8/16 to a compile-time-sized memcpy loop
copy_elements ran a runtime-sized std::memcpy per texel/block (the call is not
inlined), which dominates TitleImageUpload::write on runtime texture refresh.
The per-row element loop is now copy_tiled_row<Into, Width>, chosen by one
switch on format.bytes per row: 1/2/4/8/16 get a constant-size memcpy, every
other size takes the unchanged runtime-size loop. Addresses (row/column tables,
pitches, linear fast path) are untouched, so the bytes written are identical,
including for unaligned pointers and pitches and in both directions.

texel_copy_test compares copy_elements with the original loop over the whole
destination buffer: tiled and linear, mips and tails, arrays, volumes, widths
1/2/4/8/16 plus non-specialized 3/6/12, misaligned buffers and padded pitches.
2026-11-30 23:34:45 +00:00
f0143cd5ff Merge pull request #2732 from OreoFR/carry/pr-2173
reprend #2173: d3d12_xs: say so when LEONIDA_D3D12=vulkan is asked of a runtime built without the Vulkan device (RT-VULKAN-REQUESTED-NOT-BUILT)
2026-11-30 18:37:45 +01:00
ad25611b53 Merge pull request #2729 from OreoFR/carry/pr-220
reprend #220: d3d12: validate CreateShaderResourceView descriptors (reopens #5275)
2026-11-30 18:16:12 +01:00
efe695aa91 Merge pull request #2738 from OreoFR/carry/pr-2031
reprend #2031: runtime: harden submit_phases period parsing and skip Scope overhead when disabled
2026-11-30 18:15:34 +01:00
cee1cb1d31 Merge pull request #2735 from OreoFR/carry/pr-2016
reprend #2016: runtime: guard null and invalid sizes in value_write_sink and add unit tests (RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS)
2026-11-30 18:15:17 +01:00
149e3835f3 Merge pull request #2716 from OreoFR/carry/pr-1050
reprend #1050: runtime: replay the console list's inline records as their vtable calls (BL-3)
2026-11-30 18:15:03 +01:00
ff55c339e8 Merge origin/main (f9f3ec4c6) into the carry of #2029
Current main after #2566. New conflict on top of the earlier carry merge:
runtime/shims/d3d12_xs_alloc_size.h, align_up_saturating: main (#2027)
returns value when to == 0, the PR when to <= 1; for to == 1 the rounding
formula gives value as well, so both agree; the PR's guard and comment kept.

Co-authored-by: Ilyass Roussi <76879547+IlyassRS3@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:31:48 +01:00
30857b8b72 Merge origin/main (f9f3ec4c6) into the carry of #2016
Current main after #2566. New conflict on top of the earlier carry merge:
runtime/CMakeLists.txt: main added the title_frames, title_mirror_hooks and
title_heap tests at the place of the PR's value_write_sink test; all kept,
the PR's test after main's.

Co-authored-by: abnalstlll-byte <284980532+abnalstlll-byte@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:31:35 +01:00
1d4dc90ea0 Merge origin/main (f9f3ec4c6) into the carry of #220
Current main after #2566. New conflict on top of the earlier carry merge:
runtime/shims/d3d12_vulkan_device.cpp: main added a three-argument
bind_title_image overload where the PR adds valid_shader_4_component_mapping;
both functions kept.

Co-authored-by: justr4mzi <243612488+justr4mzi@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:29:51 +01:00
b291426966 Merge origin/main (f9f3ec4c6) into the carry of #2031
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Ilyass Roussi <76879547+IlyassRS3@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:29:22 +01:00
0590fe2777 Merge origin/main (f9f3ec4c6) into the carry of #2173
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: quartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:29:05 +01:00
f216975939 Merge origin/main (f9f3ec4c6) into the carry of #1050
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Gavin Bloom <g4v1nbl00mt4mu29@tamu.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:19:16 +01:00
b8508a974b Merge branch 'main' of https://github.com/ProjectLeonida/mandy into fix/rendering-correctness
# Conflicts:
#	tests/semantic/test_interp_computed_ij_fallback.py
2026-11-30 04:36:05 -05:00
18936010df chore: remove dead Tier 1 files, wire 5 unwired C++ tests, and fix play.ps1 path 2026-11-29 20:00:40 -05:00
ef31dc92c3 Merge pull request #2027 from abnalstlll-byte/feat/rt-xs-alloc-size-guards-and-tests
runtime: guard align_up_saturating against zero alignment and add unit tests (RT-XS-ALLOC-SIZE-GUARDS-AND-TESTS)
2026-11-29 19:28:53 +01:00
aacc89a1c3 Merge pull request #1395 from Diegobecker07/old-9961-skip-asserts
runtime: LEONIDA_SKIP_ASSERTS steps over guest asserts without a trace (OLD-9961, RT-526)
2026-11-29 19:27:49 +01:00
eff40832ef Merge remote-tracking branch 'refs/remotes/mandy/main' into fix/rendering-correctness
# Conflicts:
#	runtime/shims/d3d12_com.cpp
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/command_list.h
#	runtime/src/vulkan_replay.h
#	runtime/test/gfx10_descriptors_test.cpp
2026-11-29 11:51:06 -05:00
90c54a3278 Merge origin/main into carry/pr-220
runtime/shims/d3d12_vulkan_device.cpp: main made image_descriptor serve
unordered-access views too (storage), added the title texture registry
beside it and moved the buffer SRV encoding into write_buffer_srv. Main's
code is kept and the PR's checks are applied to shader-resource views only
(!storage): the component mapping and ResourceMinLODClamp at the start, the
typeless view format checks before the format path, the mip and layer
range checks after main's layer bounds; and the buffer SRV mapping check
before CreateShaderResourceView calls write_buffer_srv.

Co-authored-by: justr4mzi <243612488+justr4mzi@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:43:47 +01:00
0cedc3a625 Merge pull request #1918 from kawaii-shakal/fault-address-owner
d3d12: the device-fault report names what the process and the driver had at each fault address (RT-FAULT-ADDRESS-OWNER)
2026-11-29 16:45:59 +01:00
cec4182c2d Merge pull request #1424 from Anonymous78e/ctest/xdxr-check-timeout
runtime: xdxr_build_check gets its own ctest TIMEOUT (CTEST-XDXR-CHECK-TIMEOUT)
2026-11-29 16:45:32 +01:00
bfb54b8759 Merge pull request #778 from kawaii-shakal/d3d-sample-positions
d3d12: replay programmable sample positions (D3D-SAMPLE-POSITIONS)
2026-11-29 16:44:17 +01:00
950259cd40 Merge pull request #1931 from kawaii-shakal/io-trace
dstorage, fs: LEONIDA_IO_TRACE logs every read the title asks for, flushed as it goes (RT-IO-TRACE)
2026-11-29 16:43:26 +01:00
a58d22fe2e Merge upstream ProjectLeonida/mandy main (ddfe24fba) into fix/rendering-correctness 2026-11-29 09:37:37 -05:00
99c11d5827 Merge pull request #2215 from whoalin1/runtime-incremental-no-reloc-fixtures
runtime: link no-relocation fixtures without incremental linking
2026-11-29 15:27:02 +01:00
d8f6be3234 Merge pull request #2009 from IlyassRS3/perf/rt-uav-clear-fast-pack-and-tests
runtime: speed up uav_clear format lookup and channel pack/unpack with unit tests (RT-UAV-CLEAR-FAST-PACK-AND-UNIT-TESTS)
2026-11-29 15:26:43 +01:00
ddfe24fbad Merge pull request #2046 from abnalstlll-byte/feat/rt-xs-placed-depth-guards-and-tests
runtime: guard null out pointers, add inspection helpers and unit tests for PlacedDepthTextures (RT-XS-PLACED-DEPTH-GUARDS-AND-TESTS)
2026-11-29 15:14:56 +01:00
528e0862f2 runtime: LEONIDA_SKIP_ASSERTS steps over guest asserts without a trace (RT-526)
A diagnostic for the retail boot (RT-5 follow-ups), off the hot path and with no behaviour change unless asked
for: LEONIDA_SKIP_ASSERTS=N (src/assert_skip.h, installed by main.cpp before any image code runs under
--init/--run): a vectored handler, added last, steps over up to N int3 (0xCC) at addresses in no host module and
logs each one as module+RVA (and as an int3_skipped trace event when --trace is open). After N it says so once
and the next int3 ends the run as before. An int3 in a host module, a breakpoint with no 0xCC at its address, or
a RIP that is neither at nor one past the 0xCC is passed on. Needs no --trace and no debugger.

Tests (synthetic, no game files): assert_skip_test (int3 in a VirtualAlloc'd page, the limit, a host-module int3,
a two-byte int 3, value parsing) and run_tiny_game_skip_asserts (two int3 in the mapped stand-in game, stepped
over end to end).

Carried over from old upstream PR 9961 (#228) without its caller logging for forwarded device slots, which the
carry-over of old PR 9990 (#1390) brings instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 09:55:11 -03:00
db567419fa Merge origin/main into carry/pr-2029
d3d12_xs_alloc_size: the PR's single-pass console_placement with main's title_descs/title_layout and console_unordered_access_size added to the per-description overrides; CMakeLists: xs_alloc_size_test and appnotify_test both kept.

Co-authored-by: Ilyass Roussi <76879547+IlyassRS3@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:31 +01:00
2d292240e8 Merge origin/main into carry/pr-2016
CMakeLists: value_write_sink_test (PR) after main's console_heap_slot_records and shadow_keep tests (main renamed console_heap_vsharp_slots).

Co-authored-by: abnalstlll-byte <284980532+abnalstlll-byte@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:29 +01:00
3beeb56bfb Merge origin/main into carry/pr-2031
submit_phases: main's nested-phase Scope kept; the PR's skip now applies only when nothing reads the times (timing_wanted(): period 0 and LEONIDA_DEV_OVERLAY not 1).

Co-authored-by: Ilyass Roussi <76879547+IlyassRS3@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:28 +01:00
34ddcc1526 Merge origin/main into carry/pr-2173
CMakeLists: d3d12_backend_test (PR) and the Vulkan headers version check (main) both kept.

Co-authored-by: quartz-heron-58 <245169279+quartz-heron-58@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:23 +01:00
3535eb5c4b Merge pull request #1910 from IlyassRS3/fix/rt-vk-helper-proc-cache-and-guards 2026-11-29 13:44:58 +01:00
0e7e1059d3 Merge pull request #2575 from MoonEyes/claude/d3d-bundle-execute-indirect-37f83c 2026-11-29 13:44:13 +01:00
c34cec72ee Merge pull request #2593 from Bloh09/fix/ci-main-red-tests 2026-11-29 13:44:04 +01:00
399a5eabdf d3d12/vulkan: implement Xbox OMSetSampleMaskX (slot 142) with runtime SPIR-V quad mask 2026-11-29 07:17:27 -05:00
85f806b916 rendering(r8a): forward Xbox DispatchMesh (slot 129), queries (28-30), and CopyMemoryToMemoryX (62)
Xbox console list slot 129 (DispatchMesh -> PC slot 79) was silently dropped as unforwarded, skipping all direct mesh-shader 3D-to-UV ped/decoration texture bakes and leaving 9/10 BC3_UNORM_SRGB (and BC7/BC1) composited textures 100% all-zero on the GPU.

Forward list slot 129 -> PC 79 (DispatchMesh) with bundle deferral and z==0 draw guard, forward live query slots 28..30 -> PC 52..54 (BeginQuery/EndQuery/ResolveQueryData, updating kConsoleBeginQuery/kConsoleEndQuery), implement CopyMemoryToMemoryX (slot 62, older layout slot 60) via VA-based CopyMemory replay with split-chunk and overlap-staged copies, and add replay + mock unit tests.
2026-11-29 06:36:45 -05:00
7350c5d405 rendering(r2): fix PSO read-only DSVs (U1b), T# zombie filter (T3), and runtime VS/MS->PS varying linking
- U1b: track depth_writes/stencil_writes on GraphicsPipeline so writable DSVs bound with DepthWriteMask=ZERO PSOs stay in GENERAL and decompress RADV HTILE
- T3: reject WORD4 reserved bits (0x6000C000) and fmt==0 as not_tsharp, gate 3D UAV slice check after owner lookup, and cap tsharp-refuse per reason (<8)
- Stage linking: add runtime/src/spirv_stage_link.h + unit tests and wire into create_graphics / lazy stage_words to remap PS Input Locations via FSSM + DXBC OSG1/PSG1/ISG1
2026-11-29 06:34:13 -05:00
314b4e73dd Merge upstream ProjectLeonida/mandy main (b589e0fe0) into round10 base
# Conflicts:
#	docs/design.md
#	runtime/shims/d3d12_vulkan_device.cpp
#	runtime/src/queue_holds.h
#	runtime/src/shader_library.h
#	runtime/src/vulkan_backend.h
#	runtime/src/vulkan_replay.h
#	runtime/test/vk_harness.cpp
#	tests/semantic/test_wave32_lane_select.py
#	tools/lane_masks.py
#	tools/rdna2spirv.py
2026-11-29 06:33:39 -05:00
f58143876e Merge ProjectLeonida/mandy main into claude/d3d-bundle-execute-indirect-37f83c 2026-11-29 09:49:45 +00:00
fb5d04b3f9 Merge origin/main into #1050 (carry prep)
runtime/CMakeLists.txt: kept both test blocks (console_list_records and main's gpu_label_memory).

Co-authored-by: Gavin Bloom <209302503+baldyb4242@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 09:41:07 +01:00
a6a65a4522 Merge pull request #2527 from Tyrannys/claude/address-guard-sharing
Address guard: share the page-table buffer across queue families (RT-ADDRESS-GUARD-QUEUE-SHARING)
2026-11-29 09:20:03 +01:00
451afe327b Merge pull request #2523 from Tyrannys/rt-replay-dropped-dispatch-clamp
vulkan_replay: a dropped indirect dispatch prepares and emits no clamp pass (RT-REPLAY-DROPPED-DISPATCH-CLAMP)
2026-11-29 09:19:54 +01:00
0125399d41 Merge pull request #1129 from MalexAson/fix/subgroup-shaders-spirv-tools
cmake: the d3d12_subgroup_test shader rule names the spirv tools folder (BUILD-SUBGROUP-SPIRV-TOOLS)
2026-11-29 09:11:25 +01:00
985dfac773 Merge pull request #2083 from alexandersato0830/codex/title-hud-vulkan-guard
Gate the title HUD test on Vulkan headers (CMAKE-TITLE-HUD-OPTIONAL-VULKAN)
2026-11-29 09:11:13 +01:00
064a3b253e Merge pull request #2096 from Tauwni/fix/null-descriptor-generated-dir
cmake: generated/ exists at configure time and before vk_null_descriptor_test's rule; no "Failed to open file" on a fresh build (BUILD-NULL-DESCRIPTOR-GENERATED-DIR)
2026-11-29 09:11:03 +01:00
29c0ad95ca Merge pull request #1783 from IlyassRS3/fix/rt-queue-holds-pump-safety
runtime: make QueueHolds pump handoff race-free, exception-safe, and per-instance (RT-QUEUE-HOLDS-PUMP-SAFETY)
2026-11-29 09:10:32 +01:00