Commit Graph

40 Commits

Author SHA1 Message Date
f0611b752f Remove the title's executable addresses #984 brought in; read them from the environment
#984 (273b3bdf9) put RVAs and file offsets of the retail executable into code, docs and scripts.
The code paths that need one now read it from an environment variable and are off when it is
unset; the docs and examples say the location is measured locally.

- runtime/src/main.cpp: the hang-watchdog kick takes its trap and kick RVAs from
  LEONIDA_TITLE_WATCHDOG_KICK="<trap RVA>,<kick RVA>" (hex), still only when the trap
  instruction is at the first one. Unset, the watchdog stays armed, as before by default;
  LEONIDA_TITLE_WATCHDOG=1 keeps it armed, and LEONIDA_TITLE_WATCHDOG=0 without the RVAs says
  once that it needs them. The LEONIDA_PEEK example uses placeholders.
- runtime/shims/startup_trace.h: the transient-pool dump fires at the int3 that
  LEONIDA_POOL_DIAG_AT names (`<module>+0x<offset>`, as the trace prints it), off when unset.
- scripts/windows-boot/boot.ps1: LEONIDA_PEEK's default comes from LEONIDA_GAME_STATE_RVA and
  LEONIDA_SESSION_STATE_RVA (no peek when unset), and the RESULT digest matches those values;
  the examples and README use placeholders.
- runtime/README.md documents LEONIDA_TITLE_WATCHDOG_KICK and LEONIDA_POOL_DIAG_AT.
- docs/fspx.md, docs/d3d12_vulkan.md, docs/movies.md, docs/embedded_shaders.md and a comment in
  runtime/shims/d3d12_xs_alloc_size.h drop the addresses and offsets.

This follows the same change on the earlier integration branch (#1495).
2026-11-25 01:00:37 -05:00
7ea226e65b Merge main (0aecc5efa: #984 and #968) into the #939 merge
main now holds the #984 merge (18a22c1ae) and #968, queue slot 31 as CopyPageMappingsBatchX. Two conflicts: the include list of d3d12_xs_device.cpp (both includes kept) and the call order in xmem_test.cpp (the two page-mapping tests of #968 run after test_physical_pages, after the early return of #939's file-pools mode). The slot 31 dispatch of #968 stays ahead of the presentation routes, so #939's rule for queue slots 30 to 32 on a device that had a presentation handler does not reach it where xmem is linked.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 21:09:27 -05:00
52ef7df72f docs/embedded_shaders.md: twelve executable programs, and the AMD pipeline check of the ten plain ones
The merged pe_shader_containers.py is the base's: it extracts the ten plain containers and the two packed pixel shaders, so the base's count of 12 (1 VS, 11 PS) is what the merged tool gives and stays. The measurement #939 made with its own extractor (the ten plain containers: translation with and without wave64 emulation, the shader library lookup, vk_pipeline_check 10/10 on an RX 9070 XT and a Ryzen integrated GPU under RADV) is added as a second measurement and says that the two packed shaders were not in it. No hash is changed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 21:07:46 -05:00
18a22c1aef Merge pull request #984 from Moriz82/integration/proton-story-load
[integration] Linux/Proton and native Windows: boot through the story load (RT-PROTON-STORY-LOAD)
2026-11-25 02:37:19 +01: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
60e15c855f docs: the BVH builder's 52 programs all translate, and pipeline-state streams are implemented (DOC-BVH-BUILDER-52)
docs/d3d12_vulkan.md, docs/embedded_shaders.md and the index row in
docs/README.md said 51 of the 52 XboxBvhBuilder.dll programs translate and
one rule, buffer_store_short, was missing. The rule has been in
tools/rdna2spirv.py since 8f208d09a, and embedded_shaders.md section 7
already recorded 52 of 52 for main 8575d36e.

Measured on main 3aa975421 with a 1.0.2.1 package: 52 containers extracted,
52 translated, 52 pass spirv-val, natively and with --wave64-emulate.

- d3d12_vulkan.md: the eight passages that give the count (sections 4.8 and
  7.2, the M6 row, open question 7, the risks list, Appendix A.2). Section
  7.2 held the same paragraph twice, the second copy starting mid-sentence;
  it is one paragraph again. The Appendix A.2 measurement keeps its numbers
  and says what changed since.
- d3d12_vulkan.md section 3.6: pipeline-state streams (CreatePipelineState)
  were described as not implemented yet, 50 lines above the section that
  documents them; an unknown subobject type is E_INVALIDARG, not a logged
  hard error.
- embedded_shaders.md: sections 4, 5 and 7 (the result table, the blocker
  tables, "What this changes" and the build step's report line). The dated
  measurements of 51 modules stay as they are.

Open question 20's row in d3d12_vulkan.md has the same count and is left
alone: pull request 381 rewrites that line.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 12:11:21 -06: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
ab03d8dd12 make_game, runtime: translate and load game_scarlett_master.exe embedded shaders 2026-11-23 18:28:36 +01:00
e76640014a docs: the AMD driver took 34 minutes on LeafRehydration's dispatch-loop module; the current translation compiles in 3 s (SHADER-995) (#6739)
Squash-merged after diff review of PR #6739
2026-11-23 10:49:09 -06:00
6c8eb8221e pe_shader_containers: read shader stage from PSV0 and document game_scarlett_master.exe's 10 embedded shaders (RT-5) (#6840)
Squash-merged after diff review of PR #6840 - pe_shader_containers: read shader stage from PSV0 and document game_scarlett_master.exe's 10 embedded shaders (RT-5)
2026-11-23 09:36:48 -06:00
5c91cb5e89 Merge pull request #4113 from Alex Collini
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:11:24 -05:00
d040db9876 Merge pull request #3857 from TreXito
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 23:08:57 -05:00
baefe6d643 Merge main 2d3369a4 into #4113
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-23 04:54:39 +01:00
7156ffcb31 bvh_builder_test: restore PSO vtables after naming, tidy the name log (RT-266)
The hooked PSO gets its own vtable back as soon as its name is logged (the
rest after the constructor returns), so the destructor never sees the
9-slot copy. find_pso searches newest first and skips restored entries,
the named count is of distinct creations, g_in_set_name is thread_local,
and the doc says what was measured about PostBuildInfoQuery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:28:57 +01:00
0d94fa72a7 bvh_builder_test: log each PSO's call site and name; settle #47/#53 (RT-266)
LEONIDA_BVH_RECORD62=1 now prints the unwound call site (offsets from the
DLL base, with function starts from the unwind tables) and the name the
builder gives the returned PSO through SetName/SetPrivateData. Measured:
#47 and #53 are both "XDXR GetBVHCompactedSize", one PSO created twice from
FUN_18001d400; no creation is named PostBuildInfoQuery.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 00:25:26 +01:00
53eeea4170 Remove three blocks the round-42 merges left in twice
docs/testing.md had the whole "GPUs with 128 bytes of push constants"
section twice in a row (identical), and the first copy had no blank line
before its heading. docs/embedded_shaders.md section 4 repeated the
"blocker then / now" table and the "disassembly count is unchanged"
paragraph after the remaining-blocker table. tests/test_skinned_glb.py
defined SkinnedGlbTest.test_full_export_without_numpy twice (identical),
so the first definition was dead.

The second copy of each goes; nothing else changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 22:06:06 +00:00
5db70430de Merge pull request #3618 from Dominik
# Conflicts:
#	docs/embedded_shaders.md
2026-11-22 17:03:01 -05:00
4affe0d629 Merge pull request #3562 from FIocker
# Conflicts:
#	docs/embedded_shaders.md
2026-11-22 17:02:43 -05:00
cc902bd8f9 Merge pull request #2473 from Vonsek
# Conflicts:
#	docs/embedded_shaders.md
2026-11-22 16:59:19 -05:00
f574359675 bvh_gpu_smoke: check PrefixSum64's exclusive scan and block total
One group scans 64 words in place through five ds_swizzle_b32 broadcast steps;
the check feeds input that wraps past 2^32 and compares every element and the
total. Passes on an RX 9070; with ds_swizzle_b32 skipped it fails from element 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:23:01 +00:00
3169652e94 bvh_gpu_smoke: --checked compares five programs' output byte for byte
RadixReset, ResetKDOP, ResetToIndexBuffer, CopyCounters and ResetCounterValues
take an address, a count and a value or source from the root table and write
that many entries; --checked gives them those fields and compares every entry
and the untouched bytes after them. All five match on an RX 9070; with the
translator made to skip v_add_nc_u32, ResetToIndexBuffer fails the check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:21:02 +00:00
dac28e6b19 Fix what the round-42 merges broke (tests and docs)
- shader_disasm: prune stale listings against every input, not the --skip-existing remainder (a resumed run
  deleted every listing it had just reused).
- progress_dashboard: a drive-letter path is never inside the repository off Windows (it printed user names);
  its own read_text helper is read_utf8, so the encoding check does not take it for pathlib's.
- Translator tests follow this round's rules: desc_lookup's BroadcastFirst in the typed-load condition walker;
  resinfo sizes are 0 past the last level and a 2D depth word is 0 (SHADER-388); SHADER-315 constant folding in
  the perm and i16 tests; #2089's structured wave64 emulation.
- test_semantic_translator_use: 57 oracle-only files merged before it are DEBT; test_spirv_tools_required is
  allowed (CI meta-test).
- Test fixes: image_fuzz fake writes the programs, preflight follows c506d00c's loader hint rule, feature_scan
  reads the first line of a pytest-decorated message, w64_graphics wording.
- docs: rows merged again in design.md, README.md, d3d12_vulkan.md; GameInput table rebuilt from #3172's rows;
  orphan rows in models.md and embedded_shaders.md; repeated bullets; anchors; a flag not on main.
- Repo rules: stdout guard on 14 programs; LF writes; csv lineterminator in bink_play.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 16:14:54 -05:00
6d458e4b05 bvh_gpu_smoke: run XboxBvhBuilder's translated programs on the GPU (TEST-594)
tools/bvh_gpu_smoke.py translates the 52 embedded programs from the package
(the pipeline docs/embedded_shaders.md documents) and runs each through
vk_compute_test twice, with a root table seeded by VKC_HEAP_INIT whose words
point past it into zeros. A run passes when it exits 0, the validation layer
reports nothing and both runs write the same heap bytes. On an RX 9070 all 49
non-rehydration programs pass; seven change heap words with these inputs.

The wave64 bitonic sorts need --max-shared-memory set to the device's 32 KiB;
docs/embedded_shaders.md records the run and what it does and doesn't show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:07:38 +00:00
66c53d04d9 RT-182: the BVH builder container created twice is GetBVHCompactedSize
bvh_builder_test measures 53 PSO creations over XboxBvhBuilder.dll's 52 containers.
With LEONIDA_BVH_RECORD62=1 the test now prints each container's ILDN module name and the
first bytes of its digest, which answers the open question in docs/embedded_shaders.md:
creations 1-51 are 51 distinct containers (GetBVHCompactedSize at 47), 52 is
CopyAndCompactBVH (0x1134 bytes) and 53 is GetBVHCompactedSize again (0x14a4 bytes, same
digest): the container FUN_18001d400 passes for "XDXR PostBuildInfoQuery".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:55:54 +01:00
bfe65cb90f embedded_shaders.md: one section 4 again after both PROC-120 PRs landed; the M6 row's count
The merge round took this PR's first commit and #2503, which say the same thing,
so section 4 carried both: the then/now table and, after a stray table row, the
bullet list and a second blocker table. Keep the table (now without 'open' after
#1864) and drop the repeat. d3d12_vulkan.md's M6 milestone row still said 42
pass and four rules left.
2026-11-22 21:35:25 +01:00
37be808200 Merge pull request #2826 from caua-an 2026-11-22 15:12:23 -05:00
21846e3444 Merge pull request #2503 from adriaespii
# Conflicts:
#	docs/d3d12_vulkan.md
#	docs/embedded_shaders.md
2026-11-22 15:10:57 -05:00
bcfedd79ee Merge pull request #2473 from Vonsek
# Conflicts:
#	docs/README.md
#	docs/d3d12_vulkan.md
#	docs/embedded_shaders.md
2026-11-22 15:10:53 -05:00
961e97c1d9 docs: update embedded shader translation count to 51/52 (PROC-120)
Update docs/embedded_shaders.md §4 and §5 and related references in
docs/d3d12_vulkan.md to reflect current main: 51 of 52 XboxBvhBuilder.dll
compute shaders now translate and pass spirv-val since #1871
(GFX10_FORMAT_8_UINT) and #1968 (427c1376: global_atomic_fmax/fmin and
buffer_load_ushort) landed.

Only Box16Rehydration remains blocked, awaiting buffer_store_short (#1864).

Claim: https://github.com/ItsNotRexed/Leonida/issues/2300#issuecomment-7082579530
2026-11-22 20:40:58 +01:00
15f5b2fbc0 Fix what the round-41 merges broke
- tests/semantic: BaseVertex/BaseInstance read 0 in the wave interpreter; the LDS MockGens follow
  SHADER-309 (lds_bound, lds_access, lds_atomic); abs emission tests load their operand, since
  SHADER-315 folds scalar ALU on constants.
- test_translate: the dynamic gather sampler is a loaded word, not s16 + 0 (SHADER-315 folds it).
- test_world_build: DDS downscale weights colours by alpha (62804d0d).
- test_fspx_shaders_stage: the fake disassembler writes the listing make_game now checks.
- xgameruntime_test: re-read the package id after clearing the LEONIDA_PACKAGE_ID override.
- docs: one row per topic again in design.md (72 topics) and README.md; one Other languages line;
  embedded_shaders.md keeps one copy of each bullet; animation.md links the heading anchor.
- tools/scripts: character_textures uses report_paths.same_report_path; stdout guard on six programs;
  LF write in vs_input_survey; the cl.exe fallback compiles winhttp_offline.cpp.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 14:30:33 -05:00
bb4aa15323 embedded_shaders.md: drop 'open' after #1864 so the row doesn't go stale (review nit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:10:08 +01:00
dfde07df6d Docs: describe embedded DXIL reflection parts 2026-11-22 15:21:01 -03:00
0d938dedd8 Docs: 51 of the BVH builder's 52 FSSM programs translate on main; one rule (buffer_store_short) left (PROC-120)
Recounted with main 49475796 on the 1.0.2.1 package (counts only): 52/52 unpack,
42 clean and 10 with invalid words in the disassembly, 51 translate and pass
spirv-val. The four rules embedded_shaders.md listed are three since 427c1376
(#1968); Box16Rehydration stops at buffer_store_short (#1864). d3d12_vulkan.md
and the docs index quoted 41/42 and four rules in seven places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 19:20:09 +01:00
3a40f5a539 Merge pull request #2702 from Sc4ros 2026-11-22 13:17:12 -05:00
da3779d23c Merge pull request #2503 from adriaespii
# Conflicts:
#	docs/d3d12_vulkan.md
#	docs/embedded_shaders.md
2026-11-22 13:15:47 -05:00
5b5b69aed3 bvh_builder_test: name the container behind each PSO creation (RT-182)
LEONIDA_BVH_RECORD62=1 now prints the module of each CreateComputePipelineState
call (the file name in the container's ILDN part) and says when a creation passes
a container byte-identical to an earlier one. The constructor makes 53 creations
over 52 containers; the repeat is GetBVHCompactedSize (5,284 bytes = 0x14a4):
creations #47 and #53. The test prints a summary and checks that the repeated
container names the same module both times.

docs/embedded_shaders.md answers the open question and lists the creation order.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-22 18:55:53 +01:00
7834593b51 docs: update embedded shader translation count to 51/52 (PROC-120)
Update docs/embedded_shaders.md §4 and §5 and related references in
docs/d3d12_vulkan.md to reflect current main: 51 of 52 XboxBvhBuilder.dll
compute shaders now translate and pass spirv-val since #1871
(GFX10_FORMAT_8_UINT) and #1968 (427c1376: global_atomic_fmax/fmin and
buffer_load_ushort) landed.

Only Box16Rehydration remains blocked, awaiting buffer_store_short (#1864).

Claim: https://github.com/ItsNotRexed/Leonida/issues/2300#issuecomment-7082579530
2026-11-22 18:16:21 +01:00
1a22106ac6 Docs: 51 of the BVH builder's 52 FSSM programs translate on main; one rule (buffer_store_short) left (PROC-120)
Recounted with main 49475796 on the 1.0.2.1 package (counts only): 52/52 unpack,
42 clean and 10 with invalid words in the disassembly, 51 translate and pass
spirv-val. The four rules embedded_shaders.md listed are three since 427c1376
(#1968); Box16Rehydration stops at buffer_store_short (#1864). d3d12_vulkan.md
and the docs index quoted 41/42 and four rules in seven places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 18:10:07 +01:00
96d0b2455f docs: 42/52 after main's global-atomics fix
003e7812 loads EXEC before OpSelectionMerge in global_atomic and global_atomic_x2,
so FindTreelets assembles and validates. The 10 left are still the four rules.
2026-11-22 11:34:56 -03:00
5ecb637a02 Docs: the embedded shader containers; the BVH builder's programs are console FSSM
The 52 containers in XboxBvhBuilder.dll carry an LLVM bitcode blob and an
XDAT/XBCH record. The console record decompresses to FSSM: 52/52 unpack, 42
translate, 41 pass spirv-val with the existing translator. The 10 left need
global_atomic_fmax/fmin, buffer_load_ushort and tbuffer_load_format_x (format
8), plus one OpSelectionMerge emission bug. Correct the DXIL-front-end premise
in d3d12_vulkan.md (4.8, 7.1, 7.2, M6, Q7, Q20, A.2) and index the new note.
2026-11-22 11:34:05 -03:00