Split non-escaped, statically indexed Function-scope arrays (such as
%vgpr[256] and %sgpr[128] when no dynamic v_movrel*/s_movrel* indexing
exists) into per-slot scalar OpVariables for only the live slots
referenced after dominator-tree forwarding and DCE, eliminating the
monolithic array allocas and their static OpAccessChains.
Preserves arrays with dynamic indices, whole-array loads/stores,
escapes, decorations, non-null initializers, or negative/out-of-bounds
static indices; canonicalizes signed/unsigned constant indices with
equal value and rewrites multi-index OpAccessChains cleanly.
Fixes all 19 remaining mismatches against LLVM 21.1.8 gfx10_ds.txt (1,708/1,708
decoded vectors exact):
- ds_condxchg32_rtn_b64 (6 vectors): checking '2_ in name' falsely matched
'32_', printing offset0/offset1 instead of a single 16-bit offset. Restrict
2-address detection to ds_read2 / ds_write2 / ds_wrxchg2 prefixes.
- ds_swizzle_b32 (13 vectors): match LLVM AMDGPUInstPrinter::printSwizzle by
omitting offset: when offset16 == 0, printing offset:swizzle(ROTATE,dir,size)
for 0xC000..0xDFFF, and printing offset:swizzle(FFT,mask) for 0xE000..0xFFFF.
- Mark Gen.ij_quad_eval with shortcut: in tools/rdna2spirv.py and update docs/design.md
to state that binary32 quad finite differences amplify rasterizer input rounding by
(1 + 2|alpha| + 2|beta|) (~|i - I_c| / |dI/dx| up to primitive pixel span) and that
det == 0 (including 1D/line primitives with constant J) falls back to P_c.
- Tighten test_perspective_fixture_branch_and_f16_halves against a binary64 Jacobian
oracle and add test_wide_2048px_perspective_extrapolation_bound_and_line_det_zero_fallback
covering a 2048px perspective triangle (P in [1.5, 4096.0]) and line det == 0 fallback.
Gen.ds_permute lets each destination lane scan the 32 source lanes of its half: per source
lane a shuffle of the published target, a shuffle of the data and an OpSelect that keeps the
data when the target is this lane. Each shuffle was used once and so was every link of that
chain, so SPIRV-Cross (MoltenVK) wrote the 32 steps as one nested ternary under the EXEC
ternary of the register write. A lane that takes an outer arm, or is off in EXEC, then runs
none of the shuffles inside it (the SHADER-529 mechanism).
On an Apple M5 (MoltenVK 1.4.2) tools/lds_fuzz.py --wave 32 --permute had 17 of the 100
programs of seed 31002 differ from the model, every one in a ds_permute_b32 result, mostly 0
where a source lane's data belongs. Both shuffles are now stored to Function variables
(Gen.eager), as the DPP rule stores its ballot bit and its shuffle.
tests/semantic/test_ds_permute_eager.py checks the three native forms with
test_dpp_eager_subgroup.py's model of SPIRV-Cross's single-use forwarding, and the values
against test_ds_permute.py's ISA model.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A register holds this lane's bit of a lane mask; v_mbcnt, s_bcnt1 and
s_ff1 gather the other lanes' bits with a subgroup operation
(Gen.wave_mask). v_mbcnt writes a VGPR, so its result is selected on the
lane's EXEC, and MoltenVK's SPIRV-Cross inlined the single-use gather
into the taken arm of that ternary:
v6 = active ? popcount(simd_or(mine ? bit : 0) & below) + acc : v6;
A lane that is off never ran the gather, so its bit was missing from
every other lane's count. Gen.wave_mask now stores the gather to a
variable of its own with Gen.eager, as SHADER-529 did for DPP's ballot
and shuffle.
On an Apple M5 (MoltenVK 1.4.2), tools/crosslane_fuzz.py with wave 32,
native and no maskdata goes from 92 of 100 programs matching to 100 of
100, and from 193 to 200 of 200 with DPP at seed 7.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Avoid SSA dominance violation when wide coherent s_buffer_load_dwordxN
falls into its inline partial-OOB slow path after calling get_ptr() in
the fast branch.
AI-assisted: Antigravity (Gemini 4 Neon).
Emit VulkanMemoryModel NonPrivatePointer/MakePointerVisible/Available for
glc/dlc buffer ops and reads_glc_buffer metadata, specialize literal S#
samplers via OpSpecConstant, elide dead uint/sint image_read_typed paths
when float-only, replace the 77-way buffer_store_format switch with a
compact lookup table, and emit writes_buffer + buffer_write_slots metadata.
AI-assisted: Antigravity (Gemini 4 Neon).
Guard all cross-lane subgroup shuffles and broadcasts against unlaunched
lanes, eliminate %uint_0 fallbacks in favor of SubgroupLocalInvocationId,
and add static SPIR-V verifier (check_absent_lane_ub.py), wave-interpreter
unit tests, and a Vulkan GPU validation test.
AI-assisted: Antigravity (Gemini 4 Neon).
test_tool_stdout_encoding fails on main: leonida_launcher, ps_prompt_glyphs,
victory_saves, volume_stats, world_hotspots, fetch_vkd3d_proton, port_ctl and
sync_victory still print paths a Windows ANSI code page cannot encode, and die
with UnicodeEncodeError when stdout is redirected under python -I. Add the
same one-line guard the other programs already have (exe_sha.py, #605).
Tested: test_tool_stdout_encoding (4 tests), test_tool_startup,
test_victory_saves, compileall, run_semantic_tests (6397 tests, 0 failed).
AI-assisted: yes (Qwen Code).
Reads 38 flat-coloured PNGs (one per Main_Button_<N>, the 64 x 64 canvas plus one
pixel a side, at a whole multiple) from a folder the player names and writes the
title's glyph movie with their drawings, the two ways ps_prompt_glyphs.py does
(over the title's own movie, or standalone). Standard library only; the pictures
and the movie stay on the player's PC.
- each pixel is split into coverage of anything, of white and of grey; the
half-covered line of each is followed between pixel centres, an edge placed by
the coverage of the two pixels it lies between;
- each closed line is one painted piece, outermost first; a hole through the
picture is cut out;
- straight edges and quadratic curves within --tolerance (0.03 canvas pixels),
none across a bend; a corner the anti-aliasing rounded is put back where the
edges on its two sides cross;
- a line that repeats in several pictures or places is defined once, and pieces
that always appear together are one shape;
- the movie written is read back, drawn at the pictures' scale and compared,
per N; --sheet writes those drawings as a contact sheet.
On the set it was written for: 7,067 bytes of shapes and sprites of the 15,226
the title's movie leaves, 4,207 of 1.6 million opaque pixels differ, none by more
than half a pixel's worth. Not run in the title yet.
ps_prompt_glyphs.py: build_over and build take another set's sprite builder and
Movie; Movie(compact=True) writes level and upright edges as SWF's short record.
Its own output is byte for byte what it was.
tests/test_pc_prompt_glyphs.py: pictures made by the tool's own rasteriser are
traced corner for corner, shared lines are defined once, a written shape reads
back as given, a built movie draws back to its pictures.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
After the merge the tree held this branch's older states of files main maintains. Run against main's code,
tests/test_acphal_abi.py and 11 of the 15 translator tests that differed failed, and the C++ runtime would have
been built from two generations of its sources. So that the merge cannot break what main builds and tests:
- runtime/ is main's, file for file (68 files only this branch had are not carried over);
- every file under tools/, tests/ and docs/ that both sides have is main's (80 files);
- ten translator tests only this branch has, which test rules main's translator does not have, and their
fixtures are left out.
What main gains: d3d12/ (the Rust D3D12 runtime), its launchers and helpers (Launcher.bat, scripts/play*.ps1,
play-linux.sh, port_ctl.py, smooth-motion.ps1, fetch_vkd3d_proton.py, sync_victory.py), mods/example_lua, eleven
notes under docs/, seven tools and the tests that pass with main's code, the README's sections and credits, and
the "Runtime traps" section of AGENTS.md. Everything left out here is on the branch port/d3d12-nvidia.
Checked: compileall; make_game.py --help; check_no_game_data.py over every file this adds to main; the
line-ending, docs-encoding, CI-registration and docs tests; each test file that differs from main, on its own.
Not run: the whole translator suite, the C++ build, cargo over d3d12/ after the merge (d3d12/ is byte for byte the
branch's), CI.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The picture behind PLAY is the one chosen in Settings (Launcher, Background picture), else the newest background.webp,
.png or .jpg in the launcher's settings folder (%APPDATA%\Leonida), else the newest capture, else the drawn art. When
there is none, launcher/serve.py fetches the game's key art from rockstargames.com once at start (2560 wide) and
keeps it there as background.<the type that came back>; --no-art leaves it. The request names a plain browser and
nothing about the user or the project; what comes back is kept only if its bytes are a PNG, JPEG or WebP. The picture
is never part of the repository.
Over a picture the page sets it a little lower, so heads clear the words top right, fills the band above with the
picture's own top row, and moves the cards to the bottom so the faces stay clear. /media/background needs the run's
cookie and serves only a picture by its bytes.
Tested: python -I tests/test_launcher_serve.py (10 tests: picture kinds, which background, the fetch against a local
server, token, Host, Origin, cookie, preview starting nothing) and tests/test_leonida_launcher.py (15), the
no-game-data check, and the page in a browser with the server in --no-run mode: the art was fetched (2560x1440 WebP)
and shown, Settings names the file in use.
AI-assisted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings the D3D12 runtime branch (d3d12/, its launcher scripts and notes, and the pull requests reviewed and applied
on it) together with mandy's main.
Conflicts (67 files, none under d3d12/): docs/, make_game.py, runtime/, scripts/build_runtime.ps1, tests/ and
tools/. Every one takes main's side: main is where that code is maintained, and this branch's copies were older
states of the same files or the same pull requests in another form. tests/test_fspx_unpack.py is main's too, as it
tests main's tools/fspx_unpack.py. Nothing under d3d12/ is changed by the merge.
Checked before pushing: python -m compileall over make_game.py, tools and tests; make_game.py --help;
scripts/check_no_game_data.py over the files this adds to main; tests/test_text_write_line_endings.py. The
translator suite, the C++ runtime build and CI have not run on the result.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
launcher/index.html is the window: a slim black rail of square tiles with a selection bar (four setups of the one
game), art over the whole window, the sections as uppercase words top right, the logo with one large light PLAY
button and a small menu button, and a row of black cards (what is still to do, the newest captures, the latest
changes). Mods, Saves, Captures, Tools, Settings and About are a dark sheet over the art. The logo is the
repository's assets/logo.svg; the art is drawn by the page. Nothing is loaded from the network.
launcher/serve.py serves it on 127.0.0.1 only and does what the page asks through the functions of
tools/leonida_launcher.py: settings, the mod switches, the save list and back-ups, captures, PLAY and Stop, the
tools. Requests need the Host of this machine, the run's token (a header for /api, a cookie for pictures and the
event stream), and name things by folder, index or name, never by path. --no-run looks only: PLAY and the tools
say what they would run and start nothing.
tools/leonida_launcher.py: the settings and the command line know the newer switches of scripts/play-d3d12.ps1
(-SeriesS, -Dlss, -FrameGen, -Aspect, -PresentScale, -Adapter), each checked before it is kept.
Tested: python -I tests/test_leonida_launcher.py (15 tests), check_no_game_data on the new files, and the page in
a browser against the server in --no-run mode (every page, the menu, PLAY printing its command). PLAY, Stop and the
tools were not run for real: another session had the game running. Launcher.bat still opens the Tkinter window.
AI-assisted.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Lower pure scalar-spill VGPRs (touched only by immediate-lane v_writelane_b32 with non-VGPR source and immediate-lane v_readlane_b32, with every read lane definitely written on all CFG paths) to parked %sgpr slots for both wave32 and wave64 across all shader stages, instead of emitting OpGroupNonUniformShuffle.
Previously only wave64 VS/PS/GS parked pure scalar spills (halves_analysis), leaving wave32 fragment shaders shuffling spilled V# descriptors from lanes that can be inactive or unlaunched on small triangles or after discards (Vulkan SPIR-V UB returning stale physical VGPR bits, causing GPUVM read faults on RX 7900 XTX / RADV 26.3.1).
Tested:
- python3 -m unittest discover -s tests/semantic (6,393/6,393 pass) + new absent-lane wave32 PS regression test (195/195 targeted pass)
- Retranslated all 1,173 v_writelane_b32 shaders (1,173/1,173 pass spirv-val)
- Verified on RX 7900 XTX (RADV Mesa 26.3.1): two consecutive 240 s fast-load runs at 0.0 s warm graphics PSO compile time with zero GPUVM faults.
AI-assisted: Antigravity (Gemini 4 Neon).
The glyphs are the vector sprites of the input-icon GFX movie in data.rpf (docs/prompt_glyphs.md), not
textures. The tool reads that zlib stream read-only (nothing is decrypted, the table of contents is not
used), rasterises every export (solid fills by the even-odd rule, strokes with round caps and joins,
PlaceObject2 placements) and writes one PNG per export, a contact sheet and a listing. It refuses an
output folder inside the repository, and stops with an error on anything it does not draw (gradient or
bitmap fills, colour transforms, clip layers, nested sprites). Standard library only.
docs/prompt_glyphs.md: the fills, strokes and placements counted over all 131 shapes, and the command.
Tests build their movies by hand (no game data): tests/test_xbox_prompt_glyphs.py, 18 tests.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>