Commit Graph

5744 Commits

Author SHA1 Message Date
3e6cde78ec Tools: emit D3D12->Vulkan build metadata in spirv/index.json 2026-11-21 15:01:07 -03:00
1d8c13f11a Docs: record the rpf9-explorer and SCARAB licence boundaries
rpf9-explorer has no licence file: it is a submodule dependency, not
code to copy. SCARAB is GPL-3.0 and compatible, but facts still come
first and adapted code needs attribution.
2026-11-21 18:00:18 +00:00
Ryx
7f6e8f059d Runtime: D3D12 barriers and depth-stencil clears in the command-list IR
The IR (command_list.h, was clear_commands.h) now records transition, UAV and
aliasing barriers (split barriers record their end half) and full-view
ClearDepthStencilView next to ClearRenderTargetView.

vulkan_replay.h (was vulkan_clear.h) maps D3D12 resource states to Vulkan
layout/access/stage (section 4.3 table), decodes subresource indices including
depth/stencil planes, validates the whole list before emitting anything, and
wraps clears in a layout round trip so images stay in their D3D12 state. The
caller no longer manages layouts by hand.

Tests: command_list_test (recording rules), d3d12_state_map_test (state table,
subresource decoding, constants checked against d3d12.h; needs Vulkan headers
only) and vk_command_replay_test (GPU readback of colour, depth and stencil;
LEONIDA_VK_VALIDATION=1 runs it under the Khronos validation layer).
2026-11-21 18:58:48 +01:00
f38de0470b Docs: measured model recovery state and the rpf9-explorer fix 2026-11-21 17:58:43 +00:00
f654ae73e8 Docs: measured imports of the 16 shipped Xbox modules
gta6rt --dry-run maps every DLL in the package at its preferred base,
binds all imports, and reports zero unimplemented. The six unique
Xbox-specific imports are the xmem/d3d12_xs set already documented.
2026-11-21 17:56:10 +00:00
6582fa2dcb Make Vulkan shader checks aware of wave64 support 2026-11-21 19:46:32 +02:00
4f749583f1 Docs: audio guide, related projects, and a README truth pass
README: audio row now says lossless Ogg Opus, PCM codec 0/2 as WAV, XMA2 via ffmpeg and 16-bit --wav; D3D12 row reflects the design doc and xmem/d3d12_xs shims with no device proxy; LLVM_MC is documented as a whole command; link the two new docs. docs/audio.md covers the ADAT layout, tags, codecs, exporters, song/station/venue distinctions and the no-sharing rule. docs/related_projects.md records the PercyStar and americas-recomp licence boundaries.
2026-11-21 17:42:01 +00:00
793b06f127 docs: root-signature ABI facts from the console D3D12 libraries (register-based by default, memory-based opt-in, spill pointer)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-21 12:39:42 -05:00
f20ea6dde8 Merge pull request #28 from Eremia Brinzoi Razvan Andrei 2026-11-21 12:26:30 -05:00
0a9dc48d72 Merge pull request #27 from Kam471 2026-11-21 12:26:30 -05:00
6a56334db1 Merge pull request #26 from Kam471 2026-11-21 12:26:30 -05:00
34d2e63c65 Runtime: match the measured Xbox xmem/d3d12_xs ABI
- xmem: XMemVirtualQuery(process, address, out64) fills the known MEMORY_BASIC_INFORMATION prefix and zeroes the rest; the working-set size goes at +8 with a TRUE return; allocator alignment and size-0 behaviour are documented.
- d3d12_xs: copy root-signature descriptors and clear the Xbox high flag byte (0x03000000) before forwarding to the PC serializer; add the legacy serializer; keep the deserializer.
- d3d12_xs: add D3D12XboxCreateDevice, create a PC device and log the 24-word params block. The Xbox ABI proxy is not implemented; measured slot overrides are documented as TODO and logged at runtime.
- test: root_sig_test serializes synthetic flags=0x03000000 descriptors through the PC d3d12.dll, checks the untouched copy is rejected and the cleared copy is accepted, and exercises the registered shim.

Clean-room: implemented from an ABI-facts spec derived from public write-ups; no source from americas-recomp or AnyPS5 was read or copied.
2026-11-21 17:23:05 +00:00
770c496630 Record full-view color clears and replay them on Vulkan 2026-11-21 19:20:39 +02:00
348494dd88 Docs: prior art and measured Xbox D3D12 ABI
Add section 7 with the americas-recomp measurements: 6 Xbox-specific static imports, D3D12XboxCreateDevice, device slots 14/62/76, descriptor-heap start handles in RAX, root-signature flags 0x03000000, and the BVH builder's Xbox DXIL shaders. Update the device, descriptor, resource, ray-tracing, milestone, risk, reference and open-question text. ABI/format facts and links only; GPL-2.0-only prior art, no code copied.
2026-11-21 17:10:44 +00:00
4b251d1cb6 Merge pull request #15 from Mulkku
# Conflicts:
#	runtime/test/vk_store_test.cpp
#	runtime/test/vk_texture_test.cpp
#	runtime/test/vulkan_loader.h
#	tools/rdna2spirv.py
2026-11-21 11:47:52 -05:00
324a787f3c Merge pull request #21 from Kam471 2026-11-21 11:46:55 -05:00
53d903930a Merge pull request #14 from eIBart0 2026-11-21 11:46:54 -05:00
a7a1c01658 Translator: support op_sel on f16 VOP3 ops
v_fma_f16, v_med3_f16, v_add/sub/mul/max/min_f16, the f16 unary ops and v_fmac_f16
used to raise Unsupported when op_sel was present. Source bit i now reads the high
half of source i and the last bit writes the high half of the destination, the
other half being kept (Mesa ACO can_use_opsel, RDNA2 ISA VOP3 OP_SEL).

The f16 read/write sequences move into f16_in/f16_out/opsel_bits. Output without
op_sel is unchanged apart from SSA numbering.

Tests: tests/test_f16_op_sel.py uses hand-written listings (no llvm-mc needed).
2026-11-21 17:46:28 +01:00
8a4b5d05cb Docs: Xbox D3D12 -> Vulkan design and boot milestones
Design for the d3d12_xs -> Vulkan layer: object model mapping, one BDA arena for buffers/descriptors/code, descriptor heap and hash-table model, root-signature to user-SGPR mapping, shader contract production, boot milestones, and the open questions. Includes verified package evidence (XboxBvhBuilder export signatures and imports, FSR IIDs, encrypted gameos.xvd) with reproduction notes. No code changes, no game data.
2026-11-21 16:43:36 +00:00
e64ab9d3cc Shaders: fail when llvm-mc can't disassemble; accept a WSL command in LLVM_MC
The official Windows LLVM build ships no llvm-mc.exe and has no AMDGPU
target, which is what issue #7 ran into. A tool that existed but could
not disassemble produced empty output, so shader_disasm.py counted 0
invalid words, wrote an empty .s per shader and reported every one as
"clean"; make_game.py then translated nothing.

Probe one s_endpgm before the run and stop with the tool's own error.
Empty per-shader output is now "failed" and exits 1, never "clean".
LLVM_MC may be a whole command line, so Windows can call WSL's llvm-mc:

    set LLVM_MC=wsl -d Ubuntu -e /usr/lib/llvm-21/bin/llvm-mc

make_game.py accepts the same form in preflight and need(); README and
design.md now state the real requirement. New tests cover a missing
tool, a missing AMDGPU target, empty output and the success path.
2026-11-21 15:39:35 +00:00
987e8471ee Fix RDNA2 wave masks and flat inputs
Preserve whole-wave mask operations, saved EXEC values and flat
pixel inputs when generating SPIR-V. Keep a dispatch-loop fallback
alongside structured control flow and share the descriptor probe.

Add reproducible GPU fixtures for these cases and exercise the
control-flow and mask analyses in CI.
2026-11-21 16:56:54 +02:00
75d79341c5 Translator: exact v_mul_legacy_f32, buffer num_records bounds checks, and wave ballot for s_bcnt1/s_ff1 2026-11-21 11:08:59 -03:00
56f023a10a Audio: AWC codec 2 = 32-bit float PCM -> float WAV; every stream converted
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 23:47:45 -05:00
0bf4e13526 Docs: audio conversion totals
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 23:46:04 -05:00
573cd13d8b Translator: last 12 shaders (mesh LDS sizing, 3D load_mip, cmpswap 2D/3D, packed b16 shifts, sin_f16, add_nc_u16, vcc x2 loads); all 26,503 translate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 23:04:27 -05:00
1da3c7d2aa Audio: XMA2 streams via rpf9dump xma + ffmpeg (all 1,818 decode)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:32:47 -05:00
bfba26fbbb Audio: streamed AWC music channels to Ogg Opus
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:28:16 -05:00
a16d58e58e Audio: awc_opus.py repackages AWC Opus streams losslessly as Ogg Opus (end-trimmed); make_game runs it
300 random streams decode with ffmpeg with no errors and match their declared lengths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:27:18 -05:00
ec83153070 Translator: typed image_load (uint/sint views by T# FORMAT); GPU-checked
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:22:34 -05:00
cef55f04ae Translator: ray tracing (image_bvh(64)_intersect_ray emulated per RADV's software path), backward far branches
The BVH step is emulated over buffer reads in AMD's node format (box16/box32/triangle), with RADV's
watertight triangle test and sorted box children. GPU-checked with a synthetic BVH (vk_compute_test bvh).
All 64 ray-tracing compute shaders translate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:18:47 -05:00
21c8ae0ab6 Translator: exact wave64 lanes in CS/MS, per-lane constant EXEC halves, exec_hi writes; shader metadata index
- wave64 detected per shader; v_mbcnt and EXEC writes use the hardware lane (LocalInvocationIndex in CS/MS).
- s_mov_b32 exec_lo/exec_hi with a constant now sets each lane from its own bit (any non-zero constant
  used to enable every lane). GPU-checked (cs_exec64).
- spirv/index.json: stage, wave size, capabilities/extensions, Vulkan features, bindings, local size, LDS,
  mesh/GS limits and IO locations per shader, so pipelines can be created up front.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 22:04:21 -05:00
e8d9227ac2 Typed image stores GPU-checked (vk_store_test: float/uint/sint views via T# FORMAT)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 21:51:17 -05:00
95447e081e Translator: mesh and geometry shaders, SCC from scalar ALU, general buffer format stores, more CS ops
- Mesh shaders -> VK_EXT_mesh_shader: PSV0 limits/topology/group size, v5 = workgroup index, s3 = wave
  id << 24, NGG exports staged per thread and written after OpSetMeshOutputsEXT (GS_ALLOC_REQ counts).
  GPU-checked (VKH_MESH mode in vk_harness).
- Geometry shaders ($GS_VoxelizeGeneric): LDS-ring inputs/outputs mapped to gl_in / staged slots,
  EMIT/CUT -> OpEmitVertex/OpEndPrimitive. GPU-checked (VKH_GS mode).
- SCC is now set by s_and/or/xor/andn2/orn2/nand/nor/xnor/lshl/lshr_b32 (result != 0),
  s_add/sub_i32 and s_addk_i32 (signed overflow), s_min/max_u32; it was left stale before. GPU-checked.
- buffer_store_format(_d16) encodes every table format (sub-dword elements via atomics); it silently
  stored nothing for most formats before. GPU-checked with vk_compute_test.
- Far branches folded; d16 buffer loads; gather4_l(_o) emulation; gather offsets; 1D/a16 image stores;
  BITMASK_PERM swizzles; f64 add/convert; i24 mul/mad, alignbyte, xnor, ffbh_i32, swap, s_abs, s_bfm,
  64-bit ordered/cmpx compares, 16-bit compares, 8/16-bit global loads, neg() operands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 21:48:58 -05:00
0cd75fb245 Docs: restore output location note
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:54:04 -05:00
df13e7cf33 Docs: drop stale rejection note
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:53:57 -05:00
5fa36e3e3f Docs: corpus coverage - all 14,337 VS/PS and 88.9% of CS translate
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 20:53:48 -05:00
aad2da1db0 Docs: correct model total (155,598)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:44:36 -05:00
c87bf2b5ca Assets: texture pools inside pack/*/data/ttdb; final export counts; drop one-off dump script
make_game.py found only data/ttdb pools; 11 more live in pack/<name>/data/ttdb and now go to
ttpf_pack/<pack>/. All 57 pools exported (308,895 textures, 0 failures) and 160,898 models.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:44:30 -05:00
0082ad5365 rpf9dump: stream manifests (levels.rpf ran out of memory); docs: wave64 and mesh-shader findings
Rows held lazy projections that kept every decoded model alive; 149,811 models on levels.rpf exhausted
memory at the final serialization. Rows are now written as they are produced, to a .partial file renamed
when complete. Design notes record that most shaders are wave64 (32-wide subgroups on NVIDIA) and that
mesh shaders are NGG wave64 with the merged-shader SGPR layout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 19:04:06 -05:00
bd2dd1c874 Translator: compute shaders, LDS, wave-uniform branches, typed image stores; all VS/PS failure groups
- Compute: FSSM word 0x138 is COMPUTE_PGM_RSRC2 (user SGPRs, workgroup-id enables, thread-id VGPRs,
  LDS size), 0x13C..0x144 the group size; checked against 2,689 CS. GPU-checked with vk_compute_test.
- LDS as a Workgroup array (reads/writes/read2/write2/st64/sub-dword/atomics/cmpst), ds_bpermute,
  s_barrier as a workgroup control barrier.
- s_cbranch_vccz/vccnz/execz/execnz decided wave-wide (OpGroupNonUniformAny); v_cmp writes 0 for
  inactive lanes. GPU-checked.
- image_store for 2D/2D array/3D with float/uint/sint views picked from the T# FORMAT at run time.
- Raw barycentric reads via BaryCoordKHR (321 PS), POPS via fragment-shader interlock, image_sample_o
  offsets, fma_f16 op_sel, 64-bit v_cmpx, vcc_lo scalar loads, s_addk to specials, undeclared vertex
  components, normalized-encoding re-anchoring, array image_get_lod/gather4_lz, image_sample_l LOD on
  arrays (was reading the layer).
- Duplicate vector/pointer type declarations merged; vk_harness enables barycentrics/interlock/maintenance8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 18:59:41 -05:00
145a1824e2 Docs: shader coverage after SDWA fix (13,971 translated, 97.4% of VS/PS)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 17:05:58 -05:00
4f1ff7d85b Replace local drive paths with placeholders
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:59:05 -05:00
f1260dcfbf Shader translator: honour SDWA selects; add v_pk_fma_f16, int min3/max3, v_bfe_i32
SDWA src/dst selects were ignored, so 3,826 translated shaders passed
spirv-val but computed wrong values. Sources are now narrowed (with sext())
before neg/abs, and results placed at dst_sel per dst_unused. GPU-checked with
the new synthetic shaders in runtime/test/shaders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:58:36 -05:00
db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00