On the console whole-quad mode puts a pixel shader's helper lanes in EXEC.
Vulkan keeps a helper active for quad and derivative operations only;
whether it joins a ballot or a shuffle is the driver's choice. Ported from
VIctory, which runs the title:
- DPP quad_perm, a dpp8 whose every lane reads its own quad, and a
ds_swizzle that stays in the quad (QUAD_PERM, or masks that keep lane
bits 2-4) are quad operations in a pixel shader (Gen.quad_read:
OpGroupNonUniformQuadBroadcast / QuadSwap), the source's EXEC bit too,
so a helper across a triangle edge is read as on hardware (VIctory
921d8d3b4). They were subgroup shuffles and a ballot.
- v_readfirstlane_b32 in a pixel shader: an active lane that its own
ballot leaves out (a helper the driver keeps out) takes its own value,
so a waterfall loop serves it in the first pass (VIctory 060195536;
without it such loops spun with only helpers left until DEVICE_HUNG).
An empty ballot read lane 0 before.
- A pixel's discard keeps the killed lane as a helper for the survivors'
quad reads (VIctory 77053a0c5): Leonida never ends a lane before the end,
so this held already; the test pins it.
Vertex, geometry and mesh shaders keep their shuffles (no helpers there,
and quad operations would need quadOperationsInAllStages).
spirv_mini_interp.run_workgroup now runs OpGroupNonUniformQuadBroadcast
and QuadSwap, with `helpers` taking part as Vulkan requires.
test_ds_permute's pixel fixture runs whole quads only (a pixel wave holds
whole quads; a lane missing from its quad is a compute shader's case).
Tests: tests/semantic/test_quad_helper_lanes.py with the hand-written
fixtures quad_helper_reads.asm and discard_keeps_helper.asm, run with
helpers a driver leaves out of ballots, votes and shuffles. Contract rows
in docs/design.md. Not GPU-verified.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A loop over data the host has not mirrored yet reads zeros and can run
billions of times; VIctory lost the GPU that way and caps every loop at
128 passes in a pixel shader, 256 in a vertex, geometry or mesh shader and
4096 in a compute shader (victory lower.rs LOOP_LIMIT and count_iteration,
commit 15b0091e8; the per-stage values from 570a941e9). Leonida had no cap.
cfg_structure.loop_counters finds the loops of any graph: each strongly
connected region left after the counted edges of the loops around it are
removed, its counted edges the ones into its entries (the back edges of a
natural loop), its resets the blocks outside with an edge in. Every cycle
has a counted edge, so every loop ends. rdna2spirv keeps one Function
variable per loop; every lane of a wave runs the same blocks, so the lanes'
counters agree (one counter per wave). At the cap a branch back takes its
other way out, and a block with no other way leaves the program: %pc = the
end and %done, and a pixel is discarded at the end (%lc_kill, after the
POPS interlock like every exit). A wave that leaves early is counted done
by the barrier rounds and the wave64 emulation rounds, so it holds no
barrier; under --wave64-emulate such blocks count as an early s_endpgm for
plan_structured_emulation and stay out of lane-local folds.
--loop-limit PS,VS,CS sets the limits (or one N; 0 = no cap, and the output
is byte-identical to before: all 102 fixtures, with and without
--wave64-emulate). index.json records loop_limit and capped_loops for every
module with a loop. Contract row "Loop iteration cap" in docs/design.md.
Tests: tests/semantic/test_loop_limit.py with the hand-written fixtures
loop_limit_back.asm, loop_limit_jump.asm and loop_limit_barrier.asm (the
exported count, the discard at the cap, the dispatch-loop form, the vertex
cap, and a two-wave compute shader whose second wave never leaves its loop
while the first passes s_barrier, in native wave32 barrier rounds and under
--wave64-emulate with one and two waves); tests/test_cfg_structure.py
checks loop_counters on 6,000 random graphs. Not GPU-verified.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loop iteration cap, rectangle lists, literal sampler compare, quad ops and
helper lanes, VS-to-PS linking by signature row, per-program wave64
emulation, and the runtime shader lookup's keys and miss path, each with
the VIctory source and the Leonida place it lands.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title's needs in the order it hits them (system calls before the first
frame, the console D3D12 ABI in front of the Vulkan layer, menus, world),
what VIctory does for each and where it lands in Leonida, and where
Leonida's Vulkan design can cut frame time (imported title memory, buffer
device addresses, resizable BAR, asynchronous submission).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d3d12_xs_device.cpp called rt::d3d12::create_console_descriptor_heap
(slot 14, 3630610ca) without including d3d12_com.h, which exists only with
the Vulkan device (LEONIDA_VULKAN_DEVICE), so gta6rt did not compile
without Vulkan headers. The console path is now built with the Vulkan
device only, and when the helper refuses a host D3D12 device the PC call
makes the heap from the 16-byte desc, as before 3630610ca.
acphal.cpp: SHAPE_XMA_CONTEXT's bit fields fill five dwords and
SHAPE_PCM_CONTEXT's six, so with 10 and 1 reserved dwords the structs
were 60 and 28 bytes and the GDK-size asserts (64, 32) failed on MSVC.
Only the size is used (the stride of the title's context arrays), so the
reserved tails are 11 and 2 dwords.
Tested: gta6rt builds (VS 2022, RelWithDebInfo); gta6rt --dry-run and
--init on the Xbox Series 1.0.2.1 package map and initialise all five
modules; --run stops at the first unimplemented import,
xcrdapi.dll!DStorageGetFactory.
docs/port_status.md: Leonida is the base, VIctory the patch source.
port_ctl.py: shot --small writes a reduced copy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/sync_victory.py fetches DexNom/VIctory and merges new commits into
victory/ with git subtree pull. scripts/port_ctl.py starts a run with its
logs, captures and saves outside the repository, presses stand-in pad keys
through VICTORY_MOVEMENT_FILE, saves frames through VICTORY_CAPTURE_REQUEST
and reads the frame-rate lines.
The movement file now takes every key of the stand-in pad's table (Enter,
Back, Esc, Tab, the D-pad, shoulders, triggers, stick clicks), so menus can
be driven by a script. Tested with cargo test -p victory-hle --features
diagnostics movement (4 passed).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Seven more test files that fail on main at d083a2c, after #9896:
- test_docs_repeated_lines: tests/semantic/README.md's command block is a fenced block, which the check skips;
its indented form put two lines with the same 40-character opening three lines apart
- test_docs_repo_paths: docs/retail_boot_intel_host.md names #8554's frame-loop notes instead of a path that
is not in the tree
- test_docs_env_vars: runtime/README.md documents LEONIDA_RNG_SEED (runtime/shims/bcrypt_rng.cpp)
- test_docs_design_rows: docs/README.md gets one row each for strand_grooms.md and ped_catalogues.md (two
rows each were merged in), and design.md escapes the pipe in `prim_cnt << 12 \| vtx_cnt`
- test_docs_cli_flags: docs/testing.md passes llvm-mc through LLVM_MC, so `brew --prefix` is no longer read as
a bench_wave64.py flag; pt-PT's quickstart points to the web checker that replaced tools/pc_checker.py
(5125a01), as README.md does; the spirv-opt passes docs/embedded_shaders.md quotes join FOREIGN
- test_bvh_slot_check: bvh_match.model_geometries() yields six fields since the render bucket was added;
unpack the two it needs
- test_joaat_agreement (find_hash_lookup's half): hash over the Latin-1 bytes like hashdict.joaat, as #6254 and
#7820 proposed
Still red, for a separate change: test_joaat_agreement's leonida_mods half (it hashes UTF-8 bytes like
runtime/src/mods.h, so both sides change together), test_f64_conversion and test_f64_output_modifiers (they
expect the output scaling #6314 gated by MODE) and test_bvh_shaders_stage.
gameinput_abi.h left out the labels of the public v0 layout. In
GameInputControllerAxisInfo and GameInputControllerButtonInfo a label
sits at offset 4, in what is otherwise padding, so the sizes matched
while isContinuous, restValue, legacyDInputIndex and rawReportIndex were
four bytes early. GameInputGamepadInfo and GameInputUiNavigationInfo are
tables of 14 and 21 labels; they were declared empty, and the pointers
in GameInputDeviceInfo led to one-byte members, so a title reading a
label read whatever followed.
The header declares the enum, the two tables and the two label members
and pins each offset that moved. fill_info gives every control the Xbox
label of its position on every pad, since every pad is presented as an
Xbox One pad.
gameinput_test reads the tables by the public header's byte offsets, so
the shim's own header cannot agree with itself.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
docs/design.md marks the 64-bit LDS exchanges not GPU-verified, and
cs_lds_atomics_ext.asm (#9494) leaves ds_or_b64 and the f32 min/max
forms out. cs_lds_xchg64_ext.asm runs one lane through
ds_wrxchg_rtn_b64 (both dwords left and the returned pair),
ds_wrxchg2_rtn_b64 at offsets 0/2 (four old and four new dwords),
ds_wrxchg2st64_rtn_b64 at offsets 1/2 (512-byte steps), ds_or_rtn_b64,
ds_min_f32 with a quiet NaN in memory and ds_max_rtn_f32 ordering -0.0
below +0.0. The eight expected words are derived in its header from
the rows. Registered in check.py and run_gpu_tests.py next to
cs_lds_b64_cmpst; the wrxchg row notes the GPU check (the min/max and
bitwise b64 rows get theirs in #9494, to keep the two PRs apart).
A measurement page in its own file: which stops of docs/retail_boot_chain.md and of #8554's ladder hold on an Intel CPU
with #7111's emulation, the stop that is specific to a 16 GB host (the 6.1 GiB physical-page request against the commit
limit, cleared by #7556), the frame loop to the 900 s timeout with stub pipelines, and what the layer refuses at that
depth, including the console mesh-shader stream subobject. Counts and slot numbers only; no addresses. Plus the
docs/README.md row.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GDgoLP2cV47KaCDkbmckob
The game runs AVX code from its TLS callbacks on, so a CPU or OS without
AVX (a QEMU qemu64 guest) died with a bare 0xC000001D. Check CPUID.1
AVX/OSXSAVE and XCR0 YMM state first, print one line and exit 4 (3 is
LEONIDA_UNIMPLEMENTED=stop). --dry-run is unchanged and
LEONIDA_SKIP_CPU_CHECK=1 skips the check.
AI-assisted.