Commit Graph

2239 Commits

Author SHA1 Message Date
4a305d0666 d3d12/vulkan: bind/map staging before binding VRAM buffer & document LEONIDA_EXTERNAL_WINDOWS_MB 2026-12-01 17:04:33 +02:00
8ebe7cc2e8 d3d12/vulkan + make_game: ReBAR DMA readback, budgeted staged slabs, test fixes & CLI wiring 2026-12-01 16:40:36 +02:00
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
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
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
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
db9f497bb0 Merge pull request #2725 from OreoFR/carry/pr-279
reprend #279: d3d12: min/max samplers honour filterMinmaxImageComponentMapping (D3D…
2026-11-30 18:37:03 +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
7663c34fcf Merge pull request #2739 from OreoFR/carry/pr-2029
reprend #2029: runtime: guard overflow/div-by-zero and remove duplicate passes in d3d12_xs_alloc_size
2026-11-30 17:50:48 +01:00
80355d34a8 Merge pull request #2733 from OreoFR/carry/pr-2085
reprend #2085: d3d12: one guarded copy per run of adjacent written geometry tiles (RT-GEOMETRY-READBACK-RUN-MERGE)
2026-11-30 17:25:12 +01:00
e3af360709 d3d12: keep the return of build_compute_pipeline, and align the new lines
The slow-pipeline line replaced the fprintf but also removed the function's
return out; - the body then fell off the end of a non-void function. MSVC at /W4
reports neither C4715 nor C4716 for this shape and the build stays green, so the
caller would have read an uninitialised ComputeBuild; the test suite does not
distinguish the two, which is why the earlier build-based check missed it.
Restored, and the new statements dedented to the block they belong to.
2026-11-30 15:35:28 +01:00
7acf84d38f d3d12: say where a slow pipeline came from, and whether its journal was written
The slow-pipeline line reported 	ook N s to build for a timer that starts before the journal file is read
and before the shared cache is asked, so it named a compile for what could be a cache lookup. Chasing a compile
cost from it is chasing the wrong number: a run with 16 such lines had compiled exactly one pipeline.

The line now names the source (a compile, the shared cache, or the pipeline's own journal file) and carries the
hit the journal reported, whether its cache was seeded from a file, and whether the file was written afterwards.
That is what turned three contradictory readings of the same log into one, on an RTX 4090 with a warm journal:
23 slow lines, all hit 0, seeded 0, written 1 - first-sight pipelines, each compiled once and journaled.
2026-11-30 15:26:46 +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
696e728777 Merge origin/main (f9f3ec4c6) into the carry of #2085
Current main after #2566. New conflict on top of the earlier carry merge:
runtime/test/geometry_views_test.cpp, header list: main added case 17 (the
command-list-epoch guard); the PR's two cases, numbered 17-18 in the earlier
carry merge, become 18-19 (header and the comments at the cases).

Co-authored-by: BubsMcgee <203599835+BubsMcgee@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:31:07 +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
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
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
d92dc7a4aa Merge origin/main (f9f3ec4c6) into the carry of #279
Current main after #2566; no new conflicts on top of the earlier carry merge.

Co-authored-by: Zilumz1 <221744236+Zilumz1@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 14:19:24 +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
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
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
cfd12b24fe d3d12: default descriptor table layout to tagged when no shader library modules are loaded 2026-11-29 14:26:37 -05: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
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
d78ac84ad8 d3d12: the typeless view-format checks apply to unordered-access views too
Main routes UAVs through image_descriptor (storage); the PR's test expects a
UAV of a typeless texture without a view format to stay a null descriptor,
as D3D12 refuses it.

Co-authored-by: justr4mzi <243612488+justr4mzi@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 18:44: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
223df1094d Merge origin/main into carry/pr-279
runtime/test/vk_test_device.h: the PR's filterMinmaxImageComponentMapping
query and main's shaderOutputViewportIndex feature were added at the same
place; both are kept.

Co-authored-by: Zilumz1 <221744236+Zilumz1@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:42:04 +01: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
ac93aac0d4 d3d12: gate write_tsharp_index_words on in_known_heap during stream publish 2026-11-29 11:27:30 -05: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
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
15701e412d Merge pull request #1894 from ecox982745/ecox/title-staged-per-format
d3d12: stage title textures when their format or usage rules out host copies
2026-11-29 16:43:14 +01:00
3580a9d308 Merge pull request #1831 from potatoe0100/carry/old-9966
gameinput: preserve controller transitions between polls (OLD-9966, carries #233)
2026-11-29 16:42:49 +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
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
43d2d37c7c Merge pull request #2331 from narekshaghoyandev/ubiq-title-image-census-guards
d3d12_title_image_census: guard null entries/resources and use stable_sort
2026-11-29 15:26:09 +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
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
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
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
ca1c246a12 Merge origin/main into carry/pr-2085
geometry_views: main's written_vas_-only refresh kept; run_needed() looks each tile up again in tiles_ and skips dead views (no Tile* pointers, as qhukz13 asked). Test: main's tests 5-16 plus the PR's two as 17-18.

Co-authored-by: BubsMcgee <203599835+BubsMcgee@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 13:51:24 +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
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