Commit Graph

1487 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
99167bcaf3 Merge pull request #2737 from OreoFR/carry/pr-2062
reprend #2062: d3d12: say when the driver's pipeline cache stops keeping new pipelines (RT-PIPELINE-CACHE-GROWTH-STALL)
2026-11-30 18:38:24 +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
c13dc82a51 submit_phases: keep timing scopes for the frame and floor lines
timing_wanted() looked only at the periodic line and the dev overlay, so with
LEONIDA_SUBMIT_PHASES_SECONDS=0 the frame and floor lines (on every
LEONIDA_SUBMIT_FRAME_SECONDS, 10 s by default) were printed with zero phase
times (found by merzleckeier on #2738). They read the phase times too, so they
now count as a consumer. The new test turns the periodic line off before the
first read and checks that scopes stay timed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 16:34:27 +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
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
bede3ad0d3 Merge origin/main (f9f3ec4c6) into the carry of #2062
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Galaxy <23423870+thegalaxydev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:29:20 +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
efc1929908 runtime: eliminate Windows 11 full-space commit_pages_locked broadcast storm, ShadowPages/TitleTextureCells guard conflict, and streaming budget bursts 2026-11-30 04:34:17 -05:00
1aefed0dac runtime: fix present_mutex AB-BA deadlock, cross-queue relay cycle, and held-queue stalls 2026-11-29 21:05:26 -05:00
d1539971a9 runtime: programmable sample positions only for multisampled targets (RT-SAMPLE-LOCATIONS-MSAA-ONLY)
#778 filled the sample-locations grids from 1 sample upwards, so every 1x depth-stencil image was created
sample-locations compatible and carried sample locations through its transitions. D3D12 only has programmable
sample positions for multisampled targets; since #778 the world phase loses the device on an RTX 5080. Keep 1 sample
out (SamplePositions::programmable_count): 1x depth images are plain again, MSAA keeps the feature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwPPpwX5RYWwXCnj43U
2026-11-29 22:43:46 +01:00
1d0867c4a7 runtime: zero-init TargetView trailing padding and allow clamped 0 ms graphics interval in vk_gpu_profile_test 2026-11-29 15:27:45 -05:00
8f7101df63 Merge pull request #1179 from MalexAson/fix/srgb-rtv-clear-encode
vulkan_replay: sRGB render-target clears are encoded in the layer, as WARP encodes them (D3D-CLEAR-SRGB-ENCODE)
2026-11-29 20:00:27 +01:00
947c54abac Merge pull request #1164 from lixonik/d3d-sparse-image-queue-family
d3d12: choose sparse-capable queues for sparse textures (D3D-SPARSE-IMAGE-QUEUE-FAMILY)
2026-11-29 20:00:18 +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
8db8335d23 tests/ci: fix llvmpipe skip on cs_w64x_dynamic_r32_uint, Set 0 binding 29 counts, and D16S8 table row 2026-11-29 12:59:52 -05: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
f051ae5183 d3d12/tests: fix Windows MSVC build, CopyMemory collision, copy parity guard, and --no-ftz32 probe 2026-11-29 11:41:49 -05:00
1d3da5ebc7 Merge pull request #959 from Kadamitas/fix/gfx10-sampler-z-filter
gfx10: preserve the separate volume filter in sampler words
2026-11-29 16:46:15 +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
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
f72a68bc0b Merge pull request #2089 from KushGene/fix/vk-sampler-lod-order-and-deriv-adjust
gfx10_descriptors: clamp sampler maxLod >= minLod and guard DERIV_ADJUST_EN integer border (VK-SAMPLER-LOD-ORDER-AND-DERIV-ADJUST)
2026-11-29 16:43:52 +01:00
40b88ff7fc Merge pull request #2051 from alexandersato0830/codex/spirv-word-endianness
Normalize SPIR-V file byte order (SPIRV-WORDS-ENDIAN)
2026-11-29 16:43:39 +01:00
38719cc36f Merge pull request #1775 from potatoe0100/carry/old-9773
OLD-9773: d3d12: refuse a pipeline whose shader needs VK_KHR_maintenance8 on a device without it
2026-11-29 16:42:29 +01:00
6024351682 Merge pull request #1739 from IlyassRS3/fix/descriptor-table-guards
runtime: guard DescriptorTable 9-way collision, read_slots width, and change-tracking OOM
2026-11-29 16:42:16 +01:00
daf8122003 Merge pull request #1681 from ImLele69/rt-alloc-no-rebar
d3d12_vulkan: without Resizable BAR, textures and staging buffers leave the BAR window to the arena; tile heaps prefer VRAM (RT-ALLOC-NO-REBAR-RETRIES)
2026-11-29 16:42:02 +01:00
3ef235a681 d3d12/vulkan: rebind released sparse pages to shared zero page on AMD proprietary 2026-11-29 10:40:34 -05:00
a58d22fe2e Merge upstream ProjectLeonida/mandy main (ddfe24fba) into fix/rendering-correctness 2026-11-29 09:37:37 -05: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
8c527753cb Merge pull request #2309 from narekshaghoyandev/ubiq-indirect-draw-stats-guards
indirect_draw_stats: guard null FILE* in report and out-of-range Event in note/skip
2026-11-29 15:26:30 +01:00
503831b2cb Merge pull request #2310 from narekshaghoyandev/ubiq-queue-families-slot-max
queue_families: select earliest slot in pick_queue_slot when all slots are UINT32_MAX
2026-11-29 15:26:21 +01:00
e18c786017 Merge pull request #2336 from narekshaghoyandev/ubiq-pipeline-wait-window
pipeline_wait: guard non-positive window and signed subtraction overflow in title_submitting
2026-11-29 15:25:56 +01:00
8969b55559 Merge pull request #2313 from narekshaghoyandev/ubiq-dev-status-null-name
dev_status: guard nullptr in Builds::name()
2026-11-29 15:25:47 +01:00
091bfa8d4d d3d12/vulkan(r9a): fix pending_stream dword6 refill, gpu_owned eviction, COPY_CLIP, and sync slots 131/132 2026-11-29 09:25:40 -05:00
51d343b861 Merge pull request #2043 from alexandersato0830/codex/shader-library-utf8-module-paths
Use UTF-8 for shader library module filenames (SHADER-LIBRARY-UTF8-MODULE-PATHS)
2026-11-29 14:21:11 +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
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
ce907ce756 Merge origin/main into carry/pr-2062
d3d12_vulkan_device: report_pipeline_cache_growth() before main's over_save_limit check, note_pipeline_cache_size() before main's journal setup. Docs: main's paragraph, then the PR's growth-stall text without its old 256 MiB cap line.

Co-authored-by: Galaxy <23423870+thegalaxydev@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:25 +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
44ddf9b052 Merge pull request #1600 from thiefyzheng/fix/test-tempdir-stripped-env 2026-11-29 13:44:40 +01:00
399a5eabdf d3d12/vulkan: implement Xbox OMSetSampleMaskX (slot 142) with runtime SPIR-V quad mask 2026-11-29 07:17:27 -05:00
69b3780fb7 d3d12/vulkan: enable partial-mip streaming with minLod clamp and active_span 2026-11-29 06:36:45 -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
484d98388c rendering(r4b-rt): add VK_EXT_shader_image_atomic_int64 R64ui binding 29, buffer UAV R32_UINT format, and T# tail/extent guards 2026-11-29 06:34:52 -05:00
eb1cf5e96e rendering(r3): fix Blob A CB_TARGET_MASK (+0xcc), depth bias, T# bugs 1A-1D, OMSetDepthBounds replay, and stage-link polish 2026-11-29 06:34:13 -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
7ba56174b8 rendering(r1): fix read-only DSV HTILE layout, D16S8 SRVs, non-array T# decode, and PRESENT_DUMP
- U1: preserve D3D12_DSV_FLAG_READ_ONLY_* on TargetView; remap read-only depth layouts to GENERAL when sampled_in_general; emit shader-read barrier visibility and gated VK_ATTACHMENT_STORE_OP_NONE
- U2: add VK_FORMAT_D16_UNORM_S8_UINT to gfx10::format_table so DXGI 119 SRVs succeed on AMD/RADV
- T1/T2: decode non-array GFX10 image_1d/image_2d/image_2d_msaa as layer_count=1 (ignoring linear pitch/depth in WORD4[12:0]); route image_1d_array to TEXTURE1D
- P0: keep capture_ptr_ alive across splash handoff when LEONIDA_PRESENT_DUMP is enabled
- Add capped tsharp-refuse and slot-57 fallback diagnostics + unit/VVL GPU tests
2026-11-29 06:34:13 -05:00