Commit Graph

16 Commits

Author SHA1 Message Date
02d719cdac Merge main into title-window-overflow; keep only the window-cap test
Main's ba626820e already handles a title address past
LEONIDA_TITLE_WINDOWS_MB: the persistent geometry copy backs it, or
else every view writer emits a zero-size V# (loads 0, stores dropped),
so the raw VA never reaches the GPU (#1537). That replaces this branch's
zeroed scratch window, so the runtime and docs side take main's version.

The d3d12_title_window_cap test stays, rewritten for main's behaviour:
with a cap of 0, two CBVs of private title memory are written zero-size
(no base, no records, never the raw VA), no window is made, and a
dispatch through one reads zeros. Main had no test that dispatches
through an over-cap title address.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 07:41:35 -06:00
29c356b0bc runtime test: cs_user_data's descriptor-word mode gets its own sentinel
d3d12_rebound_tables, d3d12_rebound_second_device and
d3d12_api_descriptor_copy went from pass (main) to fail at line 896 of
d3d12_title_va_test: 0/64 GPU words matched on both submissions,
although the mirrored CBV in the layer heap was right (checked by
printing the slot after the submission). They had been hidden behind
line 502 in the same executable.

main was right. Its rebound-table check selects the test shader's
indexed CBV mode with s5 = 0xFFFFFFFB. #1723 added a mode that returns
a descriptor's words instead, also on 0xFFFFFFFB, ahead of main's
branch, so the rebound tables read the words at s8 (unset, address 0)
instead of the CBV's data. #1723's mode now uses 0xFFFFFFFA, which
nothing else uses, and its one caller (the out[3] dispatch in
check_title_va) passes that. Both checks run as written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 06:00:46 -05:00
ba626820ec Integrate post-story-load memory, queue and Vulkan runtime changes
Preserve physical window aliases across remaps, order console list values,
and replay bounded indirect graphics with captured draw state. Coordinate
pipeline lifetime, texture refresh and queue teardown. Add synthetic CPU
and GPU coverage for the integrated paths.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-authored-by: ivanepsilondelta <264061546+ivanepsilondelta@users.noreply.github.com>
2026-11-25 03:44:43 -06:00
2c7440fed8 Merge main into title-window-overflow
The only conflict was runtime/test/d3d12_title_va_test.cpp: keep the
--window-cap branch (returns early) and main's declined-import and
import-over-shadow checks after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 03:11:58 -06:00
6d66718f3e d3d12: title memory past the window cap names a zeroed scratch window (RT-TITLE-WINDOW-OVERFLOW)
Past LEONIDA_TITLE_WINDOWS_MB, or with no arena room for a window,
resolve_title_memory handed the GPU the title's raw VA. That names
nothing of the device's, and one read of it lost the device at the
world start (#1537). Reserve 16 MiB + 64 KiB of zero-filled arena with
the first window and point such addresses into it instead: the cost is
a wrong result, not the device. The raw VA is kept only when even the
scratch did not fit (logged once).

d3d12_title_window_cap runs d3d12_title_va_test --window-cap with a cap
of 0: two views of the title's memory name the arena, share the
scratch, and a dispatch through one reads zeros.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:21:56 -06:00
9f82f136f6 d3d12: pin the pages of a live host import
RADV checks the pages of a VK_EXT_external_memory_host import again at
every submission, and once one of them is read-only the kernel rejects
that submission and every later one. The slot-133 shadow trackers and the
geometry watch make copied title pages read-only to see the next write,
and a page can be both under a shadow and under a live import.

A new leonida::kernel_writes::hold pins a range until release() and opens
it. Unlike begin_write it records the pin when no opener is set yet (no
tracker exists), so a tracker made later passes over the pages too;
ShadowPages and the geometry watch already pass over pinned pages. The
slot-133 import (create_host_buffer) and the console descriptor heap
import take the pin before vkAllocateMemory, so no guard lands between
the writability check and the import, and end it on every path that
frees the memory: a declined or failed import and the release.

The finding and the design are NateWeav's (coordination issue #14,
comments 7141859164 and 7142359977); this implements their description.
As in their tree the pin is unconditional; a driver gate is not done.

Tests: kernel_writes_test checks hold and release on the pin set (no
opener, with an opener, alongside a file read's pin). d3d12_title_va_test
in its imports-on mode makes a shadow over pages, checks that its tracker
guards them, then imports the same pages and checks that two submissions
leave them writable, that the pin ends with the import and that the
tracker guards them again afterwards.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:03:36 -05:00
599fe9f221 d3d12: free a declined slot-133 import at once
create_host_buffer returned E_NOTIMPL for an import the driver put below
the arena with its memory still allocated. The resource's destructor then
handed that memory to the deferred queue, so it outlived the next
submission while the shadow buffer made instead over the same address
guarded its page read-only. On RADV a read-only page under a live
VK_EXT_external_memory_host import makes the kernel reject that
submission and every later one ("The CS has been rejected", then
VK_ERROR_DEVICE_LOST).

Every return after vkCreateBuffer that declines the import now destroys
the buffer and frees the memory before it returns; nothing was submitted
with them, since the resource is registered only on success. A counter of
live slot-133 imports (rt::d3d12::title_host_imports) lets a test see it.

The finding and the design are NateWeav's (coordination issue #14,
comments 7141859164 and 7142359977); this implements their description.

Test: d3d12_title_va_test in its imports-on mode (d3d12_geometry_views)
places two buffers, at a page start and 4 bytes into a page, submits with
each alive and checks that no import memory outlives a declined import.
On the RDNA2 iGPU under Wine both land below the arena, the path fixed
here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 22:03:09 -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
73c37e19db Constant-buffer view tests follow the merged rule: console rows unless LEONIDA_CBV_RAW=1
The merged device writes every constant-buffer V# in the console's form of 16-byte rows (the base's rule, which both measured boots had for the title's own views); #939 kept the byte-address form for a view made on the device itself. xbox_cbv_vectors and the rebound-table cases of d3d12_title_va_test expected #939's form for that producer. They now read the switch as d3d12_compute_test does, and xbox_cbv_vectors_raw runs the first with LEONIDA_CBV_RAW=1, which is #939's behaviour.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 20:44: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
273b3bdf9d [integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
One squashed commit of a fork that was developed on a Linux/Proton machine and
tested on two native Windows machines. On all of them the retail 1.0.2.1
package now launches, shows its launch movie, first-run pages and landing
prompt, runs the story load to its end with the loading slideshow drawing its
artwork, and enters the world phase. A first world frame is not verified yet.
docs/linux_proton.md has the setup, a healthy boot's timeline, the machines
and where it stops.

Runtime: frames in the title's own window; DirectStorage pinned reads,
page-list scatter/gather, BCPack and unshuffle with a locally generated
predictor file; pooled, device-local and deferred image backing for streamed
and placed textures; enhanced barriers into LAYOUT_UNDEFINED; a bindless table
that degrades instead of refusing a submission; a descriptor hash finalizer
(off until a library carries it); directly indexed heap offsets for compute
dispatches and VS/PS/GS draws; title buffer windows outside a fragmented
arena; opt-in device-local copies of streamed buffer views; write-fault
retries under the tracker lock, shared trackers and write-watched title memory
for native Windows; device-loss, compute-input and memory probes.

Translator: loop bounds at structured exits, the eight FidelityFX programs
that use a packed-dot form the disassembler skips, buffer bounds modes per
view kind, a compaction option, the hash finalizer option.

Tools and scripts: Linux boot scripts (Wine/Proton, no network), a Windows
boot script, the paired compute translation script.

No game data. AI-assisted (Claude Code and Codex agents), reviewed and booted
by people on the machines named in docs/linux_proton.md.

Co-authored-by: Plaaasma <47513553+Plaaasma@users.noreply.github.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 11:42:12 -06:00
7cee65bc7c Keep explicit heap ranges and cache keys compatible in the integrated runtime
Use the validated console heap range when the title has no allocation hooks. Preserve partially committed buffer reservations, compare CBVs produced through the same ABI, and use the runtime's image robustness setting in the offline pipeline checker.
2026-11-24 22:10:54 +08:00
db19bbd345 runtime: connect native pipelines and title resources to the offline first-run UI
Build on the public frame-loop integration in #321. Carry the texture-view and depth work from #213 and #261, the layout provider from #461, the responsive window from #526, and the rectangle generator from #682. Integrate the Xbox constant-buffer row addressing measured in #513 and the draw-time rectangle selection in #722. Keep all fixtures synthetic.

The Windows GPU path resolves title-owned shader objects, retires geometry uploads per submission, materializes texture views on use, maps linear surfaces, and delivers completed GPU label writes. A first-run UI launch selects the tested settings for these paths.
2026-11-24 21:19:30 +08:00
d2f328e560 d3d12: only the title's memory gets a copy; the table scan covers the declared slots and is timed
The xmem shims record what they hand the title (XMemAlloc, XMemAllocDefault,
XMemVirtualAlloc, the title's VirtualAlloc); an address outside those ranges
is left as it was and counted. The submit-time scan reads only the
CBV/SRV/UAV slots the bound table's root signature declares, and its cost
is accumulated per ExecuteCommandLists. Section 3.3 describes the three
places addresses are replaced and the two kinds of copy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:51:08 +01:00
65668002e9 d3d12: buffer addresses in the title's own memory reach a shader through an arena window
A root view or buffer V# may name the title's own memory outside any
slot-133 buffer (a per-frame constant ring, #8862 section 3.5). The
layer now makes a 64 KiB-aligned window of those pages in the GPU
address arena, copies it before every submission like a slot-133
shadow, and names that copy instead: for root views when set, for V#s
the layer writes, and for buffer V#s the title writes into a bound
CBV/SRV/UAV table itself, rewritten in place before each submission.
Counters per kind, LEONIDA_TITLE_WINDOWS_MB caps the windows (64 MiB).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:47:45 +01:00
ab1fbff95d d3d12: shaders reach a title-placed buffer through the root views and buffer V#s the layer writes
Xbox device slot 133 places a buffer at the title's own VA, about 1.5 TiB on
Windows, while a translated shader computes heap_base + console VA with
heap_base the arena's device address. A root view or V# naming that VA
missed the buffer. The layer now translates an address inside a
title-placed buffer where it writes it (root CBV/SRV/UAV, CBV and buffer
SRV/UAV V#s): to the arena offset of the slot-133 shadow, which now lives
in the GPU address arena when it fits, or to an import's device address
minus heap_base. New tests: title_va_alias_test, d3d12_title_va_test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 20:38:42 +01:00