Repository navigation
chore: replace the project with Leonida Legacy - #17
Merged
Merged
Conversation
Rust workspace for VIctory: PE analysis, loader, HLE skeleton, DXBC/DXIL parsing with a GFX10 decoder, conversion cache, CLI and asset-policy enforcement. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Decode the operand fields of every GFX10 encoding (Instruction::fields) and print them in SP3 syntax (Instruction::text, shader-info --disasm). Read the wave size from the FSSM stage record flags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loader: map title-shipped DLLs, patch static TLS loads to slot 0, crash reporter, title paths for GetModuleFileName*. HLE: task queue and async, XUser (one offline user), system ids, title id, features, invites, game events, persistent local storage, GameInput with no devices, xmem, console audio hardware queues, life cycle (close suspends, then terminates), and a file layer with virtual drives rewritten in path-taking imports. GPU: D3D12.X device, DXGI chain, heaps, resources, fences, queues and command lists translated onto a host D3D12 device; clears, barriers, copies, resolves and PresentX into the title's window. Shaders: SGD5 reader and `victory translate`; SSA IR with node splitting for irreducible flow; structurisation removing EXEC. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GetModuleHandle* and LoadLibrary* find the title's images and our console modules by file name. LoadLibrary* of a title DLL nothing imports maps, binds and attaches it on the calling thread (a title's own loader DLL may load its backends this way). FreeLibrary never unloads title images. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The prepared images get no DLL_THREAD_ATTACH/DETACH from Windows. A TLS callback in our exe, called on every thread of the process, passes each start and end on to the attached images: their TLS callbacks, then a DLL's DllMain. DisableThreadLibraryCalls stops the DllMain calls and fails for images with static TLS, as on Windows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Their TLS callbacks run before std's start routine records the thread, and std aborts if anything asks for the current thread first (stdout and stderr locks do, so title code calling our logging functions would). Threads starting in our exe (the title's main thread and our runtime's workers) now get no notices; the probe test starts its thread in title code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The title now boots through every first-boot and menu screen at its own 30 fps, drawing with translated shaders, with input, sound, saves and loading served; it reaches the world, where the host GPU path still fails (see "Not working yet"). Loader and runtime - Crash reports unwind properly, name C++ throws and host GPU failures, carry the title's last debug lines and are appended to crashes.log. - Thread notices on our own threads, reentrant late DLL loading, exit in the console's order, relaunch on a launch-new-game request. - Offline guard: the title cannot reach the network (sockets, name lookups, WinHTTP, the media source resolver); by-name lookups and loads follow the import rules. - Every runtime area the title calls is served (networking hint, packages, store, saves, display, UI, speech stubs, user, async pool). Saves persist; an update is one rename and survives a kill at any step. - DirectStorage reads for real: shared worker pool, priorities, zlib and BCPack. BCPack is our own decoder; the format's constant tables ship in crates/victory-formats/src/bcpack-tables.bin (the asset policy's one exception, see docs/asset-policy.md). - GameInput from XInput pads and the keyboard, with a keyboard stand-in pad; console timers (1 ms) for the whole process. - Audio: XMA2 decoding on the emulated contexts, Opus on the decoder queues, the DSP interface as a stub; title memory placed below 2^40. - Console texture layouts (sizes, tiling, detiling) and the layout library's imports. GPU - Draws, mesh dispatches and compute dispatches run on the host with shaders translated at first use and cached on disk; descriptor heaps, views, root signatures, barriers and host texture states; rectangle lists; comparison samplers. - Title memory reaches the host through persistent mirrors that copy only pages written since the last copy; shader-written buffers are copied back. - Presentation with frame pacing per event kind; framerate in the window caption. Shaders - DXIL emission for vertex, pixel, compute and mesh programs from the console's native code, with a differential test suite against the PC compile. World set: mesh 8,191 of 8,506, vertex/pixel 10,617 of 12,346, compute 1,643 of 2,539; utility set complete. Build - Debugging aids (debug logs, frame capture, stack dumps, scripted keys, the host debug layer, the software adapter) exist only with the `diagnostics` feature; `[profile.diag]` keeps that build apart. Not working yet - In the world the host device is removed within seconds (descriptor handling fixes are in, unproven by a surviving run) and frames present black. - 64-bit image atomics, merged geometry stages and the BVH builder's own shaders do not translate; reverb is silent. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Says how far the title gets (menus at 30 fps, the world reached but not rendering), what each subsystem does and still needs, and warns that the world can reset the display driver on a real GPU. Adds how to run the title, the translate command, and tables for the keyboard pad and the debugging switches. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
prepare() zeroes the title's TLS AddressOfCallBacks but left the IMAGE_REL_BASED_DIR64 entry that patches it. When the loader maps the prepared copy away from its preferred base, that entry turns the 0 into the rebase delta and the loader reads TLS callbacks from there. On Windows the copy lands at 0x140000000 so the delta is 0; under Wine, which maps DYNAMIC_BASE images high, LoadLibraryExW faults in ntdll before any title code runs. The entry is now rewritten as IMAGE_REL_BASED_ABSOLUTE (a no-op), and the prepare test checks that no relocation targets the cleared field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s-reloc Loader: keep the cleared TLS callback pointer out of base relocations
The title is built for Zen 2 and uses clzero, monitorx/mwaitx and SSE4a's extrq/insertq, which Intel CPUs lack: it died at startup with an illegal instruction on an i7-14700KF. The vectored handler now does their job and resumes: clzero zeroes the 64-byte line at rax, monitorx is skipped, mwaitx yields, extrq/insertq run on the saved XMM registers. Tested: victory-loader crash tests (new one runs each instruction), and the title now gets past startup on an i7-14700KF with an RTX 4070 SUPER. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
next_frame walks the frames before `start` to learn whether the frame at `start` is the packet's last. A damaged packet whose earlier frame has a length of 0 never advanced `at`, so the walk spun forever (in a debug build it overflowed `number` after about 4 billion rounds and panicked). Apply the rule read_frame already uses: a length that does not cover its own 15-bit field is not a frame, and the search ends. Found with a random-input harness. The new test hangs without the fix and passes at once with it.
The exit code ended the other threads first and then started the watchdog. A thread that ends can hold the heap lock or the loader lock. A new thread needs both, so the watchdog did not start and the exit did not stop. Now the exit code starts the watchdog and waits until it runs its own code: only then are its loader notices and Rust's thread set-up done. The watchdog publishes its thread id, and end_other_threads does not end it. The wait has the same deadline as the detach, because this thread, or a thread that waits for it, can hold the loader lock; then the watchdog cannot start. After the deadline the watchdog only ends the process. It does not log, because logging needs the heap and the lock of the log writer. The exit test now also checks that a thread in `keep` is not ended.
…nly-instructions loader: emulate AMD-only instructions on Intel CPUs
Layout::new checked that width, height and depth are non-zero but not that they are bounded, so values a title passes unchecked (up to u32::MAX) overflowed the size arithmetic: `offset * depth` in the linear layout, `slice_size * slices` and the per-mip sizes in the tiled one, and a u32 next_multiple_of in Layout::tiled. Debug builds panicked; release builds wrapped silently and returned a wrong size. Refuse anything past 16384 texels per side, the most a GFX10 image descriptor holds, so no texture the GPU can use is affected. Found with a random-input harness (four distinct overflow sites, none left after this change).
Three lowerings gave results the console's GPU does not (issue ProjectLeonidaL#2, from hardware measurements published by another project): - v_med3_f32/f16: with a NaN operand the hardware gives the minimum of the three; we gave the median of the other two. - v_fract_f32/f16: the hardware never reaches 1.0 (a tiny negative input gives the largest value below it); the host's own fract differs by vendor and can give 1.0. - v_bfe_i32/s_bfe_i32: a signed field running past bit 31 extends from bit 31; the shift is arithmetic now. Fields that fit are unchanged. The fract case is asserted in float_semantics_are_the_consoles (the console compiler emits v_fract_f32 for frac). The other two cannot be produced from HLSL with the compiler the tests use and rest on the measured values in the issue. Still open from the issue: range reduction before sine and cosine, and denormal operands of the legacy multiply. Refs ProjectLeonidaL#2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
v_sin and v_cos (f32 and f16) take an angle in turns. The whole turns now come off first (x - round_even(x), exact), so a large angle keeps its fraction of a turn instead of losing it when scaled to radians. The sine of a half turn and the cosine of a quarter turn are exactly +0, as the hardware gives; the host's functions of the rounded angle give about 1e-7. A zero operand passes unreduced, so sin(-0) stays -0. float_semantics_are_the_consoles asserts the exact zeros (it failed before this change). The compiler the tests use takes whole turns off itself, so the large-angle path cannot be reached from HLSL and rests on the measurements cited in issue ProjectLeonidaL#2. Left from the issue: denormal operands of the legacy multiply, which needs the float mode register as state first. Refs ProjectLeonidaL#2 Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The host device was removed seconds into the world because a shader read a descriptor of the wrong kind: empty slots held a null 2D texture view where the shader expected a buffer, which gave a garbage heap index and a read far past the view heap. Null descriptors now have the kind the shader expects (raw buffer, constant buffer, or a texture of the title's own dimension). The world then ran to a 240 s time limit with no removal. Also: - Host lists hold the textures, pipelines, root signatures and heaps they name, and heap slots hold the resource they view (the title releases objects before submitting lists that use them). - The device-removed report places the fault against the host descriptor heaps and names our own uploads; VICTORY_D3D12_GBV turns on GPU-based validation, VICTORY_DUMP_TARGETS works. - Indirect execution (draw, indexed draw, dispatch, mesh dispatch): the world draws most of its geometry this way. Arguments are clamped and charged to a per-list budget by a small compute pass first, so garbage cannot hang the GPU. Off by default (VICTORY_INDIRECT=1): with it on the title's own GPU watchdog ends the run about 30 s into the world. - Shader-written ranges are copied back once per submission and only where they differ; refreshes beside them copy only stale pages. The frame-rate line counts copy-backs and dropped draws. Not working yet: the world's picture is black (indirect draws off, and hundreds of draws per frame have no translated shader). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The title's shader-visible view heap has 1,245,184 slots. NVIDIA caps shader-visible view heaps at 1,000,000, so HostHeap::new falls back to a heap of 1,000,000 whose title part ends at 934,464, with the dynamic slots after it. The title binds a per-frame table ring in its top slots (934,464 to 1,245,184, moving 4,096 slots a frame), so those tables' host offsets either aliased the dynamic slots or ran past the heap's end. On NVIDIA the GPU then hangs within the first-boot screens (DXGI_ERROR_DEVICE_HUNG), after black and glitched frames. A table that reaches past the host heap's title slots is now made afresh in dynamic slots, as tables holding constant buffers already are, and the shader is given the new offset. Hosts that take the whole heap (AMD) are unchanged. mirror() logs the highest title slot it meets past the host heap, once per new maximum. Tested on an RTX 3080 (driver 32.0.16.2114): the first-boot screens and menus run without glitches, and the title loads into the intro with no device loss (before: device removed about 45-60 s in, 3 of 3 runs). The slot warning went from 78 lines to none. cargo test --workspace passes. Refs ProjectLeonidaL#16, ProjectLeonidaL#11 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-zero-length xma: stop at a zero-length frame instead of looping forever
A section whose PointerToRawData lies near 4 GiB made file_offset + delta overflow: a panic in debug builds, a wrong offset in release ones. The section now yields no offset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ture-extents texture: refuse extents past 16384 texels instead of overflowing
The test for the emulation runs the real instructions. AMD CPUs, and most CI runners, execute them natively, so the emulation was tested only on Intel CPUs. The new tests give the emulation instruction bytes and saved registers directly, so they work on any CPU. They cover clzero, monitorx/mwaitx, the immediate and register forms of extrq/insertq, xmm8 to xmm15, length 0, and the instructions and exceptions it must not emulate. The old test stays: on an Intel CPU it is the only test of the full path through the vectored handler.
Process exit: start the watchdog before other threads end
GPU: make tables past a capped host view heap afresh (NVIDIA menu hang)
…wing the stack In a wave64 compute program, writing only EXEC's high dword (for example s_mov_b32 exec_hi, 0) and then running any vector instruction crashed the whole process with a stack overflow. The new mask is opaque and keyed by the unchanged low dword, so lowering the instruction's guard asked for that dword's value, the value is a lane mask read as data, its ballot needs the mask's lane bit, and that bit needs the value again: mask_dword -> boolean -> atom -> get -> mask_dword, without end. mask_dword now notes the masks whose ballot it is building, and a mask reached again on the way fails with a reason. The instruction then fails like any other that cannot be expressed: its result is missing, and only a side effect that uses it stops the translation. A shader the translator cannot handle must not take the title down at pipeline creation. Found with a random-input harness over the whole translation (ir, resource, io, structure, emit) of random decodable compute programs. The new test overflows the stack without the fix. One million further programs (about 160,000 fully translated) gave no panic, hang or overflow.
The update moved the particle light-atlas compute programs to a form that puts group barriers inside branches and loops; a dispatch of them stood on the card until the device was reset. That form is now off unless VICTORY_WAVE_WIDE=1, and the shader cache key includes the wave switches. Checked with a plain run of this tree on the test machine. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…apter Hosted runners list a display stub first, so the default device there is the software adapter; the tests that need a real card now skip it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- Clean-up passes over each translated module (VICTORY_SHADER_OPT bits: dead code, folding, reuse, branch facts, loads within a block, wave64 first-lane exchange), part of the shader cache key. About 43 % fewer host instructions over the pack; about 20 ms less GPU time per frame on the test machine. - translate: a census of the emitted code. - Checked with plain game runs of this tree on the test machine. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ative VGPR reads keep parked lanes (ProjectLeonidaL#11) The console compiler parks a wave64 lane mask in two lanes of a spare VGPR and may restore the halves with other instructions between the two v_readlane_b32. The pair restore now looks ahead in the block (nothing between may touch the second register, write the first, or save into the lanes), so the mask comes back as a mask. This lets indirect_light_probes CS_IrradianceCache_Shade / ShadeSecondary translate: they were dropped every frame, leaving the irradiance cache unlit and everything in shadow black. An M0-relative read (v_movrels_b32) names every VGPR from its base up, which marked the parking VGPR as an ordinary one and turned unspilling off for the whole program. Relative reads no longer count there (relative writes still do). billboard_nobump CS_RaytracingResolve_a56bfb9c translates with it. translate: VICTORY_TRANSLATE_ONLY=<hash prefixes> limits a run to those containers; VICTORY_HOST_MAX_WAVE=32 translates as on a 32-lane host, so --pipelines matches what the runtime creates on NVIDIA. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Comments, documents and descriptions now say "the title". No code changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Its programs translate and run, but on the test machine the lighting gain could not be shown, it costs about 40 ms of GPU time per frame, and the picture is being re-checked one change at a time from a known-good tree. It may come back once that is settled. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The previous commit took it out; that was not wanted. The tree is again as it was before that commit. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Double-precision shader instructions (v_cvt_f32_f64, v_add_f64 sums, the makeDouble overload name and flag), a first half of a paired interpolation read as data, sooner eviction of idle textures and caches under memory pressure, a retried DirectStorage destination write, the texture catch-up budget, VICTORY_FIRSTLANE_OWN, and zlib-rs in place of miniz_oxide. Left out: the fork's personal launcher scripts and its readme. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e commit) Every host view heap ends at a null slot that view indices past the heap read (a host that takes large heaps gets 2^21 views; one that caps them keeps the capped heap), the cache key includes that limit, and v_permlane16/x16 are lowered. Both forks lower v_cvt_f32_f64. The IEEE form with its test is the one in use; this branch's flush-to-zero form is kept beside it, unused, and its test is ignored until the console's float mode for the instruction is checked. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…acters' skin and hair without colour in most launches) A texture a shader picks by index was uploaded once, when the title wrote its view, and again only if the view was rewritten or the runtime told of a remap. The title often fills the texture's memory only afterwards (its streaming reads land later), so the host copy kept what the memory held at the first look for the rest of the run: zeros. Which textures lost that race changed from launch to launch; the main character's face came out black and her hair pale in about three launches of four. Now a texture uploaded whole is looked at again after 4, 12, 40, 120 and 400 frames (a fingerprint of 48 KiB of its memory); a changed one is uploaded again and the looks start over. One test launch re-uploaded more than 6,000 textures this way. VICTORY_HEAP_RECHECK=0 turns it off. Known gap: the fingerprint samples the start, middle and end of the memory, so a texture whose other parts arrive later is still missed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…he card before the character bake; one host copy per placed texture - The depth bounds test (#82 by Kaivyyy, as is): a pipeline that enables it is made from a DEPTH_STENCIL1 stream under its own library name, and the title's OMSetDepthBounds reaches the host list. Before, such draws passed at every depth. On the test machine (RTX 4070) the first room is lit by its lamp for the first time: walls, table, bunks. - Defaults: what shaders wrote is copied back by a thread of its own (stage 2), wide copy-back, card copies from 1 MiB up to 1,024 MB, and 256 lists in the air. About 230 ms a frame where it was about 400. Off: VICTORY_RELAY=0, VICTORY_WIDE_BACK=0, VICTORY_CARD_BUFFERS_MIN_MB=16 VICTORY_CARD_BUFFERS_MB=512, VICTORY_LATE_WAIT_LISTS=128. - Textures picked by index are uploaded while loading and before a draw of the title's decoration bake, which samples them by index and runs once (VICTORY_EARLY_TEXTURES_MS, VICTORY_BAKE_TEXTURES_MS; 0 turns each off). - Placed textures are keyed without the filler words of their description: two views that differed only there each had a host copy (VICTORY_PLACED_FILLER=1 keeps the old key). - VICTORY_TEXTURE_ROOM_PERCENT (90, unchanged) sets how full the card may get before textures picked by index wait. Known: the first room's walls are still missing in some launches, and shaded areas are too dark (the bounce light has no ray-tracing structure to trace yet). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…freshed when the card is full Two fixes for textures that shaders pick by index, both proven with a slot listing before they were made: - The title keeps only a texture's small levels and places the next texture in the address range of the absent large ones. Described at full size every neighbour overlapped, and each view written took the textures beside it out of the upload queue and made their host slots null (tens of thousands of slots a run). A newer view now makes an older one stale only when it starts within that one's first 4 KiB. VICTORY_STALE_TEXTURES=overlap: the old rule; =0: never. Unit tests on the span table alone. The first room is lit with its walls and the characters' textures in the first launch with it. - With the card at its limit, a texture that already has its host copy is uploaded again when the title changed its memory (it took no new card memory, and was refused all the same). VICTORY_REUPLOAD_WHEN_FULL=0: as before. Logging only, off unless asked for: both video memory groups and budget moves; card accounting (VICTORY_CARD_ACCOUNTING=1); the slots a listed draw's shaders read, with their state (VICTORY_LIST_SLOTS=); a trace for the missing first-room walls (VICTORY_WALLS_TRACE=1 or 2). A card test of what a bare command costs (ignored by default): cargo test -p victory-gpu --release -- --ignored bare_command_cost --nocapture Known: about 3 to 5 frames a second; more than half of the texture memory on the card is held for levels the title has not loaded yet (next). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…rites counted; levels on demand (off); warm-up; card memory numbers Memory sync: - The guard over every view of a physical page (code by myokex, victory-amd c6dc4d8, after pull request #115 by Spexivus, its correction by joroyt and a part of VIctory #1122 by tightfall): the title shows one page at several addresses and a copy was guarded at one only. 0.8 to 1.0 million writes through another view in a five-minute run on the test machine. VICTORY_VIEW_GUARD=0 turns it off. - Kernel reads into title memory are read beside and copied in (Joshua Odom, 10ea38e). - Writes of the storage layer into physical pages are counted where the title has the pages mapped and can open the guards there (VICTORY_PAGE_WRITES, off: counted only). Failed page-destination reads are retried. Card memory: - Levels on demand, off unless VICTORY_LEVELS_ON_DEMAND=1: a texture the title fills takes card memory for the levels the title holds; held levels get memory only while the card has room and are asked for again. Its test runs on the software adapter; not run on a card yet. - Refused texture slots are held back so a pass reaches the slots behind them; room can be kept for card copies of title buffers (off). Tools: translate --warm all; the shader cache is keyed on the translator's source; counters for copy-back races, page writes and the copies the texture sweep never lets go; a walls trace. Game runs of these changes on an RTX 4070: five five-minute runs without a device loss or a failed request. This merged tree was built; its test suites were run on the tree the changes come from (gpu 129, hle 97). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ored, views off their copy's elements get their own bytes, card room for the first world frame, levels on demand run on the card - Descriptor records the title copies into its heap as bytes are mirrored before each submission (pull request #305 by Flyander, after upstream VIctory 86a5ed6), with a per-slot fingerprint so only records that changed are mirrored, the page read through the kernel, a switch (VICTORY_HEAP_SYNC=0) and a counter: about 40,000 records a frame on the test machine. - A buffer view off its copy's elements gets a copy of its own bytes (after upstream 86a5ed6; VICTORY_VIEW_OWN_COPY=0: refused as before). - Room on the card for the world's first-frame bursts: buffer copies (VICTORY_CARD_ROOM_FOR_BUFFERS, now on) and render targets (VICTORY_CARD_ROOM_FOR_TARGETS_MB, 3,072); a copy turned down gives its room up and is logged; the texture pass asks again every 32 MiB. 98 buffer copies made (945 MB) where earlier runs made 1; 25 MB compared on the processor a frame where it was 550 to 710. - Levels on demand: the fixes of pull request #747 by AscilCH. First run on a card (RTX 4070, VICTORY_LEVELS_ON_DEMAND=1): no device loss, 3.1 GB not allocated for levels the title does not hold. Still off by default. - The guarded blocks under storage writes into physical pages are opened by default (VICTORY_PAGE_WRITES=0: counted only). - Shaders: a program is translated with first-half interpolation pairs only if it was refused for one (with it on for every program 8,551 working pixel programs came out changed); parked lane-mask pairs, f64 conversions and sums, lane permutations: 14 more programs translate. - Counted, not fixed: an indirect compute pass asks for about 77,500 groups in x and is cut to 65,535. One five-minute game run of these changes on the test machine: no device loss, no failed request. This merged tree was built; its test suites were not run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…c, draw-table slots left to their draws, no failing write-watch calls; card fetches inside their flights (off by default) - Descriptor sync: a multiply-and-fold fingerprint of a record in place of BLAKE3 (35 to 42 ms a frame over 250,000 to 300,000 records), and slots that draws read through tables lately are left to their draws (VICTORY_HEAP_SYNC_TABLES=1 mirrors them too): the pass over the heap went from 70-220 ms a frame to about 3. - Write watch: no kernel asking for memory the guards already hold as view memory (pull request #670 by Jonirulah). - Card copies' flagged pieces can come down inside their own flights (pull request #648 by Jonirulah; VICTORY_CARD_FETCH_INFLIGHT=1, off by default). One game run with it on: no device loss, the copy-back thread's fetch wait 181 -> 0 ms a frame, the card busier; no frame-time gain claimed. - Logging: the heap pass's texture part and buffer slots; indirect compute dispatches over 65,535 groups. - README: what was measured, and that pull request #220 with VICTORY_INDIRECT_WINDOW=1 lost the device twice here and is not in. One five-minute game run of this tree's source on an RTX 4070: no device loss; the frame is still 250 to 380 ms (the card is the limit). This merged tree was built; its test suites were not run. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…queue for fetches, indirect draw windows made safer, a profiler; all behind switches - VICTORY_ASYNC_SUBMIT=1: submissions are prepared and sent by a thread of the layer, in order, instead of by the title's render thread; the queue's line stays open while its head is prepared. - VICTORY_QUEUE2=1: fetches of what shaders wrote to copies in the card's memory go to a copy queue, with the fix for a piece fetched beside a later flight (fetched again when that flight lands). - Pull request #220 (cheaper indirect draws) is in, its windows off by default; a draw record of 2^23 vertices an instance or more runs empty (its window checker found one list drawing 90 such records). - Fills of upload memory and read-only title buffer copies no longer wait for flights; each is checked against what the flights then wrote, and the first mismatch turns the waiting back on (VICTORY_FILL_WAIT=1). - Up to 512 idle host lists and the texture staging buffers are reused. - VICTORY_MERGE_GAP / VICTORY_MERGE_RUNS (off / 512 by default; the gap form is not exact, see its comment). - VICTORY_PROFILE=1 (diagnostics builds): a sampling profiler inside the layer. - README: what was measured, the history of the device losses with windows, and what is still open (frame rate dips; cause not known). Measured on an RTX 4070 in the first room: about 3.5-4 frames a second before, 6-7 with all the switches, defaults about 4.5-5. Five runs with windows on since the fix, no device loss. This merged tree was built; its whole test suite was not run (the tests around flights, queues, indirect draws and the copy queue were, on the development tree). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…atch, a forbidden self-copy removed; draw windows measured at 6.0 -> 8.9 frames a second - VICTORY_FRAME_LOG (on in diagnostics builds): every frame's length, and what the usual frame and each long frame were made of; VICTORY_CARD_METER adds the card's time by kind of list. - VICTORY_CAPTURE_WORLD_EVERY: a saved frame costs 235 ms inside the present, which was the regular dip of test runs (every 8th frame). - A driver watch (VICTORY_DRIVER_WATCH=0: off): entries of a display driver in the system's event log are logged as they are recorded; the first one turns draw windows off for the rest of the run. Every device loss here was announced that way 2.7 to 55 seconds ahead. - A copy between two title textures that share one host texture is left out (the host does not allow a texture copied onto itself): 402 in a five-minute run. - The list of shader-visible heaps is a reader-writer lock; the heap sync takes a changed page's records under one lock; guarded view memory is left out of the write-watch askings ahead (after triippywhale cc368c7c, d0581a55). - Behind switches, off by default: VICTORY_COPY_PLAIN, VICTORY_REFRESH_ONCE (after upstream 6d021fe), VICTORY_VIEW_KNOWN, VICTORY_BACK_OWN_VIEW, VICTORY_ASYNC_PRESENT, VICTORY_BVH_HOLD (refused: the picture loses its indirect light), VICTORY_CARD_REHASH_RUNS=alt. - The process opts out of the system's efficiency mode. - README: what the instruments measured and what is still open. Measured on an RTX 4070 in the first room: 6.0 frames a second on average with windows off, 8.9 with VICTORY_INDIRECT_WINDOW=1 (one run each, the second with the driver watch; no driver entry, no device loss). This merged tree was built; the unit tests of the changed parts were run on the development tree, the whole suite was not. One test of the indirect budget on the software adapter is flaky (it was before these changes). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…d a corrected comparison of draw windows - VICTORY_COPY_PLAIN=1 also serves reads of title memory into buffers of the layer; reads under 256 bytes stay with the kernel and a source that faulted is left alone for two seconds (the first form took the layer's one-byte askings too: 1,000 to 1,300 faults a frame). - The submit and copy-back threads ask for the fast cores of a hybrid processor (VICTORY_FAST_CORES=0: not). - VICTORY_DISK_CORES=slow (off): the DirectStorage workers ask for the slow cores. - README: the 6.0 against 8.9 frames a second given for draw windows compared runs in different scenes and is withdrawn; frame time against draws per frame is given instead. A first play session past the first rooms lost the device in the open world with the card out of room for new textures; cause not known. Measured on an RTX 4070 (one run each): at 4,500 draws a frame 145 ms with windows off, 124 ms with windows on and copies in place; 7-8 frames a second in the first rooms, 10-12 in lighter views. No driver entry, no device loss in that run. This merged tree was built; the unit tests of the changed parts were run on the development tree. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… our own view (9.6 fps in the first rooms) - Meters: how the title paces itself on its fences (fence.rs pace, console_insn.rs mwaitx waits and exceptions by kind), the card's time by list and by pipeline (cardmeter.rs), indirect commands by what became of their clamp, switches that alternate inside one run. - VICTORY_JOIN_PARTS=1: parts that follow one another in the queues' lines go to the host as one submission (29 -> 9 a frame), about 6 %. - VICTORY_BACK_OWN_VIEW=1 measured and proved (VICTORY_BACK_OWN_CHECK=1): about 9 %. - The 15-byte clzero loop is taken whole; a section handle's number coming round again forgets our view of the earlier section. - Measured at nothing, left off: REFRESH_ONCE, ASYNC_PRESENT, VIEW_KNOWN, SPREAD, QUEUE2=3, WINDOW_JUMP. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…THER=1): 10.3 fps in the first rooms - A single indirect record that misses its window gets a slot that the list's prelude fills in one clamp pass by a table of offsets; proved by re-clamping every gathered record at its draw and comparing on the card (7.9 million, none differed). - Gathering ends at a dispatch or at a draw whose shaders can store to buffers; why a record got no slot is counted. - README: the card's time added up (about 50 ms a frame are the title's own passes as translated). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… card copies (off) - fpsbox.rs: the frame rate drawn into the top left corner of every frame shown, for captures of the picture (VICTORY_FPS_COUNTER=0: not). - VICTORY_COPY_CHANGED=1: a refresh of a copy in the card's memory sends on only the 256-byte chunks that differ; measured, no net gain yet, left off. - README: the numbers so far are the scene standing still; while the title streams, half the time goes to frames in which the card is idle. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…page mapping, both taken back out The mean while the title streams is 4.5 frames a second; its page-mapping copies cost 32 ms of every cutscene frame in kernel map and unmap calls. Leaving unchanged pages alone finds none; mapping pool pages in a row as one view halves the calls but broke faces in 3 launches of 3 and is reverted (no code change in this commit). Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the old Python and C++ build with Leonida Legacy. That is the Rust compatibility layer from fxceless/victory-gta6, itself a fork of Marvisak/VIctory, renamed to Leonida Legacy. The owner asked for this.
What's in it
chore: rename VIctory to Leonida Legacy: crates, the app (leonida.exe), config files, the.leonida-rootmarker and everyVICTORY_*switch (nowLEONIDA_*). Credits, links and upstream commit references still name VIctory and victory-gta6, as the GPL requires. The license stays GPL-3.0-or-later.docs/fork-notes.md.scripts/rename-from-upstream.ps1: renames whatever gets merged or cherry-picked from upstream. Running it on this tree changes nothing.leonida runno longer needs a path. On first run it asks for the game folder, saves it toleonida.toml(git-ignored), and finds the exe fromMicrosoftGame.config.leonida.example.tomlno longer ships a game path.How the branch is built
The two projects share no history, so the top commit is a merge of the old
main(89b95f3) made with-s ours. That keeps the old history as a parent, while the file tree is exactly Leonida Legacy. All files from the old project are removed by this pull request. A copy of the oldmainis also kept asold-mainon ShinniUwU/leonida.Tested
On Windows 11 Pro, Ryzen 7 7800X3D, RTX 3080 12 GB, driver 621.24:
cargo check --workspace --all-targets: passes.cargo xtask policy: passes.cargo test -p leonida -p leonida-core: passes, including new tests for the config writer and the exe lookup.cargo test --workspace: one failure,warp_budget_saturates_without_wraparound_and_preserves_draw_fields. It fails the same way on unmodified victory-gta6d510ee4.cargo clippy --workspace --all-targets -- -D warnings(what CI runs): 9 errors inleonida-gpu. They are the same 9 errors as on unmodified victory-gta6. So CI will be red, and the rename did not cause it.leonida runwith no arguments foundgame_scarlett_master.exefrom the manifest, mapped it and bound every import with 0 missing.leonida run --executereached the menus at 30 fps. The world frame rate was not measured on this machine.Not claimed in the coordination issue: this replaces the whole project rather than one item.
AI-assisted.
🤖 Generated with Claude Code