The predictor profile fits a history field only from a stream with a raw or
zlib sibling mip. A BC7 texture whose mip 1 and packed tail share one BCPack
stream has none for the tail, so history fields that only such tails use
stayed unknown and the runtime refused the stream with missing-endpoint
(E_DSTORAGE_DECOMPRESSION_ERROR) on every game run.
fit_decoded_neighbors decodes the nearest BCPack sibling with the profile so
far, also inside a stream the decoder refuses (blocks whose chains start at an
unknown field are left out of the reference), and fits the streams that still
reference missing fields. Only empty fields are filled, never as confirmed.
On the local package the BC7 endpoint fields go from 4228 to 4406 of 6144 and
the runtime decoder refuses 8 of 5167 BC7 streams instead of 60; both request
shapes that failed in game runs decode. BC6H is unchanged (10 of 268).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Geometry copies held 4.4-6 GB of VRAM in world runs and were never evicted: a view retired only when its range was
freed, decommitted or unmapped, and the title streams by remapping the frames of its pools.
- LEONIDA_GEOMETRY_HOST (unset by default): 1 puts the copies in system memory outside VRAM, write-back where the
device offers a cached host type; 2 write-combined. The memory type is picked among the host-visible types that are
not device-local (memory_type_order alone would give the BAR first); a device with none keeps its types. Logged once
and in the geometry buffers line.
- LEONIDA_GEOMETRY_REMAP_RELEASE (on by default, 0 off): XMemMapPhysicalPages with pages, the scatter call and
CopyPageMappingsBatchX report the pages whose frame changed (or went) as released (xmem's RemapReleases, collected
under the fault lock, reported after it), so GeometryViews retires the copies over them through #2094's
drain_released and kAfterExecutes reaping. A page mapped again to its own frame is no change.
- A retired view is copied once more from its pages when they are readable: a list recorded before a remap that took
the view's address reads the new bytes, as the refresh this replaces would have given it.
- A stream-pool extent backed by a retired copy leaves pool_spans (it was kept for the device's life).
- A full release queue joins touching ranges before it collapses into one covering range.
Tests: geometry_views_test cases 14-16, xmem_test test_remap_releases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
translate() re-translated every emulated wave64 program whose inline
structured form has an OpControlBarrier under a selection or loop as the
round loop (barriers_under_control_flow), for NVIDIA, which hangs on a
barrier only part of the workgroup reaches. A single-wave workgroup
(plan mode inline_all) is one wave: its barriers sit at the top level or
under %pc-only guards, which every invocation takes alike, so the
fallback only applies to multi-wave plans now.
The round form keeps nearly the whole register file live across the
loop and drove RADV/ACO's spiller past 12 GiB (53 GB uncapped) on large
single-wave programs, and made programs with long loops 10-100 times
slower. 666 main-set compute shaders return to the structured form;
translated and spirv-val counts are unchanged.
Restores the single-wave expectations in test_wave64_emulate_opt.py,
test_loop_ballot_barrier.py and test_loop_iteration_guard.py (its round
scheduler check now uses --dispatch-loop), adds
test_wave64_single_wave_barrier.py with a hand-written fixture, and a
docs/design.md contract row.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The map viewer loads only what is near the camera, and nothing in it shows
where the rest of a world is: a placed world is kilometres across, and a
chunk that fails to load is only a number in the HUD.
M opens a map of the whole world from above, drawn from world.json alone:
one rectangle per chunk (its cell when it names a tier, otherwise the X/Z
extent of its bounds), coloured by its streaming state (not loaded,
loading, loaded, failed). It shows the camera and its view direction, the
spawn point and, without LOD sets, the loading radius. The line under it
names the point under the cursor, in a placed world also as RAGE X and Y,
and the chunk there with its state. A click moves the camera there, 10 m
above the full-detail geometry at that point unless it is already higher;
the wheel over the map zooms it about the cursor.
Nothing touches the page until the map is first opened, and an open map is
redrawn at most every 100 ms. tests/test_viewer_map.cjs runs the map's
code from the page together with the streaming code, in a new file so the
open pull requests on tests/test_viewer_streaming.cjs are not touched.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
In wave32 code vcc_hi is an ordinary SGPR, and the console compiler writes VOP3 compare masks there: 5,907 such
compares in the title's captured compute programs, 606 of which were refused with "v_cmp destination". The mask
goes to %vcc_hi, and a lane-mask read of vcc_hi takes it back (mask_src read %vcc, the low half). Wave64 still
refuses a lone vcc_hi as a mask destination. Contract row in docs/design.md.
Tested: tests/semantic/test_vcmp_vcc_hi.py; the mask, compare and wave64 semantic suites.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clamp cut a garbage draw count to 2^24 vertices and charged it against the
list's 2^27-unit budget. Only records whose words are all 0xFFFFFFFF were
treated as unfilled. A slot with a garbage count but other words set therefore
cost 2^24 units, so eight such records used up the budget and every real draw
after them in the list ran empty.
A census in codec-d/cool_fox's fork of VIctory found 90 records of 2^24
vertices in one list, and that fork treats 2^23 vertices an instance or more as
unfilled. Here such a record now runs empty, keeps its locations and charges
nothing. Draws under 2^23 are unchanged.
indirect_clamp_test: the old garbage cases now expect an empty record. New
cases check the 2^23 edge and 16 garbage counts ahead of a real draw, which ran
empty with the old shader and runs with this one. The list-budget case uses a
real 2^22 x 16 draw. indirect_clamp_spv.h was regenerated with glslangValidator
15.1.0 (-V --target-env vulkan1.2 -Os).
Tested: full ctest (108 tests) on Linux with Mesa lavapipe (llvmpipe, LLVM 19.1.7).
Changes made by Claude Code (AI-assisted).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JPqXc6svM4pbBagTsVEYA3
Tested on main a73a57e13: Wine suite (clang-cl + xwin, RDNA2 iGPU, RADV) 412 pass / 22 fail / 39 skip on main and on main + #1886, 0 changes; Linux portable ctest 108/108; the new over_save_limit cases fail on main and pass here. Review points addressed in 66e96ccea. Windows CI cancelled; linux-gpu-tools CI failed at Build (log not available yet; the same job also fails on #1914, and it builds locally). AI-assisted (Claude Code, Claude Opus 5.5 review, Claude Fable 5.2).
Add an E line after the P line of a compute pipeline.
It holds the FNV-1a 64 hash of the library entry name, not the name.
A reader from before E lines skips them, counted as lines not read.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With LEONIDA_PIPELINE_COMPILE=on-demand a console stream (device slot 86) is
only parsed when it is first bound, and create_graphics queued the prewarm
from there, so a planned pipeline got no lead at all. ecox982745 measured 0
of 8 planned builds before the first bind in that mode, 8 of 8 otherwise.
When the plan has the stream's pipeline, the parse is now queued as its first
prewarm job (at the rank of its first recorded variant, on a compile worker);
create_graphics then queues the variants as for any other PSO. A bind that
comes first waits for the parse through resolve_type's call_once, as it would
have parsed it itself.
d3d12_pipeline_workers_test gets a device case: a first device records the
order, then console-stream PSOs with an eight-entry plan must build those
eight before any command is recorded, with the ordinary stream and with
on-demand, and nothing without a plan. Without the fix the on-demand case
fails with 0 of 8.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the second merge of main (RT-POST-LOAD-GPU-MEMORY, 9f98dcc61), the
buffer address idiom also holds the full index * stride product in 64 bits,
a left shift by the element-size log read from the V# (a 32-bit value, not
a constant), and a 64-bit compare against 0xFFFFFFFF for the range check.
The pass refused every such module and kept Int64.
A 64-bit multiply becomes the low words' product, its high word from the
four 16-bit half products (plain 32-bit multiplies, which the three test
interpreters run), plus each low word times the other's high word. A left
shift by a 32-bit value becomes the shift by k & 31 on both words with the
crossing bits, the words moved up once k >= 32. The contract row and the
code comment say so.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
LEONIDA_PIPELINE_PREWARM_ORDER=<file> (or 1 for pipeline_order.log beside the
session cache) reads the order log #2220 records. Of the runs recorded on this
GPU, the one with the most records is used. When the title creates a PSO whose
description key is in it, each recorded graphics or mesh variant is queued on
the compile workers (#2233) as a warm-up at priority 1 + rank: after every
demanded build, one warm-up at a time, none while a demanded build runs.
Records are taken in order up to LEONIDA_PIPELINE_PREWARM_BUDGET_MS of recorded
build time (default 300000) and LEONIDA_PIPELINE_PREWARM_MAX_ENTRIES (4096).
Compute records are left to the compute warm-up and the offline precompiler.
A missing, garbled or other-GPU log is ignored with one message; damaged lines
and the E lines a v1 reader does not know are skipped.
New CPU test pipeline_prewarm: order kept, budget and entry limit, run
choice, a missing or garbled log, E lines, and on the compile workers the
recorded order and a demanded build overtaking the prewarms.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trace test now feeds PS_Secret::Slot12 and expects one more "(other)";
the reasons test feeds "translator error SecretError" and expects
"translator error #"; the runtime pins add the slot-57 failure fprintf
of d3d12_xs_device.cpp. dev-tools.md says which trace names and digest
endings are printed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
tools/vk_subgroup_info.py: main now confirms the per-vertex feature by its extension after a device is chosen; this branch adds the chosen driver version to the same tuple. Both kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The start screen drew a 1-pixel white line from the bottom left to the top right and no batched text. The title's
console-compiled Scaleform batch shaders read their constant buffer's float4 rows with buffer_load_dwordx4 ... idxen
and the row number (rows 4b..4b+3: colour transform, then the position matrix), and MUBUF addressing is
base + index * STRIDE. CreateConstantBufferView wrote a raw V# (STRIDE 0), so every row read the first one: x and y
came from the same row, so every batched shape and glyph landed on clip-space y = x, coloured white.
A constant-buffer view is now STRIDE 16, NUM_RECORDS the size in rows, format 32_32_32_32_FLOAT, OOB_SELECT 1
(gfx10::constant_buffer_descriptor). s_buffer_load keeps its bound (NUM_RECORDS * STRIDE bytes) and offen loads reach
the whole buffer. With it the line is gone and the batched text (titles, button prompts) draws.
Tests: gfx10_descriptors_test checks the fields; d3d12_compute_test's CBV pass reads through them (its GLSL stand-in
now bounds a CBV read as s_buffer_load does).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Lower computed v_interp_p1/p2 (I, J) pairs under --f16-interp-fallback (without --bary-fallback) without PerVertexKHR or a geometry shader by hoisting OpDPdxFine/OpDPdyFine screen-quad barycentric and attribute derivatives into uniform %entry (OpCapability DerivativeControl, guarded by an integer IEEE-754 normal determinant check) and evaluating P_0 + I*P_10 + J*P_20 per site.
When a BC6H or BC7 stream still references an unfitted built-in predictor slot after adjacent-mip fitting, pair its mips with the closest raw or zlib mip on the same layer across multi-level mip distances before running the full-stream constraint pass. Existing adjacent-mip, array, and cubemap fits keep precedence.
The title deserializes every graphics pipeline it draws past the start screen through console device slot 57,
which was refused (16k+ calls a boot, the world never drew). Its description is the graphics side of slot 67:
the root signature, kind 0 (gfx10 register state), kind 1 (semantic table), and kind-6/kind-7 pairs for the pixel
and vertex stages (docs/fspx.md, "Graphics pipelines", from a census of 400 descriptions).
- Proxy: decodes CB_BLENDn_CONTROL, DB_DEPTH_CONTROL, DB_STENCIL_CONTROL and DB_STENCILREFMASK from kind 0 into a
D3D12 description, each stage an FSPX payload; culling stays off unless LEONIDA_CONSOLE_CULL=1 until the
PA_SU_SC_MODE_CNTL reading is confirmed. LEONIDA_CAPTURE_SLOT57 saves descriptions for study.
- Device: a graphics stage may be such a payload, found by its kind-6 SHA-256 and stage, captured as
<sha>-<stage>.fspx when untranslated. A private flag makes a pipeline take its attachment formats and sample
count from the targets each draw binds (formats_from_targets / format_variant), as the hardware does.
- Build: fspx_unpack.py unpacks captured stages as vs/ps with a container holding the signatures the translator
reads; make_game.py translates them into spirv/console-captured, which the shader library loads.
1301 of 1340 captured stages translate and pass spirv-val.
Also:
- Placed-texture refresh runs on a worker with a word-wise hash instead of the present thread.
- A zlib stream longer than its DirectStorage destination gives its first bytes (8192 of a 16384-byte chunk).
Tested: tests/test_fspx_unpack.py (38), dstorage_xs_test (62 checks), gta6rt builds; RTX 4060 Ti.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With LEONIDA_ASYNC_PIPELINES=1 every demanded build, the compute warm-up and
the cache checkpoint ran on one general worker (plus a graphics-only one), so
one long driver compile held every pipeline a submission asked for behind it,
and their draws and dispatches were skipped meanwhile.
PipelineCompiler now runs LEONIDA_COMPILE_THREADS workers (half the logical
processors, 2 to 8). A worker takes the most urgent job it may:
- demanded builds first, in the order they came, then warm-ups by size, then
the checkpoint, which waits until no worker compiles;
- large builds (compute over 128 KiB, graphics of 1 MiB or more) and warm-ups
together take at most threads-1 workers, so one stays free for a small
demanded build; at most LEONIDA_COMPILE_HEAVY_MAX large builds at once
(default threads-1, 1 with LEONIDA_SERIAL_BIG_COMPILES=1), compute and
graphics alike, each still within the memory gate;
- warm-ups run one at a time, and none starts while a demanded build runs:
each holds the compile gate for its whole create, and a submission waits
for every create in flight;
- one build of a PSO at a time, so after_running and the teardown rules hold.
LEONIDA_COMPILE_THREADS=1 keeps the layout before the pool. The design is
MoonEyes' (#2077), ported onto #2098's scheduler.
Tests: d3d12_compile_pool (CPU, jobs held at gates: settings, a long build
does not hold up a small demanded one, heavy count, free worker, warm-ups one
at a time and after demanded builds, order, one job per PSO, release/cancel/
stop_for_exit with jobs in flight), and d3d12_compile_teardown also with one
worker.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The links between the game files and the GPU fail quietly: an llvm-mc whose
gfx1013 decoder rejects words leaves pipeline library programs untranslated,
a translation from older translator sources keeps loading after the module
contract changed, and the runtime's slot-67 refusals sit in a large log.
tools/chain_check.py reads a make_game.py work folder (and optionally one
run's log) and prints one block per link with OK/WARN/FAIL and the most
likely cause: llvm-mc and spirv-val versions and the translator digest
against this checkout; unpacked, listed and translated programs per family
with up to 5 refusal reasons; tagged/plain modules and runtime folders;
loaded modules, failed slot and D3D12 calls, builds, gate waits, faults and
the exit code. The last line names the weakest link.
Counts and fixed words only: refusal reasons are matched against the
messages rdna2spirv.py raises, anything else counts as "other", and paths
appear only with --show-paths. Exit 0 by default, 1 with --strict on FAIL.
Standard library only; documented in docs/dev-tools.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of #2142: the repair needs only the printed encoding, so it now runs before
check_printed_encodings' early returns (no blob next to the listing, header-only blob).
New tests: a listing with no blob gives the full literal, and a text immediate that is
not the encoded literal's low half is left as the text says. design.md: the third shape
now follows the second.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
docs/victory_gap_system.md lists what VIctory serves in the system
modules and the loader against what Leonida did, and marks each gap
ported on this branch or left with the reason. runtime_imports.md no
longer says ws2_32.dll is bound to the host, and host_cpu.h points at
the new console instruction emulation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A record for the base Apple M5 (8-core GPU), the second Apple chip after
the M5 Pro, with its row in docs/gpu_test_results.md.
build.py 281/281, check.py 175/220 (39 skipped, 6 failed),
run_gpu_tests.py 185/249 native (61 skipped, 3 failed) and 215/249 with
LEONIDA_W64_EMULATE=1 (30 skipped, 4 failed), ctest 72/72. Two full
passes gave the same counts. The failures are the ones the M5 Pro record
has: cs_fma_fused, cs_imgload_tfe, cs_imgload_d16_tfe and the
intermittent ps_imgatomic.
Synthetic fixtures only, no game files.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Every export and method of VIctory's apu, audio, dsp, media, speech and
gameinput modules against Leonida, marked same, ported or left with the
reason, plus what to install for the SDL3 GameInput shim.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Port VIctory's GameInput module (gameinput.rs, gameinput/dualsense.rs,
GPL-3.0-or-later) as shims/gameinput_xinput.cpp: XInput pads 0-3, a
wired DualSense over HID, the keyboard as its own device, and a keyboard
pad that stands in while no other pad is connected. Readings per change
with a 32-deep history, blocking and async device enumeration,
UnregisterCallback waiting for a running callback, FindDeviceFromId and
XInput rumble, all as VIctory runs the title.
It is built into gta6rt when the SDL3 shim is not (the main build has no
SDL3), instead of binding the import to the host's GameInput.dll, which
has no keyboard pad; LEONIDA_GAMEINPUT=host keeps that path and
LEONIDA_KEYBOARD_PAD=off drops the keyboard pad. Registered by name and
ordinal #1. gameinput_xinput_test runs it over a fake host.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An update whose source is not a structure of this layout (one the title never
built, which D3D12 leaves undefined) made the refit follow its parent table
anywhere. MODE_CHECK now compares the copied header with the layout, and the
update records both tails: the refit runs when the check passes, a full build
when it fails. The refit walk follows only pointers to the layout's nodes.
A vertex index at or past the geometry's VertexCount is no longer read: its
triangle is inactive. XdxrTriangles carries vertex_count from the desc.
vk_xdxr_build_test: blas_vertex_count and eight update-source cases (zero,
random, another element count, garbage tree; large and small-sort).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Gt9hwRYcpySx4P4ncQ3wD5
A fenced batch waits for its submission's retire ticket. On a queue the layer
holds back (console ordering) the ticket is not ours, and in the worst case
nothing retires soon: the pending list would grow for the rest of the run.
Past 64 pending batches the oldest is now copied back without waiting, once
each, and the fact is logged once. Docs say so.
Conflicts: docs/d3d12_vulkan.md (main's shorter async paragraph, then the
order-log paragraph), runtime/CMakeLists.txt (both test blocks kept),
runtime/shims/d3d12_vulkan_device.cpp (both includes; build_compute now
reports ComputeBuild::ms to the recorder).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A vertex shader outside the package's shader archives (sha256 01ac7810..., used by 20 pipelines in the first 20 s) had no translation, so its pipelines were refused. The runtime now saves such a container as <fssm sha256>-<stage>.dxbc in the capture folder, beside the FSPX programs. make_game.py's shaders stage translates them as it does XboxBvhBuilder.dll's containers, into spirv/fssm-captured, which the shader library loads by fssm_sha256. The captured vertex shader translates and passes spirv-val.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A slot-133 buffer the driver will not import is a shadow of the title's pages,
and the write through it landed in the copy exactly as a window's did. The
mechanism is already the same one - the pages are title memory, the alias of
the buffer resolves through the noter, and the tracker carries the range - but
nothing said so and nothing tested it.
d3d12_placed_write_back: a root UAV over a placed buffer. The pages keep the
title's words until the next submission, then hold the shader's; a write by the
title over the result survives the copy forward.