Lessons#
What this project would tell the next Xbox 360 recompilation, in rough order of how much time each would have saved.
Measure the game before writing a renderer#
A census of what the game sends the GPU (render target configurations, resolve kinds, texture formats, primitive types, side effects) turned "emulate Xenos" into a bounded list. A renderer that handles exactly that list, and refuses anything else with a logged reason, was smaller and much faster than the general path it replaced. Keep the census tool: every new route is checked against it. See Native renderer.
Replace the parts where emulation is expensive (render targets, EDRAM, resolves, clears) and keep the parts that already work (shader translation, the texture decoder). A rewrite that started from "render six draw families natively" was slower than emulation and fell back on unseen scenes; the version that worked covered every surface and resolve the census found.
Find where the frame actually goes#
A knock-out proves a dependency, not a pass's purpose. Removing FH1's 1280-wide depth pass removed shadows, leading to its older sun-map label. Ordered texture/resolve traces and depth-output comparisons instead show camera-view depth feeding the screen-space shadow mask, before scene shading reads that mask. Reusing the same frame's main depth would arrive too late. Also trace whole padded guest allocations: the scene texture spans three band resolves, and looking up only its first byte misses two producers. Depth and post-chain dependencies.
Profile before optimizing generated code. Here the guest threads were flat, with no function above 3 %, and at 1x the limit was the host thread recording GPU commands: about 1.6 µs per draw at 5,000 draws a frame. Halving that per-draw cost was worth more than any change to code generation.
Most per-draw savings came from noticing that inputs hadn't changed. 58 % of draws changed only shader constants, so caching pipeline, binding and constant derivation behind a state epoch paid off repeatedly. Replaying whole recorded draws did not: proving a recorded draw is still valid cost as much as deriving it. Once each subsystem got an O(1) unchanged-since-last-draw test (fetch constants written, a texture usage generation, a per-state memo), skipping the stages it covers saved 8 % of a draw. What remains is spread over about 20 small steps, so per-draw reuse has a floor, and only replaying whole buffers on the GPU goes below it.
Owning a pass's draws runs into the same limit from the other side. A pilot that drew one pass (the vegetation lists) from programs the backend owns was exact (4.6 million draws compared, no difference) and removed every derivation step it replaced, 70-160 ns of a 600-1,000 ns draw. Checking that each draw still matched its record cost about as much, so the complete cost was even on the desktop and higher on the Odin. Measure such a pilot against the work it replaces running alone, not against a mode that also pays for the lookup and the match (GPU optimizations).
A cached texture object also depends on memory ownership. The same fetch constants can select ordinary memory after a CPU upload and scaled memory after a resolve. Reusing an outdated pointer bypassed that choice. A test of the shared cache with synthetic allocations caught the stale object without needing a GPU or an editor save; an unrelated texture stayed loaded throughout. Re-derive affected entries when ownership may have changed, and keep gameplay qualification separate from that unit proof (GPU optimizations).
Ownership must also cover the data a fetch actually reads. One old resolve page in a mip range redirected an entire compressed texture, including its CPU base, to the scaled buffer. The livery editor made this visible as noisy world signs after memory reuse. Requiring all stored base and mip pages to belong to resolves fixed the reproduced corruption; a synthetic mixed-ownership test failed before the change. A valid cache key needs a valid source for every stored subresource.
Expiration must free admission as well as invalidate lookups. The optional draw-program mark table ignored marks older than eight swaps but never reused their slots: filling its 4,096 entries permanently blocked new list marks. A synthetic saturation test failed before expired entries were reclaimed and passes with reclamation. Separately, 16,385 simultaneous write watches and cancel/reuse testing confirm that FH1's watch allocator grows beyond its 8,192-entry pool chunks. Audit the full branch before borrowing another renderer's reset strategy; make slow fallbacks visible in counters. Capacity inventory and soak method.
Measure where players look#
Scripted routes run hidden to be repeatable, and every Mac qualification did. Players run full screen. On a Mac with a high-density display that means a drawable of up to 20 million backing pixels, which cost the M4 Pro 3 ms of GPU a frame and halved its frame rate while the game's own frame time didn't move. Reports of 10 fps on screen beside 80 fps in the frame log are the sign: the frame is made in time and lost in presentation. Run at least one measurement visible, full screen, on the display the players have, and compare presented frames with game frames (macOS drawable).
Waits are performance#
The largest CPU savings outside the renderer came from how the host waits, not from translated code:
- The game's GPU fence poll loop, turned into a short spin and a block: −15 % process CPU.
- A spinning timer thread, a spinning render idle loop and polled multi-waits, each turned into a blocking wait.
- Windows rounds sub-millisecond sleeps to yields; a yield that returns at once can expose a race the console's scheduler hid.
- macOS short sleeps overshoot under load. The GPU thread's 100 µs sleeps in a register wait gave a free-roam p99 of 41.8 ms on an M4 Pro; yielding for up to 2 ms first gave 19.8 ms.
Let the calling convention bound the state you sync#
Keeping guest registers in host locals only pays if the syncs with the register file are cheap. Writing every local back and reloading it around each call cost as much as it saved. The guest ABI already says which state survives a call. On PowerPC that is cr2–cr4 among the condition fields, so a call or return writes back only those and reloads nothing. That turned a measured no-gain into 11–12 % fewer instructions on the hot threads. Keep the full sync only where code reads the register file directly: hooks, setjmp/longjmp and exceptions. See Recompiler.
The same reasoning applies to tracked modes such as the float flush mode: a small dataflow pass over the generated function, meeting the state of every path into a label, removed 29 % of the toggles.
Bound the sync by what the code touches as well. Compiling a call tree into one host function on a local copy of the register file made it 36 % slower on arm64 while copying the whole file in and out. Copying in only the registers the tree names and writing back only those it writes turned that into 29-33 % faster on x86, and making its guest memory accesses non-volatile into 4-6 % faster on arm64. See Recompiler.
Check the calling convention before trusting it#
Keeping guest registers in host locals pays only if the synchronization with the register file is bounded by what the callee can see, and the natural bound is the calling convention: volatile registers are dead after a call. A checking build tested that on the race route by poisoning every volatile register after every call with a value naming the register and the call site. It crashed within two seconds: one function calls another in a loop without setting the fourth argument again, so the callee stores through whatever its previous call left in r6. The non-volatile registers, by contrast, were preserved by every call checked. So the convention bounds the callee-saved state, not the caller's: a generator may only drop a volatile register at a call when the callee's own code never reads it before writing it, which the generator can compute from the callee bodies it has. See NEXT_LEVEL_RESEARCH.md.
Once the guest's floating-point values live in host locals rather than in the register file, the compiler no longer keeps arithmetic on the right side of a host FP control write: it does not model the FP environment, and nothing in memory ties the operation to the write. A translation that switches flush-to-zero around vector code then flushes a scalar denormal the register-file version keeps. Either keep such functions in a mode where the switches do nothing, or keep the values in memory. An offline check that ran the old and new translation from the same synthetic state caught this, and a second bug: an inlined register restore was treated as giving ctx its entry value back, which is wrong once the register has been stored to ctx before a call. Checking every register and every byte written, not only the return values, is what found both. See Recompiler.
Find the API behind a kernel primitive#
Generated functions carried an entry switch so the runtime could resume them at a return address, because the game switches stacks through a kernel call that abandons the host call chain. The kernel call had exactly two callers, and reading them showed the OS API they implement: SwitchToFiber. The runtime already had host-fiber versions of the five fiber functions; mapping the game's copies onto them made every generated function single-entry, removed 342,683 switch cases and 7.4 % of the generated host instructions, and let Clang see reducible loops. A primitive the runtime emulates at the kernel level usually belongs to a small, well-documented API one layer up, which is cheaper to serve whole than to emulate underneath. See Recompiler.
Ask why an inherited offset exists#
The largest instruction class in the hottest generated functions was not game work. It was a select that added 4 KB to every guest address at or above 0xE0000000, inherited from the emulator's memory layout: Windows' classic view-mapping call only places a view at a 64 KB file offset, so the view that should start 4 KB into the physical heap was mapped short and every access paid the difference. Newer placeholder views accept any page-aligned offset. Mapping the view where it belongs removed 625,000 selects and, with two volatile registers moved into locals, 22.6 % of the generated host instructions and 20 % of the code. Before optimizing translated code, check what each fixed cost in the access path is for and whether the host still needs it. See Runtime.
Port to a second architecture early#
ARM found bugs x86 hid:
- Memory ordering. x86 is strongly ordered, so dropping the guest's barriers was harmless there. On AArch64 they had to be emitted as fences.
- Page size. 16 KB pages broke the
0xE0000000view offset and the write-watch protection, which assumed one guest page per host page. The offset stays on Apple silicon, so every hand-written import that turns a guest address into a host pointer must go through the translation, notbase + address: when the critical-section entry hooks added the address directly while the leave path translated it, a lock in physical memory was entered and left at different host addresses and the game hung at boot on the Mac only. Bisecting dev commits on the Mac found it in one afternoon. - Tracking granularity. GPU shared memory tracked validity per host page, so on 16 KB pages a 4 KB resolve shared its page with CPU data, and a CPU write beside it threw the resolve away. The exposure resolve went stale and free roam averaged luma 171.5 against 114.7 on Windows, with flashes. Tracking in 4 KB guest pages and passing the exact faulting range down, so GPU-written pages the write missed are kept, brought it to 111.9 and cut resolve reloads from 13.1 to 3.5 a frame. Host protection stays per host page; only the bookkeeping is finer. Compare per-frame reload counters between platforms when one looks wrong but renders the same draws.
- Window resizes. On MoltenVK, a swapchain created from the old one on the same
CAMetalLayerpresented without errors, yet after every resize the window showed one flat colour, menus included, while the game kept running. A stack sample showed the presenter still drawing and presenting; recreating the Vulkan surface for the layer on each resize fixed it. When a port shows nothing but the process is healthy, sample it before suspecting the game. - Drivers. Each mobile driver needed its own workaround, and frame replay on two devices was the fastest way to bisect them.
- One variable, two copies. A mutable
static inlinemember defined in a header is a weak symbol in every shared library that uses it. Android's linker resolves each library within its own group, so the generated code (libmain.so) and the runtime (librexruntime.so) each had a copy of the global lock's switches, and a setting the runtime changed never reached the generated code. An in-run A/B that toggled such a switch measured nothing;llvm-nm -D --defined-onlylistingVsymbols in both libraries shows the problem. Define mutable state once in a source file.
Fixed-address allocation also depends on the kernel version. Older Android
kernels can ignore MAP_FIXED_NOREPLACE and return a different mapping.
Validate the returned address and test reuse of protected stack pages. An ARM64
probe on the Odin's 4 KB pages reproduced this by stripping the flag: the old
allocator failed, the fix passed. See the investigation.
Host types also vary between standard libraries on the same architecture. NT's 1601 epoch fits in 64-bit 100 ns ticks but overflows Linux's nanosecond system_clock. Changing the epoch in 100 ns units and retaining that duration through calendar composition fixed four SDK chrono cases that passed on Windows. Test dates outside the host clock's range as well as current dates; the clock conversion audit covers file times, kernel queries and both calendar directions.
Audit platform floors separately#
An Android OS version, a CPU instruction target and a Vulkan driver version are separate contracts. Trace each declaration through history to its callers and fallback paths before promising broader support. Here the ARMv8.2 flag was chosen for inline atomics, descriptor indexing already had a fallback, and dynamic rendering was the native executor's relevant Vulkan requirement. A lower-target compiler probe or a version cap on a modern GPU establishes less than a route on the hardware being admitted. Public OS and GPU shares also lack the joint CPU, memory and feature data needed to count compatible phones. See the Android minimum-requirements audit.
Test Android on the system's own driver too#
An app that loads Mesa Turnip on Snapdragon devices still has players on the vendor's Adreno driver, and Mali and PowerVR devices only have the vendor's. The vendor drivers are less forgiving of invalid Vulkan use. In 0.9.0 the presenter began a swapchain render pass whose attachment clears, but without a clear value, because a second pass built from the same description had already changed its load op before the flag was read. Turnip and the desktop drivers players use ran it without complaint; the Adreno and Mali drivers crashed on it at launch (#1101, #1107), and the Android device we tested 0.9.0 on ran Turnip. Run a launch on the system driver (android_gpu_driver = "") and read derived fields from a Vulkan create-info before reusing it for another object.
Keep host file names in UTF-8#
On Windows, std::filesystem::path::string() converts through the ANSI code page and throws when a character has no mapping there. A player's song with a Cyrillic file name crashed the game as soon as the music status line read its title (#552), and the same call sat on mod, LUT and save-backup names. Convert paths to UTF-8 with u16string() (rex::path_to_utf8), build them from UTF-8 with rex::to_path, and test with a file name the test machine's code page can't hold.
Let the last option win#
Launchers and test runners pass defaults first and the player's or test's values after them, so a repeated option must take its last value. By default, the SDK's command-line parser (CLI11) rejects an option given twice, and after that parse error it applies none of the arguments, including the game, update and user folders. Lavender Shift found this on Android, where an intent argument repeated one of the activity's own (it crashed at the title), and worked around it by removing duplicates in the activity. The SDK now registers every setting with CLI11's take-last policy, so every game and platform gets the fix, and a unit test passes the same option twice. Save sync relies on it: Android passes its default sync folder first, and a later argument overrides it.
Fix frame rate with the game's own clock#
Running above 30 fps needed no engine changes beyond faster vblanks: the game already integrates a real time delta. What remained were systems that add a constant per update. They were found by comparing guest memory snapshots at 30 and 120 fps and trapping writes to the values that drifted. Gate every such change on simulation time against real time, pose drift and the save's hash.
A faster clock exposed one more console assumption: the simulation steps on the vblank and the render thread draws the newest finished step, which pairs one step with one frame only while every frame fits its vblanks. Count steps between the title's own frame submissions to see it. A per-present counter of the loop's tick hid it, because the tick fires before the loop waits. Holding the step until the render thread catches up fixed it, but only when the hold was released at the next swap and steps that kept up stayed on the vblank: holding the main loop until the swap also stopped the skips, and moved every step onto the swap's uneven timing. Raise the step event from host code only after dropping any lock the vblank callback takes: the vblank interrupt runs inside the runtime's global critical region, and looking up a guest event takes that region too, so the first build of the gate deadlocked the two threads after half an hour of play.
Methods that held up#
-
Prove the check before trusting a clean result. A comparison that never fails may not be looking. The region oracle (#749) ran each seeded fault (a dropped store, two stores swapped, a changed volatile register) through the same race that came back clean, and counted a fault it could not apply, such as a swap in a region with one store, as not applicable rather than as caught. Checking its interpreter against the hardware-recorded corpus first found real semantics the hand-written cases missed: CR0 and the carry come from the low 32 bits, and a NaN operand propagates quieted through every FP and vector operation, estimates included (recompiler).
-
Trace the graph around a move. FH1's teleport action finishes before the following streaming wait. Its active flag cannot prove a safe landing; the surrounding graph also owns traffic, control, audio and the camera. Enter through the native map and check driving after the full transition (travel contracts).
- Verify input was consumed. A 100 ms map-button pulse was lost during a Windows travel-route hitch even though its synthetic input receipt was logged. The request expired safely, but counting subsequent captures as landings would have overstated the result. Hold the button for 500 ms, inspect the map capture, and pair each landing with its accepted destination. Arm a movement wait on the script tick after applying throttle: a later baseline can miss a drive that has already stopped near roadside collision. Keep the landing-to-driving pose check too; an input receipt alone proves no motion.
- Trace the loader before calling a buffer a saved replay. FH1's gameplay replay has a main stream, an attached stream and separate initialization; their runtime IDs are replaced on returning to free roam. Its stream time field is a latched start anchor, so sampling it cannot establish a video clock. Validate reconstruction in a new process and one completed presentation per output step before adding a replay list or encoder. The gameplay replay contract records what remains unqualified.
-
Hash the executable, not just its sidecar. The replay probe's existing Windows preview carried an older build manifest whose executable hash did not match. The worktree revision reported by a runner cannot identify a binary supplied through
--build-directory; preserve its actual hash and leave source provenance unqualified when the manifest is stale. -
Pinned saves. Scripted routes from a frozen copy of a save, never the live one, so results don't depend on progress.
- Keep a parked fixture parked. A saved position does not hold the car there: traffic and coasting can move it beyond an event trigger before sign-up. Hold the handbrake during the wait; holding the service brake instead selects reverse. Check the scene as well as process completion (dispatch investigation).
- Let the generator skip, not the build system. A generator run before configuring (to produce the source lists CMake includes) is invisible to Ninja: it has no log entry for that edge and runs it again. Forcing regeneration on that edge made every first build translate the game twice. Fingerprinting the generator's own binary along with its inputs made the generator's skip check safe to keep on, and Ninja's rerun became a 0.3 s no-op.
- Declare generated source lists as outputs. CMake already tracks an included
sources.cmake, but Ninja also needs its producer edge to regenerate it before rerunning CMake. A synthetic Windows/Ninja update that added a folded-data unit reproduced the facade link failure; declaring all three module lists as codegen byproducts made the same build translate, reconfigure and link successfully in both base and v4 layouts. The regression also removes partitions and source lists, retries a failed translation and checks no-op and frozen builds. See Building. - Qualify every use of an exposed asset. FH1's
IsDrivableflag includes traffic cars; a bus drive did not qualify garage selection, thumbnails or paint. Even named LOD0 and cockpit archive members can be much smaller than player models. Use an explicit sales list and test purchase, garage changes, paint, driving and saved reload separately. Check the saved garage and model IDs too: a clean route exit can select a different owned car. Provide a backed-up selection recovery before exposing a model that becomes persistent save state. See the hidden-car audit. - GPU validity and CPU visibility are different. Keeping a resolve valid in the GPU mirror fixed one Mac exposure bug, but a later free-roam trace still found a CPU read of the 4 KiB luminance resolve. Keep the 4 KiB tracking and read the completed guest-size float copy back; an earlier route with no CPU reads did not prove there were none elsewhere (qualification).
- Arm a frame dump after reaching the scene. The script clock and executor swap counter differ, so an absolute startup frame can capture the frontend. A one-shot request for the next complete frame after a mode-17 capture provides the same input for cross-device replay. Guest and presented readbacks still cannot certify the OS window: screen-capture denial left the Mac fullscreen gate open.
- Count completed frames around an image A/B. One 3840x2160 capture on the RTX 4080 took 411 ms end to end. The time-based route then ran its next toggle, diagnostic arm and reset in one burst; a logged flag change did not establish which state produced a queued image. Space the toggle and capture by completed output frames, keep an off/off reference, and log the actual executor frame. Passing traffic can invalidate even a parked reference (depth-alias experiment).
- RSS is not total Metal memory. One M4 Pro 2x/4x-MSAA drive had a 4.6G
vmmapphysical footprint while RSS was much smaller. Report heap usage, surface allocations and physical footprint with their definitions; do not add overlapping counters. Swapped regions and substantial system-wide compression also limit a performance claim made from GPU utilization alone. - Interleaved pairs. The same build drifts about 4 % between batches. Compare A and B inside one batch, and on hot handhelds inside one run.
- Frame replay. A dumped frame gives devices the same packet input and supports exact comparisons against a saved replay golden. A previous 1,210-repeat measurement held its median within 0.02 ms; that is not a timing guarantee. In the desktop inspector qualification, control runs of the same dump varied from 9.974 to 11.435 ms per frame, and the replay differed from the live recording even with the inspection hooks removed. Check both control stability and image equivalence before accepting a result. See the inspector qualification.
- Inspect values with explicit lifetimes. The desktop inspector publishes immutable CPU pixels after GPU completion, then lets the UI own its uploads. It never lends an executor image to a later UI frame; closing cancels publication by generation. A suspended guest also needs independent UI repaints, including the last paint that erases the overlay, but only while it is suspended: allowing them over a running guest's frame presented every frame twice with F3 open, and the uneven pacing felt like lag. Queue input transitions between those repaints: direct mouse and modifier state writes lost fast press/release pairs during capture. The mailbox and input regression tests run without game data or a GPU.
- Knock-outs over timestamps. Per-phase GPU timestamps distorted the phases they measured.
- Validation layers in routes. The AMD device loss in 0.4.0 was a threading bug the validation layer reported directly.
- Size a bindless set by the per-set limit, not only the per-binding ones. On a Mali-G720 (Dimensity 9300+) the bindless set took 73,728 image views plus 500,000 samplers, each within its own update-after-bind limit, but 573,728 in all against a
maxPerSetDescriptorsof 500,000. The driver created the layout anyway and crashed recording a draw about 20 s into the race. With the validation layer loaded it did not crash, and the layer reported the oversized layout. On Android an app can load the layer from its own APK's library folder (no debuggable build or device setting). See ShiftGlue'sVulkanTextureCache::InitializeBindless. - An invalid command one driver ignores can crash another. ShiftGlue ended an occlusion query twice when the title began a new one while another was open: the cleanup ended it, then ending the submission ended it again. Adreno, AMD and NVIDIA ignored the second end; Mali's driver dereferenced null in
vkCmdEndQueryin about half the races. Small crash-rate samples misled for a while (3 of 4 against 0 of 4 looked like a cause twice and was timing). What found it was the fault itself: on Android the process's signal handler now logs the fault address and registers to logcat (rex-fault), and a temporary breadcrumb of what the submission worker last replayed (the command, and queries begun and ended in that command buffer) showed one begin and two ends. - Compare GPU time at equal draw counts when a route is not deterministic. On the Mali tablet the race's median draw count ranged from 1,470 to 2,400 between runs of one build, and GPU time follows it. A probe that looked 2 ms faster had only taken a different line; comparing the submission-busy median over frames in the same draw-count band separated real gains (coarse shading, 2-2.5 ms in every band) from route changes.
- Normalize the render thread by what it drew. Six alternating runs of the race route on the Odin varied from 953 to 1,503 draw calls a frame (traffic and weather), and the render and decoder threads' instructions followed the scene, not the build. The simulation thread does not depend on the scene and separated two builds at 5.6 % with three runs each; the render thread needs instructions per draw call, a replayed frame, or many more runs.
- Instructions, not CPU time, across builds. CPU time per guest thread is bimodal between runs of the same build. Retired instructions a second per thread, sampled at a fixed frame-rate limit, separate builds within four runs each.
- Inclusive profiles from frame pointers.
simpleperf record --call-graph fpgives caller totals on Android without a profiling build; about 1 % of chains break. Rank callers this way before porting a leaf. - Train and measure PGO on different routes, so the profile can't fit the measured run.
- HDR on Android: check the layer, not the screenshot. On the Android 13 Odin 2 Portal, Vulkan lists no HDR10 color space even though the panel reports HDR10; a 10-bit swapchain with
ANativeWindow_setBuffersDataSpace(ADATASPACE_BT2020_PQ)gets one.dumpsys SurfaceFlingershows the layer's data space and whether the display entered its HDR mode;screencaptone-maps the layer to SDR and makes correct HDR look dark. Read the composer's own table at the end of that dump too: on a panel mounted portrait, a landscape layer goes through an 8-bit rotator and is tone-mapped to SDR before it, so HDR10 only reaches the panel from a swapchain pre-rotated with the surface'scurrentTransform. Advertised luminance and HDR10 metadata do not prove that another compositor preserves the PQ signal. A clipping pattern which never merges is not a panel-peak measurement: keep the driver, brightness and display mode with meter readings, and retain the existing peak until that path is qualified. Test charts against both split views and whole-frame UI masks: neither may replace the calibration signal. An Odin 2 Portal baseline reproduces a hidden chart with both Vulkan drivers at fixed brightness and refresh (Android reference). - Check what the pinned host tools link. LLVM's Linux release builds
ld.lldagainstlibxml2.so.2. libxml2 2.14 renamed itlibxml2.so.16, so on SteamOS and Arch the linker couldn't start, and every compiler check failed with "unable to execute command". The tools that need it now run through wrappers that load only that library and its ICU from the sysroot. Try a new pin in a current Arch container before release. - Fix the order of anything you hash. The DLC payload digest hashed a sorted file list, and Python sorts paths without case on Windows but with case on macOS and Linux. Rally verified on Windows and failed everywhere else with the same files. The digest now sorts the Windows way on every platform, which keeps the published digests valid.
- Check that a developer option has a reader before using it. Retail builds often keep the developer option parser and drop the code that used an option. FH1 parses
eventrestrictionsandchooseillegalcarforevent, but none of the 356 callers of the option object's getter reads them. A scan for loads from the getter's result, checked against options known to work, settled this without a run. The trainer patches the game's restriction parser instead. - Take another project's instruction tests, then audit them. xenia-canary's PPC tests multiplied the suite by 1.7 and found gaps on the first run, but a third of the first failures were the harness, not the recompiler: a test that writes FPSCR left the host rounding toward zero for every later test (reset the FP environment per test), and a label repeated in two files bound a case to the wrong function. Of what remained, more cases had expected values that contradict their own inputs (a load of
0xABexpecting0) than real differences. Keep those in a skip list with the reason on each line, so the suite stays green and the record stays honest. Then count the cases each file actually produces: a parser that stopped at a comment line silently dropped 244 cases here, and the dropped files hid a real bug (vpkuhusandvpkuwuspacking a register into itself). - Make the test car fail the limit you test. The first event the route reached was one the save's car already qualified for, so the stock and the cheated runs looked the same. A database mod that limited that event to 1980s cars made the stock game refuse the car, which is what the cheat then had to change. A second mod that limited the class showed that the class is applied by a different function, which needed a hook of its own.
- Trace the mechanism, not only the outcome. To show that FH1's rubber-banding was off, the first idea was gap over time with the player waiting on the grid. Over 100 s it was noisy: some AI drivers stalled in both runs, and the stock AI reached 1 km about as fast as the fair AI. Logging each AI controller's own state twice a second settled it. In stock, every AI that got ahead spent most of the race in a rubber-band mode with its torque cut to 0.6. With NO RUBBER-BANDING, no AI did. The game's state machine says what the AI does; the outcome also depends on traffic and crashes.
- Let the device say what it did. A DualSense reports the active effect of each trigger in its input report (byte 48 over USB), and Windows lets a second process open the pad while the game holds it. A small reader logging that byte beside the game's own log showed which effect each trigger held, when, and whether the release on quit, focus loss and crash arrived, without anyone holding the pad.
- Inject a known cost where nothing spins. An A/A harness must show it can see a cost of the size it is meant to judge. 0.3 ms of CPU spun once a frame on the GPU commands thread did not show at all: that thread busy-yields while idle, so the spin only replaced spinning. On a thread of its own the same cost appeared, and showed that one Odin race resolves about ±0.9 ms of process CPU (two standard errors over 14 in-run pairs), so a 0.3 ms item needs about eight runs pooled or a per-thread metric.
- Don't build an error bar from overlapping pairs. The in-run summary paired every window with both of its neighbours (B1−A0, B1−A2, B3−A2, ...) and divided the spread of those differences by the square root of their count. Neighbouring pairs share a window, so they are correlated and the error bar came out too small: in a simulation with 15 windows the estimate actually varied 1.45 times as much as reported. Disjoint blocks of three windows (A B A or B A B, the middle one against the mean of its neighbours) still cancel a linear thermal drift and share nothing, and with only five blocks a run needs Student's t (2.78, not 1.96) for a 95 % interval. Recomputed over the 143 archived in-run captures, 72 rather than 109 of 675 single-run, single-metric differences clear their interval. Decisions taken on pooled runs, counters or large per-thread effects held. A result read off one run near two standard errors did not. (#747)
- Hunt hitches in routes without captures. Each route capture reads the frame back from the GPU, a 50–120 ms frame that looks like a stutter. A capture-free copy of the route, with only the final capture the runner needs, left the hitches the player sees; a periodic one then showed its period (30 s), which led to the cache save that caused it.
- Build a Windows-only shader step once and pin its output. The FidelityFX SDK compiles its Vulkan shader permutations only with a Windows executable. Generating them once, checking them in as an archive with its hash, and patching the SDK's CMake to use them made the library buildable for Linux, Android and macOS without porting the compiler.
- Pass the toolchain across each CMake project boundary.
ExternalProjectinherits the generator, but compiler paths alone omit the sysroot, compiler target, GCC runtime and linker flags. FidelityFX's C probe then used the host linker and failed on SteamOS, which has no system GCC. Forward the toolchain file, flags and custom inputs fromCMAKE_TRY_COMPILE_PLATFORM_VARIABLES; verify both a clean build and a retry of the failed directory on that system. See Linux troubleshooting. - Keep the build tree when a managed source pin changes. Deleting the SDK checkout also discarded unchanged dependency objects. In a real Git/CMake fixture on Windows and native SteamOS, fetching the exact new pin in place reduced an update from two compiled units to one; changed compiler flags still rebuilt the dependency, and missing source files were repaired. This only reuses objects within the same source directory. Method and limits.
- Code proven on one compiler and one memory model needs testing on the others. The FidelityFX Vulkan backend works on Windows yet failed in two ways off it: a struct declared
alignas(32)but placed at 4-byte offsets, harmless under MSVC, crashed under clang's aligned stores; and a memory-type search that skipped host-visible types for device-local requests found nothing on unified-memory GPUs. A core dump's faulting instruction and a log at each failure point found both. - Describe an image as what it is. Passing a colour-format depth copy as a depth target made FFX create a depth view of a colour image. Windows drivers allowed it; MoltenVK asserted.
- On Android, write diagnostics to a file when the log is silent. Logging from a native library loaded with
dlopennever reached logcat on the Odin; appending to a file in the app's external files directory and pulling it with adb did. - A shader variant is a new pipeline, even with a warm cache. Turning on a pixel-shader variant for every scene draw (the object-slot output for upscaler motion) meant pipelines the player's cache had never built, and the desktop policy of waiting up to 250 ms for a pipeline still compiling turned each into a stall. When a variant only adds an effect, draw with the base pipeline until the variant is ready.
- Pin the hash of what the download returns, not of your checkout. The DLSS headers were pinned from a Windows clone with
core.autocrlf, so every pinned header hash was of CRLF text while the raw download is LF. The build only ever used the local clone and the download path never matched, until a clean configure tried it. Hash raw downloads, or normalise line endings before hashing text, and test the fetch from an empty build folder. - Probe a vendor runtime before integrating it. A small program that creates a Vulkan device and asks each upscaler runtime for support, with no dispatch, settled the Vulkan questions the vendors' feature tables left open. The DLSS SDK's own NGX library (not Streamline) runs DLSS frame generation on Vulkan and on Linux. The FidelityFX 1.1.4 Vulkan DLL crashes on a null function pointer while creating its context unless
VK_KHR_get_memory_requirements2is enabled, even on Vulkan 1.3. To find which function was missing, wrapvkGetDeviceProcAddrand log the names that come back null. - Keep the HUD and overlays out of frame generation, and look at the raw output. FSR 3 and DLSS frame generation move every pixel along the game's motion vectors, and a HUD drawn over the scene has the scene's vectors, so the speedometer, minimap and a debug panel turned into ghosts; optical-flow-only LSFG hid it. Mark the HUD's coverage in the frame's alpha, hand the provider the frame before the overlays, and put the real frame's HUD back over each generated one. A capture mode that writes a 2x2 grid (previous real, presented generated, current real, raw output) made this visible. Compare the raw output with the HUD-less frame, though, not the presented one: things that show only in the raw output can just be the scene under the panel.
- Test a frame generator on a synthetic scene before the game. A program that feeds a white square moving 40 px a frame through the provider on a real GPU, reads the generated frame back and checks the square's centroid lands halfway, verified the LSFG port (within 0.3 px, under the validation layer) before the game could show it. In the game, a provider that skips frames should not take every reset at face value: the presenter marks the frame after any skipped one as a reset, so warm-up frames that skip on a reset never end.
- Get the camera from the draws, and look at what you feed. A game without motion vectors still gives you its camera: group the depth-tested draws by their world-view-projection constants, take the largest group as the static world, and the previous matrix times the inverse of the current one is the camera's motion, with no hook in the camera code. Then view the depth and motion you build as images before judging the upscaler. In FH1 the depth view showed that the snapshot held only the last predicated tile, that the scene is drawn turned 180 degrees and that its depth is reversed; the upscaler output alone only showed streaks (Renderer).
- Per-object motion without a new attachment. Each object's previous-times-inverse-current matrix is known at draw time, so a pixel only needs to know which object it shows: let depth-writing scene draws atomically max
(depth << 8) | slotinto one integer image, which keeps the nearest fragment in any draw order, and have the motion pass trust the slot only where its depth equals the depth buffer. Select draws by "writes the scene depth", not by colour target or blend state: FH1's cars draw to their own colour target with alpha blending, read their matrix from other constants, and had been missing the jitter for the same reason (Renderer). -
Sample the stacks of the slow frame, not the average one. A sampler that starts when a title frame passes a threshold and walks the title thread's stack (and any named host threads) every millisecond named each hitch here: a database view, a pipeline wait, a route capture. Name guest frames with the generator's function map; the host frames between them show which wait the guest is in.
-
Name every cache layer in a warm comparison. Our route runner copied shader microcode and base pipeline descriptions but omitted specialized descriptions and the persisted Vulkan driver cache. Copy all three storage types from the completed route into a new private run, keeping the original seed's user and configuration so saved progress does not change the route. Leaving out application storage while retaining the driver's own disk cache measures a first visit without application storage, not a cold driver. See the hitch qualification method.
-
Check the pose before comparing frame times. On the Windows RTX 4080, identical scripted inputs reached different road positions, and traffic moved a supposedly parked control. Those runs could establish stability but could not isolate a timing change. Hold the handbrake, warm the actual stationary scene and reject moved poses. The brake pedal selects reverse after stopping. The qualification method also requires the race HUD to establish elapsed racing time.
-
Check which backend writes a counter. The performance CSV has pipeline hit/miss columns, but Vulkan never increments them. A zero cannot establish that no pipelines compiled. Its pending-bind and replay-wait logs are active diagnostics for the parallel pipeline path.
- Reproduce with the player's settings. The route seed's GPU settings differed from the player's, so the route built pipelines the player never needed and missed the ones they did. Copying the player's settings onto the route made its stalls match the session's.
- Stabilize route entry during startup waits. A long prelude let the car roll past the event trigger; brake then drove it backwards. Holding the handbrake kept the pinned entrance. Put boot-file anchors before their lookback expires, and verify the race HUD before accepting timings. The failed and qualified routes show why a pinned save alone does not qualify a run.
- Preserve draw order and pass boundaries in a census. The Deck race uses 273 selected pipeline identities, but adjacent runs average only 2.52 draws (median 1, p95 6). Count changes within each rendering and close runs at pass/frame boundaries before considering batching. This measures adjacency; dependencies and savings still need their own proof. The ordered stream makes that distinction measurable.
- Waiting for a pipeline at each draw serializes the workers. A draw asks for its pipeline only when the recorder reaches it, so waiting at each draw builds a frame's new pipelines one after another. Record the draw with a pending bind and wait when the command buffer is replayed: the frame waits for the slowest pipeline instead of the sum.
- An old embedded SQLite plans like an old SQLite. FH1 links SQLite 3.6.19, which has no automatic indexes and runs a subquery on the right of a LEFT JOIN once per outer row. One view took 158-186 ms per read. Indexes plus the same view written with plain joins, checked to return identical rows, cut it to a third. Check the version before assuming a modern planner.
- Profiling code can be the hitch. The first SQL profile checked every byte of each statement's text with
VirtualQuery, which made the queries it timed look slower. Check readability once per page. - A host page query is not free. Checking a guest pointer against the host mapping (
VirtualQueryon Windows) cost about 100 µs a call on the Ryzen 7 5800X. The tracked achievement's collectible count made about 450 such checks every two seconds, a 17-40 ms title-thread spike, and a cheat helper made eight every frame. Caching readable pages for the length of one pass removed the spike, and asking the per-frame question only until it was answered cut the title thread's median from 4.3 to 3.1 ms a frame (one tracked-achievement free-roam run each). Time the safety checks, not just the work they guard. - Never quote one GPU's saving for another. The same switch saved 8 % on one GPU and nothing on the next.
- Hide the window to find a present stall. On a laptop where one GPU renders and another drives the display, a GeForce 930MX stalled for about 600 ms every seven frames while its GPU sat idle. Frame counters, draw counts and cache misses looked normal. Running the same route with the window hidden removed the stalls, so presenting was the cause; timing each Vulkan call in the presenter and the recorder found none that blocked, which put the wait below the API. Sampling
nvidia-smi(clock, state, utilization) during the run showed the GPU idle in the stalls, ruling out throttling. Check the window before the renderer, and a second GPU before either (old laptop). - A generated file must build on every layer it hides. The base-disc Rally adapter serves its own
gamedb.sltwith the Rally rows, and the database patch that mods produce was built from the disc's copy and loaded ahead of it. Any database mod, even a script that changed nothing, then hid Rally, and starting a championship exhausted guest memory (#1024). A no-op mod reproduced it, which pointed at the layering rather than the cars the mod unlocked. Prepare the lower layer first and build the generated file on it. - Group draws by the game's identity, not the command buffer's address. The Deck race's draws repeat from frame to frame (89-90 % of them, by pipeline, textures, vertex fetch and index base), but a third of them come through indirect buffers that are new each frame. A test for "the buffers one side of an A/B never runs" therefore picks up every per-frame buffer: check it with the mirror count (the other side's buffers never seen on the first), which should be near zero (FULL_FRAME_RENDERER.md).
- Check that a replacement ran. With direct calls bound to the generated bodies (
direct_calls_bypass_thunk), a native replacement only takes effect if its address is also inhost_overridden_functions. The model-asset skip probe was not, so its only caller kept calling the original, and every measurement of that switch without the scene-walk bit for a day read only the procedural models: the static world looked worth nothing, and with the fix it is 19 % of the Deck's uncapped frame. Every replacement logs aguest_native.summaryevent at the end of a run; a probe with no summary line never ran.tools/port-fh1-v4-analysis.pyreports a replacement missing from the list, so run it after adding one. - Repair Ghidra's flow where a recompiler splits the save helpers. ShiftGlue splits each
__savegprlr_Nand__savefpr_Nhelper into one function a register, each falling through into the next. Ghidra's non-returning analysis then marks the helpers as never returning and turns each prologue's call into a tail call, so on FH1 about a quarter of the functions (about 18,000 of 76,890) ended after their prologue and had no callers. Clearing those call overrides, disassembling past them and extending each body past the VMX128 words Ghidra can't decode, up to the next known start, restored the call graph (tools/re/ghidra/RepairHelperFlow.java, game methods). Check a function you know before trusting an empty xref list. - Convert verified bytecode instead of recompiling it. The Direct3D 11 backend needs shader model 5.0 versions of built-in shaders whose shader model 5.1 headers were verified on Direct3D 12, and current upstream sources no longer reproduce some of them. Shader model 5.1 differs from 5.0 only in how it addresses resources (a range ID, the register and a space), so a converter that keeps the register and drops the rest gives the same instructions with 5.0 operands. It converts all 182 headers, and the converted shaders were accepted by an RTX 4080 at feature level 11_0. Recompiling would have meant re-verifying every texture load.
- Keep the host viewport inside the render target on Intel's Direct3D 11 driver. Xenia-style backends draw unclipped geometry (screen-space clears and copies) through a viewport much larger than the target, 8192 pixels here, and rescale in the vertex shader. The UHD 620 drew such draws scaled down by the target-to-viewport size ratio, so a full-screen depth clear covered a corner of the surface. The clue was arithmetic: the correct pixels numbered exactly the full count times (640 x 1024) / (8192 x 8192). It was found by reading the depth surface back after every draw until the first one that left a different value on Intel than on NVIDIA; the texture loads, shaders, constants and vertex data had all matched byte for byte. Bounding the viewport by the bound targets fixed it; on the RTX 4080 two frame replays stayed bit-exact and the third changed in 3 words.
- Bisect a cross-API difference by resolve before suspecting shaders. When the Direct3D 11 Autoshow frame differed from Vulkan, per-resolve dumps (
fh1_resolve_dump_dir) showed the first 54 resolves bit-exact and the first difference in the low bits of the main scene's depth. Vulkan can flip reverse Z in the viewport, but Direct3D requires MinDepth <= MaxDepth and flips it in the vertex shader, so depth rounds differently. It's a precision difference to document, not a bug.
Follow title-update data independently#
A title update can replace a disc archive member with a different layout.
FH1's v4 update:/media.zip has more chase-camera layers than the disc's
game:/media/camera.zip; reusing a disc merge's layer count would truncate
the result. Extract and compare both owned inputs, generate a patch for
each layout, and mount the update patch separately. The verified update
can remain unchanged. See title-update member merges.
Live camera placement also has two sources: the loaded settings block and per-car offsets cached in the camera instance. Trace the readers and reset writers before treating a settings edit as a live control. Preserve the loaded baseline so resetting retains another mod's tuning. See Collision and cameras.
Prebuild everything that isn't the game#
Only the translation, its compile, the link and the driver's shaders need the player's disc. Everything else can ship built, and on a fresh install it was most of the time (TP-1 to TP-7 in TIME_TO_PLAY_BACKLOG.md):
- Ship the SDK as an installed CMake package (generator, runtime,
renderer, headers,
kit.jsonnaming its compiler and revision) and keep the source tree as the developer path. Under a cross toolchain (a sysroot, the NDK), find the package withNO_CMAKE_FIND_ROOT_PATHandCMAKE_FIND_ROOT_PATH_MODE_PACKAGE BOTH, or CMake re-roots the search, and the package's own dependencies, inside the sysroot.BOTHstill searches the sysroot first, so also set<Package>_DIRfor every package the kit ships: the Steam Runtime sysroot has its own SDL3, whose static library is not position-independent, and 0.8.0 and 0.8.1 Linux builds linked it and failed with "recompile with -fPIC" (#1001). - Trim the compiler. The build called 13 of LLVM's tools; one clang binary with its other names as links took Windows LLVM from 4.0 GB to 264 MB.
- Keep vendor binaries out of the package. Fetch them at the game's configure with the same pinned, hashed modules a source build runs. A static vendor library linked into a prebuilt runtime is a binary release of it, and needs its own licence check.
- Fewer, larger generated files compile faster. Every unit includes the same large header: 4 MiB units instead of 1 MiB cut the compile from 172 s to 146 s on 4 jobs and from 80 s to 74 s on 16, and the largest unit still compiles in under 400 MB.
- APK signing needs no JDK. Zip alignment and APK Signature Scheme v2
are a few hundred lines of Python (RSA PKCS#1 v1.5, SHA-256 chunk
digests); reading the old
keytoolkeystore (PKCS#12, PBES2 with AES-CBC) keeps the same key, so new builds install over old ones. - A Windows build needs only Microsoft's libraries, not Visual Studio.
With the SDK prebuilt,
xwinfetched the CRT, STL and Windows SDK in 68 s (773 MB, after the player accepts Microsoft's licence), and clang andlld-linkbuilt the game with nothing else from Visual Studio. Three things broke on the way: keepxwin's cache on the output's drive (it renames files across), use--use-winsysroot-style(the default layout needs a symlink Windows refuses without Developer Mode, even with--disable-symlinks), and keep the debug CRT (CMake's compiler check links Debug).llvm-mtsilently ignores-inputresource, so embed manifests at link time with/MANIFESTINPUTinstead. - Ship prebuilt host code as objects, not a static library. Our
guest_nativecode replaces weak generated functions with strong ones. Objects in the link all take part, so the override holds; a static archive member is pulled in only for undefined symbols and would lose to the generated definitions already present. Of 69 host files, 6 include generated headers or depend on the CPU baseline and still compile on the player's machine. A fingerprint of the compiler, C++ library version, kit, sources and flags gates the prebuilt objects, so any difference falls back to compiling them. - Reproducible archives hide updates from the build. Our archives store every file with one fixed 1980 date, so an updated kit's headers looked older than the player's last build, Ninja rebuilt nothing, and clang refused the old precompiled header ("modified since the precompiled header") on the first build after 0.9.0 (#1096-#1098). A new MSVC from a Build Tools update did the same. Date unpacked files to the install time once per kit revision, and keep a key of the kit revision, compiler and MSVC version beside the build: when it changes, delete the precompiled headers so Ninja makes them, and the objects that use them, again.
- The translation needs only the executables. Copying the three
.xexfiles off the disc (25 MB, under a second) lets the build start while the rest of the disc extracts in the background. Swap the full copy in only after it is checked, and treat a leftover staging folder as an unfinished game, or a failed run leaves an executables-only folder that passes an executables-only check. - Ship pipelines as hashes and recipes, not shaders. The pipelines a drive needs are known from earlier play, but their shaders are game data. Most shaders a title draws with that are not on its disc are a disc program of the same size with a few exports turned off or moved, as linking a vertex shader to its pixel shader does. A catalog of pipeline states by shader hash, with each shader's disc program (by SHA-256) and those edits, rebuilt 98 % of 1,594 stored shaders from the player's disc at setup. Where the renderer specializes pipelines for state a list cannot know ahead (texture signs here), draw with the unspecialized pipeline until the variant is built, so the list needs only that one (AOT-1 to AOT-5 in AOT_PIPELINE_BACKLOG.md).
What didn't pay off here#
Negative results, so they aren't retried without a new reason:
| Idea | Result |
|---|---|
Relaxed guest memory accesses in the generated code (Cobalt Shift's CB-1: REX_RELAXED_GUEST_ACCESS and compiler-only barriers for the PPC barriers, 2026-11-18) |
It paid off on Cobalt Shift, whose title thread is most of the frame. On multivac at the 120 limit, A/B/B/A over the race route's heavy frames: median 10.00 and 9.99 ms against 10.90 and 9.98 ms, title-thread CPU 3.32 and 3.20 ms against 3.10 and 3.04 ms. The title thread is about a third of the frame here; the GPU decoder and recorder take about 10 ms each, so the saving does not reach the frame. Not adopted |
| Letting background streaming run during foreground loads (CE-10 of CONSOLE_ERA_RESEARCH.md, 2026-11-16) | The game brackets 102 foreground reads a session with a lock that pauses its streaming workers, a guard against DVD seeks; it was held 299 ms in a boot, free roam and race-entry route on multivac. Skipping the bracket broke loading instead: the car-select thumbnails never arrived. Kept as the game does it |
| Completing XAM requests and dialogs without their fixed sleeps (CE-1, 2026-11-16) | The runtime sleeps 25 ms per deferred completion and 100 ms after a dialog closes, imitating the console. A boot and race-entry route hit two completions and one dialog close, 150 ms in all, and setting both to 0 moved Press Start and both loads by less than run-to-run noise (+0.09 s). The delays stay, now as the cvars xam_deferred_completion_ms and xam_ui_close_delay_ms |
| A native inflate for archive loading (CE-15, NR-8) | Timed in the guest decompressor: 98 calls and 27 ms in a whole boot, free roam and race-entry route on multivac, against 776 ms in the LZX decoder that is already native. Not worth a bit-exact port |
| Faster occlusion-query ends during loads (CE-2) | On Windows with Vulkan the guest ended no host occlusion queries in a load route: host queries turn themselves off and the game reads emulated counts, so there is no queue drain to remove |
| Larger streaming arenas (CE-11) | streamsize at 1.5x (204 MiB), alone and with a 96 MiB d3dfixedsize, through the launch-options object: the game booted and raced, but both loads, the slow transition frames and the texture reloads stayed within run-to-run spread on multivac. The game is not short of these arenas on PC |
| Merging scatter reads (CE-4) and the ZIP CRC switch (CE-12) | The game issued no NtReadFileScatter call in a load route, and checkzipcrc already defaults to off. Nothing to change |
| Mailbox presents with frame generation (UP-4.5 of UPSCALING_BACKLOG.md, 2026-11-16) | On the Steam Deck, gamescope's default mailbox mode let the generated and real frames race: 54, 8 and 11 real frames over 40 ms in three phases against 9, 8 and 1 with FIFO, and the GPU 99.8 % busy at 1600 MHz against about 55 % at 650-1000 MHz. Frame generation never uses mailbox |
| Comparing CPU savings uncapped (FR-3 ceiling of FULL_FRAME_RENDERER.md, 2026-11-15) | B4's −13.8 ms of process CPU was measured uncapped, where a shorter frame alone saves CPU (the process keeps about three cores busy): skipping resolves, which removes no CPU work, also read −3.3 ms there. At the 60 fps cap the same switch saved 12.5-15.3 ms of process CPU on the Steam Deck in full scenes (about 2,200-2,300 draws skipped), and 8.7 ms in a lighter one (1,180): check the draws skipped before comparing runs. Compare CPU savings capped, or per unit of frame time |
| Copy-free resolves (FR-1 of FULL_FRAME_RENDERER.md, 2026-11-15) | A per-class skip probe found the pool in whole-width colour resolves that also write a current texture. Skipping all of them outright saved 0.83-0.87 ms of frame on the Steam Deck and 0.65 ± 0.88 ms on the Odin 2 Portal, under the 1 ms gate. A plain image copy into the texture for the seven a frame that a swap could take saved 0.27 ± 0.74 ms on the Deck, and it was wrong: the texture holds the guest word's channel order, not the render target's. A swap would also remove that copy, but those resolves are only about 0.5 ms by their profile share. Guest-memory writes were already measured to cost nothing on these GPUs. Not built |
| Occlusion culling from a late depth grid, inside the game's own per-pass culling (FR-3b of FULL_FRAME_RENDERER.md, 2026-11-15) | The scene depth was reduced to 16-pixel tiles at its first resolve and read back a few frames late. Each scene-walk item's projected box was then tested against it in the native pass culling. The grid was right and nothing visible went missing. The main-view pass (9) holds only the terrain, though: the walk draws a mesh whenever any pass keeps it, so cars and trees ride on their shadow passes. Dropping the hidden items from every pass culled only about 48 items a frame, because most items the walk tests are behind or at the camera or off screen. A Steam Deck in-run A/B moved the frame by +0.17 ± 0.44 ms. For scale, dropping all of the terrain saved 0.59 ± 0.47 ms. Query-driven culling (FR-3a) had already cost as much as it saved. Kept default-off (fh1_occlusion_grid, pinyon_shift_occlusion_cull, pinyon_shift_occlusion_whole) |
| An owned renderer for the static world, skipping the game's model-asset and procedural-model submission so no PM4 is built for it (B4 of BEYOND_RECOMP_RESEARCH.md, 2026-11-15) | Its ceiling was measured with pinyon_shift_debug_skip_world (nothing drawn at all), uncapped, in-run A/B on race-long. Skipping the procedural models (600-750 draws a frame) changed no frame or GPU time on the Steam Deck or the Odin 2 Portal. Reopened: the model-asset half of that switch never applied (see "Check that a replacement ran"); with it, the static world alone takes 2.8 ms (19 %) off the Deck's uncapped frame and 13.2 ms of process CPU. Skipping every mesh the scene walk culls (world, cars and props in every pass, about 2,300 of 3,600 draws) made the frame 21 % faster on the Deck (13.6 to 10.8 ms, GPU -3.4 ms, process CPU -13.8 ms) and 27 % on the Odin (11.6 to 8.6 ms). The rest of the frame, the post chain, the cloned and zone lists and the HUD, keeps about three quarters of the GPU time, and a renderer that still draws the world keeps only part of the ceiling; at the 60 fps cap that part is about 7-8.4 ms of Deck process CPU (FULL_FRAME_RENDERER.md). Closed with the full-frame renderer (see "A full-frame renderer that retains the game's scene draws" below) |
AI cars' full physics step on every other simulation tick, with the summed time (pinyon_shift_physics_ai_step_interval, #1071, 2026-11-13) |
Deck LCD race at 60 fps, where physics already steps once a frame: only 2 to 6 of the 7 AI bodies take the full dynamics step at a time (the game has its own physics level of detail), so it skipped 9 % of body steps, about 0.7 full steps a frame, and no thread's CPU moved beyond the A/A spread (simulation thread +0.1 ms). The physics harness still passed (AI mean distance +2.0 % desktop, -1.6 % Deck). Kept default-off |
Native versions of the D3D layer's float-constant and register uploads, sub_824168B0 and sub_82415EA8 (#1071 P2, 2026-11-13) |
A per-call verify matched the original's packets on all 27 million calls of a desktop race, but in place the native loops took 1.12 s against the original's 1.38 s over 12.9 million constant uploads: about 20 ns a call, some 0.03 ms a frame. The NN-0.8 bench's 2.4× was the loop alone; in the game the copies are bound by memory. On the Deck the long in-run A/B read -0.29 ± 0.43 ms on the render thread, within noise (an A/A run of the same route read +0.18 ± 0.34 ms). Removed |
| A tyre-model-only native rewrite (#1071 P1) | In the Odin v4 race the tyre model sub_82D2F348 (v4 sub_82DF1478) is 0.01 % of process cycles, and physics as a whole (5.2 %, about 1.4 ms a frame) has no leaf above 13 % of itself (the record). Only a native whole-car step could reach #1071's 0.5 ms gate. Not started |
A native rewrite of the render thread's scene submission past the culling (#1071 P2: the track's model-asset owner sub_824365B0, the free-roam walk setup sub_82D65608, the shader constant copies) |
The Deck call graph spreads the rest of the render thread over about 550 guest functions, none above 3 %, with D3D's command-buffer code 22 % of it. Under verify in a desktop race, native constant copies took 27 ns a call against the translation's 31 ns, and the native model-asset owner 0.60 µs a call against 0.96 µs for the original including its list run: most of an owner's time is in the guest functions it calls (mesh and part virtuals, D3D setters, the list executor), which a native owner still calls. The translation runs this kind of code only 1.2-1.5 times slower than native (the culling's 2-3.6 times came from its float and branch work), so the whole owner set was estimated at about 0.4 ms on the Deck, under the gate. Removed before a Deck A/B; real gains would need a native renderer below the owners |
Shader constants without repeats, written by native code (#1071 P2, pinyon_shift_native_d3d_constants) |
A census in the GPU decoder (desktop race, per frame) found about 600,000 float-constant words walked, 77 % of them leaving the register as it was: the owners store their 21-vector block (c128-c148, vertex and pixel) for each of about 1,100 objects, and D3D writes every dirty group of four. Marking a group dirty only when one of its vectors changed cut the constant words D3D wrote from 273,600 to 168,100 a frame with the changes the decoder passed on unchanged (74,500 against 73,900), but three in-run A/Bs on the Steam Deck moved the decoder thread by −0.10 to +0.02 ms and the render thread by −0.04 to −0.76 ms, within noise. A native constant upload that writes only the changed vectors, checked by markers the decoder compares, found 0.3-0.5 % of skipped vectors holding other values (c0-c15, p0-p7, c158, p140-p147): display lists and D3D's own operations write constants without D3D's shadow knowing, so the shadow is not the GPU's state and both versions are unsafe without tracking lists. The decoder's time is not in the words it walks. Removed |
The display-list compiler of the D3D-level renderer research (gpu_d3d_list_compile 2) on the Steam Deck, again on the 2026-11-13 build (#1071 P2) |
Two in-run A/Bs in a race (a third never left the menu): process CPU +0.76 ± 2.7 and +1.07 ± 1.7 ms a frame, no saving; DL-3 had measured −0.91 ± 0.37 ms there. Stays off |
Draw calls written natively: the DL-2.1 slice (pinyon_shift_d3d_slice 2) on the Steam Deck with the single-pass scene on (#1071 P2, 2026-11-13) |
The slice replaces D3D's indexed and auto-index draw calls with a description the GPU decoder draws from, so the call writes no state or draw packets. In a Deck race it took about 55 % of the calls (about 215 a frame; recording, shader binds and queries stay with D3D). Its verify mode matched every shader and draw packet; 16-125 of every 182,000 draws had one register that differed. Three in-run A/Bs with its default list compiler: decoder -0.7 to -1.25 ms a frame, but recorder +0.1 to +0.65 and submission up to +0.27, process CPU within noise. Two more with the list compiler off (gpu_d3d_list_compile=0), so only the native calls differ (a third gave no summary): decoder -0.12 and -0.07 ms, render thread -0.08 and -0.14 ms, process +0.37 and +0.50 ms. The decoder's gain was the list compiler's, and it moves to the recorder; the native calls themselves save nothing, so covering the calls the slice leaves to D3D would not reach the gate either. A Deck call graph of the render thread (frame-pointer build, race, 25 s each way) explains it: the two draw calls, with everything they flush, are 3.3 % of the thread with the slice off and 6.8 % with it on (the native describer alone 4.1 %), so the native call costs more than the translated one. D3D's own code is about 17 % of the thread, some 1.4 ms a frame, spread over more than a dozen functions, the largest the constant upload at 3 %. With native code 1.2-1.5 times faster than the translation, as measured on the constant upload, a native rewrite of all of D3D would save about 0.2-0.5 ms, with nothing on the GPU threads. Removing a heap lookup from every guest load in the describer moved the render thread by -0.06 and -0.02 ms in two more Deck A/Bs, and D3D's shader bind, the largest group of calls the slice leaves to D3D, is only 0.4 % of the thread. Taking the shader-bind calls over after D3D's own bind (their register flushes and draw packet described, about 29,000 more calls per 600 frames, some 70 % of all draw calls) verified with matching shaders and draw packets but 0.15 % of draws with a register mismatch, and three Deck A/Bs moved the render thread by +0.03, -0.04 and 0.00 ms with process CPU +0.66 to +0.90 ms. Recorded and query calls were left to D3D: a query call keeps a pointer into its own packets. Stays off (DL-2.1) |
FMOD's room reverb off (pinyon_shift_fmod_reverb=false, #1071, 2026-11-13) |
The reverb is about a fifth of FMOD's mixer thread in the Deck profile, but turning it off through the unit's own pass-through took 0.28-0.31 ms of CPU a frame off the four FMOD threads in an in-run A/B on the Deck, under the 0.5 ms bar. Kept as an off-by-default switch |
| The interface update on every other frame on the Odin 2 Portal (#1071, 2026-11-13) | v4, race at the 60 fps limit, in-run A/B: simulation thread -0.16 ± 1.06 ms, within noise, where the Deck measured 0.46-0.70 ms. Android keeps every frame by default; the setting is there |
The host single-pass scene (fh1_untile_predicated_tiling) on desktop (2026-11-12) |
RTX 4080, 2x with the game's 4x MSAA, race at a 240 limit, two interleaved runs each, compared over the three 400-frame windows where both runs drive the same race: 9.6-10.4 ms a frame against 8.1-9.8 ms tiled, about 1.1 ms slower. Draws fall from 6,300-7,100 to 4,400-5,100 a frame and the recorder gets about 0.5 ms cheaper, and the main scene pass's GPU time drops from 1.6-1.7 to 1.2-1.5 ms. The GPU commands thread's time rises about 1.4 ms and sets the frame. On Windows, presets other than ULTRA LOW 30 keep it off. Android keeps it on because the GPU sets the frame there (3 ms saved on the Odin), and Linux keeps it on, except in PERFORMANCE 120, because it takes 2.5-3 ms of CPU a frame off the Steam Deck (GPU optimizations) |
Culling the per-bit stencil passes of depth transfers on GPUs without VK_EXT_shader_stencil_export (2026-11-12) |
The RTX 4080 (driver 621.14) and the GeForce 930MX lack the extension; the UHD 620 has it. Skipping the bit passes outright (fh1_debug_skip_stencil_transfers, a wrong image, so a ceiling), 2x with 4x MSAA, two interleaved runs each: transfer GPU time 0.89-0.98 ms against 1.27-1.35 ms a race frame, 0.3-0.4 ms saved, and frame time unchanged because the frame is CPU-bound. A compute pass that finds each source's set bits and skips empty bit passes saves less than that ceiling. On the GPU-bound GeForce 930MX (1x, MSAA off, Ultra Low 30, window hidden, two interleaved runs each) the ceiling is 30.6-30.9 ms of GPU time a frame against 30.9-31.4 ms, about 0.3 ms or 1 %, so not worth building there either |
| Waking the GPU commands thread on the recorder's fence writes and publishing smaller record batches when the recorder is idle (2026-11-12) | Same race, 2x with 4x MSAA: the commands thread waits about 1.9 ms a frame across 11 waits, never sleeping, while the recorder is busy 7.5-8.2 ms of an 8.1-8.8 ms frame. Only the recorder's 0.5-0.6 ms of idle time per frame could be recovered, the ceiling for any change on the decoder side. DR-1.1 (event wake) and DR-1.2 (callbacks completed at decode) already measured no frame-time change at 1x; the lever is the recorder's per-draw cost (DR-3) |
| Recording draws on several threads in parallel (2026-11-12) | Sampled on the RTX 4080 race (2x, 4x MSAA, 240 limit, 15 s of the race): the recorder spends 73 % in issuing draws, 17 % updating bindings, 7.5 % requesting textures and 6 % in resolves, but only 1.5-3 % in the driver, because commands go to a deferred buffer first. The cost is deriving each draw's host state from the guest registers, which depends on the draws before it, so splitting it needs that state rebuilt per thread. The GPU commands thread is busy about 6.2 ms of the frame too, so the frame is about the longer of the two threads and moving work off the recorder gains at most about 1.4 ms before the commands thread limits it |
| Decoding and recording the frame in parallel by segment (#1070 item 1, 2026-11-12) | RTX 4080 race, 2x with 4x MSAA, uncapped, two runs each: with every recorded draw skipped (fh1_debug_skip_draws, no GPU work and about 1 ms of recorder time left) the frame is still 6.8-7.3 ms against 8.2-9.2 ms, because the GPU commands decoder alone is busy 6.3-7.2 ms. A parallel recorder therefore cannot reach the 5 ms gate; the decoder has to split too. The frame does split: in a one-frame register log, 41 runs of draws share a target and window, the largest 706 of 4,671 draws (15 %), and 12 runs of 100 or more hold 89.5 %. What stays serial sets the floor: about 26 % of the recorder (target preparation, resolves, texture requests, shared memory, about 2 ms), the register-run work that composes each segment's entry state (about 40 % of decoding, about 2.7 ms) and the 11 fence waits a frame, which become barriers. That leaves 4-5 ms at best before cold caches and stitching, no margin under the gate for the largest change the renderer could take, so it was not built. |
| Speculative indirect-call contracts for the context census (CS-2 reopened, #1070 item 3, 2026-11-12) | Treating each indirect call as calling only the targets a probe build saw (17,360 of 48,101 sites; the rest and every guard miss go to a conservative clone) narrows return demand from all state in 76,800 summaries to 2,095, but the entry-weighted count of removable context accesses rises by only 0.73 % of lines: about 0.9-1.6 % of host instructions in all, against the 15 % gate. Method |
| Hand-written replacements for the most expensive shaders (#1070 item 4, 2026-11-12) | Per-draw GPU timestamps by pixel shader (fh1_native_gpu_profile_draws) on the UHD 620, race, Low-spec 60, 8 windows of 300 frames: the heaviest shader takes 10.5 % of a 104 ms frame (timestamps add their own cost), the top three 21.5 %, the top ten 39 %. The two heaviest are 10- and 8-instruction single-fetch shaders over 280-350 draws, whose time is rasterization and bandwidth that a rewrite keeps; the only arithmetic-heavy one near the top (66 instructions, 9 fetches, two full-screen draws) is 5.6 % even if it cost nothing. On the Odin (#413) the heaviest was 7.8 % and flat-colour replacements bounded the top five at 0.27-0.66 ms. No few shaders dominate. |
| Native replacements of whole game subsystems: physics, particles, crowds (#1070 item 5, 2026-11-12) | Generated specialised translations of the physics family are in (NN-5.1, 0.35 ms a frame on the Odin), and a native region for the physics subtree changed no frame (#756). On desktop the title thread uses 3.0-3.6 ms of CPU a frame beside a decoder-bound 8.5 ms frame, so it is not on the critical path; the Odin holds its 60 fps limit at 1x and is fragment-bound at 4x. Particles and crowds have no measured share to aim at. Not pursued then; the policy that barred hand-written native subsystems was dropped the same day, and the work is open again, measured first. |
| Recorder templates: replaying recorded host commands for repeated command buffers (DR-3.1, DR-3.2, 2026-11-12) | The replay-floor probe (gpu_replay_floor_probe, recording on the commands thread so decoding and recording add up) found about 40 % of drawn draws, about 2,140 of 5,400 a race frame, in command buffers that repeat byte for byte with no state change in between. Skipping them outright, a wrong image, so a ceiling that includes the probe's own hashing, saves 1-3.6 ms of single-thread decode and record time. With the recorder on its own thread the frame gains under about 1 ms, the bound found for the earlier G0 prototype, and a correct version must still check the constants and textures each skipped draw reads |
| Replaying repeated buffers on the Steam Deck with the single-pass scene on (#1071, 2026-11-14) | A census with the replay-floor probe (recording on the commands thread) still found 75 % of drawn draws in buffers that repeat byte for byte and 45 % (about 1,000 of 2,200 a frame) in repeating buffers that hold only state, constants, shader loads and draws. Hashing them costs 1.2 ms a frame. Two in-run A/Bs of mode 2 against mode 1 skipped 740-1,040 drawn draws a frame outright, a wrong image, and saved 0.86 and 1.5 ms of command-thread CPU, after paying 1.4-2.1 ms to apply the captured exit state, which a real replay pays too. A correct version must also replay the host commands and check the constants and textures each draw reads, so it cannot reach the 0.5 ms gate (GPU optimizations) |
A larger shader lookup memo in front of the Vulkan shader map (gpu_shader_lookup_memo_bits 12 against 6, #1071, 2026-11-14) |
The Deck recorder's call graph put 4 % of the thread in shader lookups by hash, most of it in the map lookup after a memo miss. Four in-run A/Bs on the Deck race moved the recorder by -0.02, +0.10, +0.15 and +0.30 ms: no gain. A larger table costs its own cache misses. Removed |
Skipping pages already watched when re-arming write watches (memory_watch_skip_armed, #1071, 2026-11-14) |
Resolves re-arm watches on thousands of pages a frame, 2.6 % of the Deck recorder. Testing the watched bit first, and skipping whole blocks of 64, moved the recorder by -0.002 and +0.27 ms in two Deck A/Bs: no gain. Removed |
A 960x540 frame through the game's own one-tile scene (pinyon_shift_fh1_scene_size, #1069, 2026-11-12) |
The game's Small2xMSAA mode renders the whole frame at one tile's size and left the upscale to the console's video scaler. Pointing the race's scenarios at one 960x540 tile and shrinking the screen texture headers (720p memory kept) gives a clean 960x540 frame that the presenter scales, but, as with NonTiling, without the static world (road, terrain, start gantry), and three tiles at 960x540 draw no world at all. On the UHD 620 (1x, Low-spec 60 with shadows, window hidden, car held on the starting grid, two interleaved runs each, about 2,160 draws in both) the GPU frame is 54.9-56.0 ms at 960x540 against 65.1-69.1 ms at 1280x720 in the same one-tile mode, 16-19 % less; the tiled 720p frame with the static world takes about 85 ms. On the RTX 4080 at 2x it saves about 0.3 ms and the frame doesn't change. That is below the host 50 % render scale's 29.5 % on the same GPU (RS-0, shelved). The three-band path below replaces it. The shadows-off preset also stops working at 540p, because the shadow mask is recognised by its 1280x720 copy. Kept as a base-game experiment; findings |
A 960x540 scene through the game's three tiling bands, scaled (pinyon_shift_fh1_scene_size, #1070, 2026-11-12) |
Kept as a base-game experiment, off by default. Scaling the race scenarios' three bands to 960x540 left the static world out because its command lists set the 720p bands' window offset and scissor themselves; the GPU decoder now rewrites exactly those values to the scaled bands while the scene's surface is bound, and the world draws (finding). On the UHD 620 (1x, Low-spec 60 with shadows, window hidden, car held on the starting grid, two interleaved runs each, about 4,600 draws in both) the GPU frame is 70.5-72.3 ms against 83.4-85.3 ms for tiled 720p, 15.6 % less pooled, which clears the 15 % gate. It is not a default: the exposure and sun glare still differ from 720p (one small luminance pass keeps the 720p size), the hooks are not mapped for v4, and the host 50 % render scale saved 29.5 % on the same GPU (RS-0, shelved). The shadows-off preset now finds the shadow mask at the scene's size. |
| No MSAA plus existing scene-only FXAA as the default replacement (MR-2) | The same frozen race image fails the agreed 40 dB RGB8 PSNR floor on all five targets: 39.10–39.24 dB on Mali, Deck, UHD 620 and M4 Pro, and 39.16 dB on RTX 4080. Extreme FXAA scores 39.13 dB on RTX. Repeated original 4x captures are byte-identical. This rejects these combinations, not a different temporal algorithm. The 2x + FXAA candidate remains unqualified. Method and image comparisons |
| Caching or culling sun-shadow casters on the host (MR-3, 2026-11-03) | Suppressing the whole shadow-atlas pass saves 0.86 ± 0.10 ms on Mali (shadows on), 0.22 on the Deck, 0.30 on the M4 Pro and 0.53 ± 0.53 on UHD 620: under the 1 ms gate everywhere, so a replacement can save less. The guest still issues the caster draws, so host caching would not remove their decoding on the Odin. Gates and decisions |
| Reusing main-scene depth for the camera-depth pass (MR-4, 2026-11-03) | The camera-depth pass feeds the shadow mask, which scene shading reads; main-scene depth exists only afterwards, so reuse needs a reorder or last frame's depth. The pass is already depth-only, and SHADOWS off removes it on low-end machines. Depth before the shadow mask |
| Fusing FH1's post chain into the final composite (MR-5, 2026-11-03) | The composite is already a single draw, and the bloom/luminance reductions stay in any fusion. The one pass above the 1 ms gate is a full-screen scene-colour rewrite (3.29 ± 1.09 ms on UHD 620): it runs whatever the bloom, motion-blur and depth-of-field switches say, and removing it drops the frame to 11.8 dB PSNR. Folding it in means writing a replacement for two title shaders, a separate project, with only the intermediate image's traffic to gain |
| Deferring a resolve's guest memory copy until something reads it (MR-6, 2026-11-03) | Resolves already write their textures; skipping the memory copy outright saves 2.41 ± 0.29 ms of GPU span on UHD 620 (wrong image). The exact version tracked the copy in 1 KB blocks, dropped blocks a later resolve overwrites whole (most of them: FH1 reuses resolve memory at other pitches) and wrote the rest from the texture when read. Identical images, but only 0.12 ± 0.16 ms saved: a quarter of the bytes are read every frame (the reflection cube reloads its 18 face resolves), and the extra passes and barriers cost the rest. Resolving faces straight into the cube is the different change that would remove those (MR-6) |
| Batching or instancing light glows and tyre smoke (MR-8, 2026-11-03) | The families are 7 lamp, 76 headlight and 6 smoke draws a frame. Suppressing each outright stays within noise: lamps and headlights on five GPUs live, smoke 0.21 ± 0.48 ms in a UHD 620 replay. Batching keeps the blended pixels, so fill-bound GPUs gain nothing either. Tyre smoke |
| Using a capped frame span to reject a rendering pass (MR-0) | In the Deck's first live main-scene knock-out, the frame stayed at about 16.69 ms on both sides: source limit 0 meant the 60 Hz display, not uncapped output. At an explicit 120 limit the same target selection saved 1.73 ± 0.12 ms of GPU frame span. Offline replay also serializes decoding and recording, so its small frame-span change cannot establish a small GPU pass budget. Use live controls and report the pacing floor. Method and limits |
| Apple thread QoS instead of fixed priorities on macOS (2026-11-01) | Threads at the user-initiated QoS class, latency-critical ones overridden to user-interactive, no SCHED_FIFO. M4 Pro full screen, two interleaved pairs: 1x held 120 fps either way; 2x 82.5/81.7 fps with QoS against 82.9/83.4 without. At full 6K density 63 fps against 73. Not kept |
| Load and store ops or fewer renderings for QUALITY 60 on the M4 Pro (2026-11-01) | 2x/4x MSAA full screen, fh1_debug_attachment_ops dropping them outright (a wrong image, so a ceiling): GPU 18.87 ms; no attachment loads 17.70; no MSAA stores 18.99; no depth stores 18.61; all three 17.01 ms. The about 180 renderings a frame cost at most about 10 %, of which a correct version keeps only part, as A60-3 found on Adreno; the frame is pixel shading (about 8 ms) and sample traffic inside the passes. Not built |
| Cheaper texture sampling for the Mac's QUALITY 60 (2026-11-01) | M4 Pro, 2x/2x MSAA full screen uncapped, two interleaved runs each: GPU 14.93/15.85 ms; the game's own filtering instead of 8x anisotropy (anisotropic_override=-1) 14.44/14.50, about 3 % for blurrier oblique textures; TEXTURE GAMMA FAST 15.40/14.28, within noise. Defaults unchanged |
| Asynchronous guest fence completion on the Mac (2026-11-01) | M4 Pro, 2x/2x MSAA full screen uncapped, two interleaved runs each: gpu_async_fence_completion 64.1/69.0 fps against 68.1/67.9. Asynchronous submission and presenting on the submission worker are already on. Within noise; default unchanged |
| Less spinning to cut the Mac's 250 % CPU at 1x (2026-11-01) | M4 Pro full screen, two runs each: wait_reg_mem_yield_us=0 halved CPU to 125 % but fell to 52 fps (the GPU thread's sleeps overshoot); gpu_idle_spin_count=0 changed nothing (254/253 % against 261/246 %, 120 fps). The CPU is work, not spinning, and not the limit at 120 Hz |
| MoltenVK switches on the M4 Pro (2026-11-01) | 2x, MSAA off, full screen, two runs each: asynchronous queue submits (MVK_CONFIG_SYNCHRONOUS_QUEUE_SUBMITS=0) 83.0/84.1 fps against 83.8/82.9; Metal heaps (MVK_CONFIG_USE_MTLHEAP=1) 82.0/82.4; fast math always on 78.8/83.0 against 81.6/82.3. Within noise; defaults unchanged |
| Hiding first-time pipeline compiles on the Mac (2026-11-01) | free roam on the M4 Pro: each pipeline seen for the first time takes 100-190 ms to compile in Metal and the frame waits for it. Skipping the draw instead (vulkan_async_pipeline_wait_ms=0, frames still shown) removed the spikes and filled the screen with glitches; letting Metal compile more at once (MVK_CONFIG_SHOULD_MAXIMIZE_CONCURRENT_COMPILATION) changes nothing, as it already uses all 12 cores. Seen pipelines are stored, and Metal's own cache makes them cheap at the next start (371 in 58 ms). Defaults unchanged; building the pipelines ahead of time from a catalog did it instead (Renderer, "Pipelines ahead of time") |
| Fix the GeForce 930MX's Optimus present stalls with present options (2026-10-31) | i5-8250U laptop, 930MX rendering and Intel UHD 620 driving the display, fh1-race-sync at Low-spec 60, 150 s each: frames over 300 ms were 12.8 % at the default, 13.1 % with NVIDIA's Optimus Vulkan layer disabled (DISABLE_LAYER_NV_OPTIMUS_1=1, confirmed absent from the log), 13.4 % with mailbox only and 13.4 % with vulkan_present_wait (supported on this driver); FIFO only was worse (32.5 %, 4.2 fps). Windowed mode, vsync off and 2, 3 or 5 swapchain images were measured earlier (old laptop). None of these removed the stalls |
| Mali-G720 frame-time probes (Galaxy Tab S10 Ultra, 2026-11-01) | Race route, cooled runs compared at equal draw counts; the frame is fragment-bound in the main scene. No gain from: skipping attachment loads and stores at rendering breaks (fh1_debug_attachment_ops=7, 22.0 ms against 21.7-23.0), bindless textures off, textures capped at 512 texels, RelaxedPrecision on every pixel-shader float operation, robust buffer access off, or the GPU command thread pinned to the X4 cores. Letting resolves write AFBC-compressed textures (copy views off) was slower (22.8 ms, three times the frames over 33 ms), and coarse shading of the post-process renderings broke the image (blocks in the sky and HUD). Shading the main scene per 4x4 pixels instead of 2x2 saved another 2.4 ms in the busiest stretch (17.4-19.0 ms against 20.6-21.1, still above 16.7) but stair-stepped road lines and arrows at the tablet's size; 2x4 saved about 1 ms and not in every run. Coarse shading of the scene and a half-size swapchain are what pay. Backlog |
| A custom Vulkan driver on a Mali tablet (2026-11-01) | Galaxy Tab S10 Ultra (Dimensity 9300+): Mesa's PanVK needs the upstream panthor kernel driver and the kernel has Arm's kbase; Arm's driver is an Android HAL module that leaves swapchains to the system loader, so loading another one from the app (as libadrenotools does for Turnip) would mean reimplementing Android's swapchain layer. Samsung's updatable-driver packages on the device are empty placeholders that only Samsung can fill |
| Unconditional sharing of the 1x/4x depth alias | RTX 4080, 1x/3x race and free-roam trials: a full-4x variant removed all five alias copies and gave off/on MAE 1.17–9.82, but its color draw reads interpolator 0; low final-image MAE did not establish equivalent shader inputs at a different pixel rate. Reduced host sample counts also collapse depth/stencil values during the existing copies. Keep the guarded full-sample helper path, which removes three copies and saves 1.092 ms at 3x over 12 in-run blocks. A broader path needs proof of interpolation and sample-collapse equivalence. Evidence |
| Render below 1x (R02 study, then the RS-0 probe, 2026-10-31) | A debug probe (fh1_debug_raster_percent) shrank only the viewport and scissor of draws into the 1280-wide surfaces, without the real path's resolve reconstruction; in-run A/B on fh1-race-sync. At 50 % the GPU frame fell 29.5 % on an Intel UHD 620 (Low-spec 60), 14.5 % on a Steam Deck LCD, 8.5 % on an Odin 2 Portal (GPU-bound) and 0 % on an RTX 4080; at 75 % 18, 10, 5 and 0 %. Shrinking the shadow maps saved nothing. Only one device cleared the 25 % gate, so the full path (3-4 weeks) is shelved; the game also ignores the reported video mode, so it cannot be told to render smaller. Reopen if a low-end Android or integrated GPU saves 25 % with the probe while GPU-bound. Measurements and design |
| Skip alpha-tested shadow casters (R03) | RTX 4080 at 3x, shadows on and MSAA off, pinned race and free-roam drive, both toggle orders and ten disjoint A/B comparisons per route: the effective-alpha filter saved median 0.12/0.08 ms GPU (ranges -0.20 to 0.31 / -0.32 to 0.37 ms), below the 0.5 ms gate. Raw alpha flags also removed the player car's self-shadowing. Odin was unreachable over ADB, so its gate remains unverified; no option is shipped. Census and selector. |
| Defer the sky until after opaque geometry (R04) | A recorded Odin race frame already places the gradient sky after 422/1,757/585 depth-writing draws in its three contiguous band runs. Each sky draw writes stencil and is followed immediately by blended stars: zero draws can be crossed before the first background reader. Rejected on ordering/state evidence; no GPU speedup or image-equivalence claim. Shader identities and method |
| Additional no-op draw tests beyond the existing no-attachment skip (R05) | Ryzen 7 5800X/RTX 4080, three moving-race samples (360 frames each) and three free-roam drive samples (600 each): 121 safe draws/frame, 120 already skipped; exactly 1 additional draw in every sampled frame, a no-color draw with depth NEVER. Other tested causes: 0. Below the roughly 20-draw rarity gate; no new skip retained or Odin speedup claimed. Census and method |
| Hold the service brake to anchor a road-start route (#703/#715) | Native Deck v4's automatic car reversed at 50 km/h in the first capture and left the sign-up area. Hold the handbrake instead. Route and controls |
| Cache the Windows translator manifest merge to avoid codegen invalidation | Two repeated mt.exe merges on a private translator copy preserved its hash and last-write time (0.098/0.051 s on Multivac). It was not invalidating translation, so no cache was added. Build-cost probe. |
Expose every hidden IsDrivable car as a player purchase |
Base-disc audit on multivac: 18 of the 22 exposed entries are traffic vehicles without qualified player models; named LOD0 and cockpit archive members can be very small. The bus was drivable but was reported to block garage use (#669). Restrict sales to an explicit list and qualify purchase, saved thumbnails, garage changes, paint and reload independently. Asset audit and recovery |
| Removing .NET single-file compression to address a launcher Defender alert (#659) | On multivac, .NET SDK 8.0.416 publishes of the same dev launcher with runtime 8.0.22 both scanned without threats with Defender intelligence 1.461.84.0; disabling compression increased the EXE from 72.0 to 162.4 MB. The official 0.5.1 ZIP still reproduced Trojan:Win32/Yomal!rfn. No evidence from this comparison justified changing compression; retain the exact flagged artifact for vendor analysis. Investigation |
| Apply the 1x Mac untiled-predicated-tiling gain to QUALITY 60 | M4 Pro, 2026-10-18, pinned 36.7 s free-roam drives, 2x/4x MSAA: an unpaired on/off control returned 34.1/43.5 fps, median 28.29/22.24 ms, surfaces 848/467 MiB. Varying car poses limit the timing comparison; no gain is qualified, so keep the preset's off setting. Method |
| Cure the Mac restart-dependent gray sky by disabling split recording, fast pixel math or native execution, or by compiling pipelines synchronously | The gray/brown sky occurred with both recording and math settings and with the legacy executor; a synchronous-pipeline control also showed it, with no skipped pipeline-wait draws. No setting is a demonstrated cure; defaults stay unchanged. This is separate from the contributor's isolated bright pulses, which did not reproduce in five 120-frame M4 Pro windows. Controls |
| GDI window video as a Vulkan flicker oracle (#531) | On Windows with the RTX 4080, sampled frames from a valid 143.5-second H.264 recording were black while seven guest captures showed night gameplay. Decode a sample before running a matrix. Sparse guest captures change GPU timing and cannot qualify frame-to-frame flicker; preserve a live recording and measure source cadence separately from recording rate. Method and limits |
| Context-only observable-state publishing with unproved indirect targets (CS-0.2) | The conservative caller-demand census counts 0.850/0.979/0.753% net context instructions on the Odin's render/simulation/mixer threads, 0.903% pooled against 15%. Unknown calls read all state; opaque boundaries and conditional-write publications are charged. This rejects CS-2 at the present gate. It is a static census weighted by matched samples, not a measured backend speedup or a limit on a design with new target proofs. Method |
| Reporting guest fences at real host completion with a synchronous queue-prefix drain (CS-0.4) | in-run race/free-roam A/B, 1x: Odin means 16.68→20.27 / 16.68→23.08 ms; Deck 16.77→48.21 / 16.84→48.69 ms, with worse p99 on both. A/A means differ under 1%. This historical drain stays off and is not a lower bound on asynchronous retirement; the separate timeline test below decides CS-4. Method and controls |
| Guest fence retirement on an asynchronous timeline worker (CS-0.4 Round 2) | Same pinned race/free-roam in-run A/B, Vulkan 1x: Odin mean +25.66/+31.11%, Deck +127.16/+122.00%, with all p99s worse by 10.35–28.58 ms. A/A mean shifts stay under 0.57%. The producer never waits on the timeline; submission splits and completion delivery still cost too much. CS-4 is rejected at the 3%/unchanged-p99 gate. Builds, counts and controls |
| Session replay from external events alone (CS-0.1) | Round 2 fixed the global event stream with per-thread tagged capture, replayed clock/input/I/O results, stable allocations and per-object lock grants. A desktop race capture still diverges on an ordinary job-state load: captured 3 versus actual 4; a writer-instrumented repeat finds captured 4 versus actual 3, with the last matching worker write identified. A final repeat without memory observers still diverges at job lock versus another polling timebase read: zero PM4 frames equal; best earlier iteration: one. CS-1 needs execution scheduling or shared-memory ordering between kernel calls. Capture coverage and writer evidence |
| Partially serialized execution as a complete replay oracle (CS-1) | One permit and logical clocks record a desktop race, but unobserved replay reaches another boot helper at grant 850,145 / 11.67161 s: zero racing seconds verified. A separate native-stack capture identifies UI/GPU deadlock on shader-prewarm completion, which is not a recorded input. The guest-path split remains unlocalized. Control native completions as well as guest execution before accepting an oracle; this does not reject a complete rr-style design. Gate, controls and prototype cost |
| Equal simulation steps from the average present interval (#381) | game time followed wall time, but a scripted route desynced in the menus at 2x and frames still showed 0 or 2 steps |
| Holding the main loop after its step wait until the render thread's swap (#381) | 97-99 % of frames got one step, but steps moved onto the swap's timing: at 60 fps game time per frame strayed more than with no gate (over 4 ms in 6.5-7 % of frames against 2.8 %) |
| Holding the vblank's step signal until the next vblank, without raising it at the swap (#381) | paced as well, but the held step lost up to a vblank: the slowest tenth of seconds fell from 100 to 86 title frames |
A CPU pause or a thread yield for db16cyc, the guest's spin-wait delay hint (another ReXGlue fork cut a title's CPU by a quarter with the yield) |
FH1 has 20 sites; on multivac (v4, open-world route, three interleaved runs each) process CPU per frame was 27.2 ms with no hint, 29.2 with pause and 27.2 with yield, frame time unchanged. Kept as ppc_db16cyc_hint, default off, for the Deck and Android |
| Skipping texture and vertex fetch invalidation when a fetch-constant write repeats the old value (another ReXGlue fork measured 13-30 % of its writes as repeats) | FH1 repeats none: 0 of 33.5 million fetch-constant writes in a 45 s open-world route on multivac (v4, RTX 4080), so there is nothing to skip |
| CR fields in C++ locals, synced at every call | the Android library 13 MB and the desktop executable 26 % larger, for no gain; syncing by the calling convention instead paid (see above) |
| Every register in locals for physics functions with several calls or many live vector registers (NN-5.1) | 61 of the 80 tried got longer or did more memory accesses on arm64, from the spills of 128-bit locals and the stores before each call: the tyre model sub_82D2F348 +1 % instructions with 639 to 780 memory accesses, sub_82D2D730 +22 %, sub_82D2D0B0 +20 % with stack accesses 42 to 628; only 19 functions were kept |
| Reading the fixed FP mode once and single-precision multiply-adds without the register locals (NN-5.1) | on 61 physics functions, 3.9 % more arm64 instructions (the guarded toggles stay inline) and no change in desktop cycles (time-weighted +0.6 %) |
ppc_fixed_fp_mode on by default on x86, as on arm64 (#757) |
correct (reference verifier on the v4 race: 245 functions, 67.3 million calls, no mismatch above 4 ulps) but not faster: on multivac's v4 build an early open-world result of -1.1 to -2.9 ms process CPU a frame did not repeat (-0.55, +0.94, -0.05), the race ran +0.35 to +2.40 ms, and the Deck race +0.11 to +1.94 ms at an unchanged frame time, with the GPU decoder and submission threads slightly up (in-run A/B, three or four runs each). The x86 default stays off |
| Building pipelines when a display list is created, ahead of its draws (NL-3.6) | a pipeline needs the render target formats and blend and depth state a list inherits from whoever runs it, and 96 of the 233 pipelines a first race still creates after preparation differ from stored ones only in that state; the most any approach could save is the first launch's extra 6.7 s over budget at two loading moments, once per install, since stored pipelines persist |
Non-volatile GPRs, FPRs and vector registers in C++ locals (non_volatile_as_local) |
correct only with the save/restore helpers inlined and every written local published to ctx at calls and returns, because the game reads a caller's register through ctx, also from functions reached indirectly; that made .text 66 % larger and guest code 20-27 % slower on the render and simulation threads at the same frame rate; kept as an off option |
| Hooking the guest XMA API to avoid a "trap" on every audio register write | there was no trap to avoid: the generator recognises the register window statically and emits those stores as direct calls into the decoder; the cost was the decode done inline on the audio thread. Moving it to the decoder thread (an SDK cvar) cut the guest audio thread 15 % on the desktop and 21 % on the Odin without touching guest code. Check how a hardware access actually reaches the runtime before designing around it |
Canary's scalar-ALU swizzle fix (b from Z under a three-operand vector op) |
no FH1 shader is affected: of 478,372 ALU instructions in the 12,846 disc shaders, none co-issues a scalar operation with mad, cnd* or dp2add (the XNA compiler never shares source 3) |
| Trusting a byte-match for a small function's title-update address | the five XAPI fiber thunks "mapped" to their base addresses in v4 (they sit 0xC1E80 higher); the v4 build then hooked five unrelated functions and failed to load. Check a small function's mapping by its cross-references |
Guest stack accesses without volatile |
1.5 % fewer host instructions statically, but the race route ran 7-9 % slower on the desktop (108-110 against 117-119 fps median, worse p99); kept as an off build option |
A free-running V_COUNTER (Edge) |
FH1 never reads it: a race reads only CP_PROG_COUNTER and the vblank status through the register path (one-time read log, gpu_log_register_reads) |
| ThinLTO on the generated code | neutral on guest-thread instructions while the weak thunks blocked inlining; with direct calls on the strong bodies it inlines (code +8 %, instructions +12 %) but the desktop route sits at its frame-rate cap either way, so the Odin decides |
| Releasing a DualSense's triggers through SDL alone when the game crashes | SDL's HIDAPI driver writes effect, LED and rumble reports from one thread, one every 10 ms, and folds a new report into a queued one only when the enable bits match; with the game's rumble at 120 calls a second, 3 of 6 forced crashes ended before the release left the queue. Writing the report to the device through its own handle as well released 3 of 3 |
| A strong or slow trigger vibration for wheelspin | at 4-8 of 8 and up to 55 Hz the trigger motor is loud enough to hear and players called it wrong; at 15-25 Hz each pulse is felt as a click; switching it on and off at the grip limit clicks too. A faint 40 Hz buzz (1-2 of 8) with hysteresis and a quarter-second hold felt right |
| More CRT functions as native code | the remaining candidates are 0.02 % each in a race |
| Float constants read by register number from a heap of 16-register pages, a draw copying only the pages written since (NL-3.3) | Forza Horizon writes new constant values nearly every draw: 1.9 page runs a draw were dirty and 0.03 came back unchanged, so pages copied 650 bytes a draw against 490 for packing just the constants a shader uses. The constants descriptor set got cheaper, but the heavy race recorder went from 7.5-7.7 to 7.9-8.5 ms (RTX 4080, 1x race, 3 rounds). Count how often a title's constants repeat before building constants by address |
| A native guest heap allocator | 0.05 % of a race, inclusive |
| Write-watches at 64 KiB | 7 write-watch faults a frame; the fault path is under 0.5 % |
| Reading the physical offset once per function | 3.6 MB smaller library, no runtime change |
| Honouring guest thread affinities, MMCSS, latency-critical placement | no consistent gain |
| Restructuring the global lock on desktop | 0.34 ms blocked per frame, not worth it; on Android, moving I/O off it was |
| Recorder replay, templates, segment replay | slower, or −0.3 % against a −15 % goal |
| Native vertex layouts or logical resolves for the vegetation pass (#755) | skipping the pass's draws outright saved 0.22-0.37 ms of GPU time a frame on the Odin; the pass has no resolves |
| DGC against a tight recorder for one pass (#754) | the Odin has no DGC, the Deck's binds compute pipelines only, and the pass costs 0.08-0.18 ms of CPU a frame in all |
A native region for the 77-function physics subtree under sub_82DFC570 (#756) |
2.6-9.1 % faster per call on multivac, 12.5 % slower on the Odin; no frame change |
| Culling hidden world draws before the game builds them (#784) | 48 % (multivac) and 60-70 % (Odin) of the main scene's depth-writing draws pass no samples, and dropping all of them would save 2.2-3.2 ms of the Odin's main-pass GPU time. Most are occluded, though, and removing occluded draws safely needs this frame's depth. Draws that pass no samples even without the depth test, the most a frustum test could remove, saved 0.6-1.4 ms at best |
Owned draw programs for the vegetation lists (gpu_d3d_program, #753) |
exact (4.6 million draws compared), but matching a draw against its record cost what deriving it did: per program draw even on multivac (925/962 and 865/860 ns) and 5-58 ns slower in 5 of 6 Odin windows |
| Bindless textures on NVIDIA | ±1.5 % |
Bindless textures on the Steam Deck (vulkan_bindless_textures, 2026-11-16) |
two runs each at the 60 fps cap: the texture steps of a draw halve (image infos 150 to 85 ns, binds 72 to 37 ns), but a draw still costs the recorder 1.5-1.6 µs and the submission thread rises 1.1-2.5 ms a frame; Android only |
| Forcing tiled on-chip rendering on Adreno | about twice as slow |
VK_KHR_present_wait |
worse spacing |
| Store-op tuning, render-area trimming on tilers | too few cases, or the driver already did it |
| Bloom, motion blur and depth of field off | no measurable saving |
No free-roam traffic, shorter grass, no crowd, no shadows from other cars (AIOpenWorld.xml, TrackSettings.xml by mod) |
no change in frame or GPU time beyond run-to-run spread on the reference desktop, and nothing visible; untested on a weak machine |
| Muting the track reverb in its XML | the reverb is still computed; no change in audio-thread CPU |
-ffp-model=strict on the generated code |
1–2 % more host instructions in the hot partitions, for a reordering across MXCSR writes never observed; kept as an option |
-fasync-exceptions on the generated code |
no generated unit has an SEH scope; the flag moved code size under 1 % either way, now off |
| x86-64-v3 (MOVBE, AVX2, BMI) for the generated code on Windows | MOVBE replaced a fifth of the byte swaps in the audio routines, under 1 % of their instructions; still opt-in on Windows. On Linux it is the default since a Deck cycle measurement (NN-1.8, with the small code model: simulation -10.5 %, process -5.5 %) |
| Untiling predicated tiling on the desktop as it works today (it does pay on the shading-bound M4 Pro, about 0.8 ms, and is on for macOS) | CPU-neutral at 1x on the RTX 4080 (decoder 7.73 to 7.83 ms, recorder about 4.7 ms either way, submission 2.4-2.5 to 2.1 ms): the first pass selects every bin and the later tiles stay predicated, so the decoder still walks them and the saving on duplicate draws comes back as decoder work |
| Letting the GPU read guest memory in place instead of the 512 MB shared-memory mirror (host-pointer import, dma-buf) | not available on the Android drivers (no VK_EXT_external_memory_host on Turnip or Qualcomm), and the mirror is not only a copy: fence words are written into it at decode and record time with three frames in flight, so sharing one copy would tear |
| Skipping command buffers that repeat byte for byte, by replaying their captured exit state (G0 of the near-native plan, the ceiling of a display-list compiler) | on the Odin race the probe cut process CPU by 2.5 ms a frame and the GPU command decoder by 1.7 ms, against a 6 ms bar. Its census of that race (2026-10-13) put 74 % of the 1,890 drawn draws a frame in repeating buffers but only 42 % in buffers free of side effects, and the game rewrites most lists after running them, so a compiler at the list seam would pay months for about 2.5 ms |
| A full-frame renderer that retains the game's scene draws instead of decoding their command buffers each frame (FR-3 to FR-6 of FULL_FRAME_RENDERER.md, 2026-11-16) | On the Steam Deck at the 60 fps cap, the draws such a renderer would own (the model assets) all sit in buffers that repeat byte for byte between frames, so a probe that replays such buffers sized it. With the record thread off (G0) and the draws dropped, skipping 380-1,150 host draws a frame left process CPU within noise (−3.4 to +0.1 ms). With the record thread on (the shipping layout), a replay that appends a repeating list's captured record entries instead of decoding it, measured against skipping the lists outright in one in-run 2x2 route, left 0.85 µs a decoded draw of decode and cost the recorder and submission 0.72 µs more per draw: 1.57 µs where the −6 ms gate allows 1.02 (the decoder alone would pass; why replayed draws cost the recorder more isn't established). Capture the entries against what the capture itself wrote only: entries recorded against the capture's entry state drew with wrong state and missed the frame cap. Merging draws by pipeline and textures adds about 1 ms. FR-3 to FR-6 closed |
| Guest stack slots as host locals ("stack symbolization") | a census found only 29-39 % of slots promotable (non-escaping), against the 60 % the proposal set as its bar; the 83 % first seen came from one function, and hooks read saved-register slots on the guest stack |
| Skipping the condition-variable broadcast when no guest thread waits (NN-3.3) | Android 13's bionic makes no futex call for a notify_all without waiters: on the Odin it costs 1-2 ns over the lock and unlock, about 1 µs a frame in all; the in-run A/B read -0.67 ± 0.79 ms of process CPU, which is noise |
| Waking the idle render thread from the producer instead of a 200 µs sleep (NN-3.9) | bounded first: ten times fewer polls (a 2 ms sleep) saved 0.10 ± 0.09 ms of render-thread CPU on the Odin and made the tail worse (p99 17.26 to 17.42 ms, frames over 20 ms 0 to 4) |
| Write-watch protects under their own lock (NN-2.4) | the 6-12 ms mprotect calls under the global lock no longer occur: three Odin races timed every protect and found none over 2 ms (36-42 a frame, 0.25-0.29 ms a frame in all) |
| Decoding FMOD's XMA on the host at the codec's read, seek and close, with no guest XMA context, registers or kick (NN-4.8) | with the decode already on the decoder thread (NL-4.1), the in-run A/B on the Odin race (native on and off every 180 frames) read -0.05 ± 0.60 ms of process CPU, -0.11 ± 0.08 ms on the XMA decoder thread and -0.04 ± 0.07 ms on the FMOD mixer: the decode only moved to the calling thread, and about 0.1 ms of emulation was left to save. The per-call verify against the guest also never came out exact (2,205 of 25,092 calls under 60 dB): an exact host stream has to copy the decoder-history rules the game uses at seeks (a reused playback keeps the decoder, a new one primes, 512 samples apart) and catch the seeks that bypass the codec table. Measure what the emulation still costs after moving its work off the hot thread |
| A page cache for the hooks' guest-range checks on Android (NN-3.4), a negative cache for host path lookups (NN-3.8) | counted first: 5.2 range checks a frame in an Odin race (median 0) and no failed path lookups |
| FSR 2 or FSR 3 on a Steam Deck docked at 1080p (UP-2.1) | the upscale takes 10-14 ms of the Deck's GPU and frames go from about 17 ms with FSR 1 to 26-28 ms; on its own screen at 1x there is nothing to upscale, and the temporal path (which now runs at 1:1 as native AA) was not measured there |
MoltenVK fast math (MVK_CONFIG_FAST_MATH_ENABLED) and Metal heaps (MVK_CONFIG_USE_MTLHEAP) on the M4 Pro |
free-roam drive medians within run-to-run noise or slower |
| IEEE vertex math and bindless textures on the M4 Pro | medians 11.0 and 11.1 ms against 10.9 ms; both stay Android-only |
| User-interactive QoS for the game's threads on macOS | medians 8.41 and 8.32 ms against 8.40 and 8.43 ms at the 120 Hz cap, and no fewer slow frames |
| Synchronous GPU submission on Android, judged on CPU total (NN-2.8) | it removes the 2.7 ms submission thread and saves 1-3 ms of process CPU a frame, but the render thread then waits on each submit: on Odin race pairs p99 frame time rose from 17.2 to 21.4-21.6 ms and frames over 18 ms from 0.1-0.3 % to 5.9-7.2 % |
| Moving a render pass's buffer uploads ahead of the pass so the pass is not split (GPU pass P1) | it removed nearly every vertex and index upload split and 7-16 % of render passes, but three in-run A/B races on the Odin (Adreno 740, which renders these passes in system memory) measured +0.21 to +0.43 ms of GPU time a frame and no change in frame time or slow frames; a split there costs a pipeline drain, not a tile load, and the upfront copy cost more |
| Submitting at the end of each primary buffer turned off, so a frame goes in fewer submissions (GPU pass P3) | three in-run A/B races on the Odin: the GPU timestamp span fell 0.49 ± 0.21 ms, but KGSL busy time, frame time, slow frames and CPU did not move; the span includes the gaps between submissions, so it shrank without the GPU doing less. Kept on |
| Kernel object lookups under the object table's own reader lock instead of the global lock (NN-3.10) | a lock census on the Odin race put 84 % of the global lock's contentions on handle lookups, but they blocked only 0.16 ms a frame, mostly on worker threads; the in-run A/B (build R, toggled every 180 frames) read process CPU +0.22 ± 0.59 ms, render thread -0.06 ± 0.10 ms, main thread +0.01 ± 0.05 ms. Contention counts are not time: measure what the waits cost the threads that matter first |
| Learning the dynamic vertex ranges the CPU refills and invalidating them at each ring kick instead of write-protecting them (NN-3.12) | the write-watch faults stay in two vertex ranges (7.4 faults a frame, 0.45 ms of fault and protect time on the Odin race), but the kicks invalidated 379 pages a frame and all 379 were uploaded again, while faults fell only from about 6.8 to 5.4-6.2 a frame; in-run A/B on the Odin (build R): process CPU +0.02 ± 0.61 ms, render thread -0.10 ± 0.08 ms. A verify mode found no missed writes, so it was correct, just not cheaper |
MADV_PAGEOUT on the guest memory arena to give back GPU-backed pages (NN-6.6) |
the kernel skips pages mapped more than once, and the arena maps every page twice (guest and physical views): on the Odin (kernel 5.15, zram lzo-rle) a 64 MB memfd mapped once went from 68 to 3 MB of RSS, mapped twice it reclaimed nothing. The texture data would also compress poorly |
| A native twin of FMOD's channel matrix mix and its level ramp (NN-4.3) | it matched the translated code on every call (1.29 million verified on the Odin, no mismatch once level writes from the game thread were told apart), but at about 125 calls a frame the in-run A/B on the Odin race moved the FMOD mixer thread by -0.03 ± 0.07 ms a frame, against a 10 % bar; the first version was 0.67 ms slower because it re-hashed 2 KB of guest code on every call. Removed |
| Dropping the later tiles' object command buffers in the decoder, when the first tile ran the same buffer and it only set state and drew (NN-2.2) | five revisions on the Odin race: the census put the skippable decode at 1.45-1.51 ms a frame, but the exact-replay check still found register differences at half the resolves and at CPU-visible writes, and an in-run A/B that dropped about 1,870 decoded draws a frame moved the decoder by −0.36 ± 0.40 ms and process CPU by −0.13 ± 0.69 ms; the decode it skips is cheap next to the draws the tiled-pass skip (NN-2.1) already drops |
| Constant blocks that persist across draws and upload only what changed (NN-2.6) | constant uploads are about 1.4 ms a frame on the Odin, but float constants are only 51 % of the uploads and 45 % of the bytes, and earlier measurements found the cost in buffer requests rather than copies, with persistent blocks 16 ns a draw slower; a delta form could not reach the 250 ns a draw it needed, so it was not built |
| Profile-guided optimisation of the generated code with the profile kept in step with it (NN-1.4) | trained on four routes, measured on the race: after normalising for the draw count, process instructions −0.72 % (profile applied automatically) and −0.13 % (applied by hand), against a −2 % gate; the same build's own runs differed by 20 % in raw instructions with the draw count |
| Calling one-target indirect call sites directly (NN-1.5) | three quarters of executed indirect calls have a single target, but the saving is about 0.035 ms a frame, 0.3-0.7 % of the owning threads' instructions, below what a cross-build A/B resolves |
| Keeping more guest registers in host registers across the hot functions (NN-1.10) | a static census of the top 200 functions put the realistic bound at 1.4-2.0 % of their instructions beyond the host-local saves, about 0.05-0.07 ms a frame, below the 3 % gate |
| Pinning the context and memory base in reserved host registers (NN-1.12) | on the Odin prime core, a pinned build lost 9 % on the biquad filter and 4-14 % on physics twins, because the compiler no longer treats the context as unaliased in float code |
| Native MPEG decoding for the radio (NN-4.6) | with the radio on, the FMOD threads run 0.44-0.67 M more instructions a frame, about 0.15-0.2 ms for decode, streaming and mixing together, under the 0.2 ms gate for the decode alone |
| Fewer GPU resolves and transfers (NN-2.7) | skipping every resolve dispatch saved 0.15-0.28 ms of GPU time and skipping every transfer saved nothing (+0.08 to +0.30 ms), because unprofiled the copies overlap other GPU work; both are under the 0.4 ms gate |
Remembering a shader load by its guest address instead of rehashing the microcode on every IM_LOAD (DL-0.3) |
exact (0 mismatches in 57 M checked loads, 99.8 % hits, the entry dropped by a write watch on the microcode), but on the Odin race it saved 0.32 ± 0.09 ms of decoder CPU a frame (four in-run A/Bs, adjusted for draws) against a 0.5 ms bar, with process CPU and frame time unchanged; the hash it skips is about 65 ns a load at about 4,900 loads a frame. Superseded the next day by gpu_d3d_shader_cache, which also skips the shader lookup where recording is inline and is on by default (Renderer) |
| Caching each object's reprojection slot by its previous and current matrices, so a repeated pair skips the 4 × 4 inverse (NA-0.7) | exact (0 mismatches against the inverse in a verify run) and 87 % of the about 2,150 object-motion draws a frame hit, but three in-run A/Bs in the v4 open world with DLSS at 2x moved GPU decoder CPU by -0.07 to +0.16 ms (95 % intervals ±0.3-0.8 ms) and frame time not at all: about 1,900 inverses a frame cost less than the run-to-run noise, and the hash and lookup cost about what they save |
| Translating the base build's symbol ordering file to v4 addresses instead of profiling v4 (NA-0.4) | the v4 function map pairs 16,701 of the 38,770 functions the base race enters (about 95 % of the 5,000 most-called), and in the linked library those 16,701 sit on 14.5 MB of pages instead of 32.5 MB, but on the Odin (two runs each in the v4 open world) libmain.so PSS stayed 54.8-54.9 MB with and without it, with 46.6 of 47.4 MB of code resident. The order only saves memory when it covers every function the route enters: the 22,000 unpaired ones stay spread over the whole library, and with the kernel mapping code in 64 KiB neighbourhoods around each fault, a few thousand scattered functions keep nearly every page resident. v4's own probe counts (a v4 probe build on one open-world route) cut it to 34.3-36.2 MB |
| A D3D-level renderer: taking the game at its Direct3D draw calls and display lists instead of decoding PM4 (DL-1 to DL-3) | built far enough to replace every display list and both draw calls, exact against PM4 and bit-identical on a paused frame, but process CPU moved -0.9 ms at best on the desktop and the Deck and not at all on the Odin, against a 3 ms bar. The ceiling with all PM4 work skipped was only about 3 ms net on the Odin; parsing is a fifth of the decoder's instructions and much less of its time, and the backend draw, register writes and texture binding remain. Only the shader cache paid alone (decoder -0.5 ms, at its gate); it is on by default |
| An FMA build of the runtime and renderer to go with FMA game code (TP-3) | the same FMA game code against an SSE4.1 and an FMA runtime, fh1-race-sync three times each on a Ryzen 7 5800X: process CPU 25.37 against 25.75 ms a frame, GPU decoder 6.41 against 6.47 ms. The prebuilt runtime stays SSE4.1 on every x86-64 PC |
Compiling the generated code that never runs at -O1 (TP-6) |
no unit is cold: the probe routes entered 38,770 of 76,494 functions, spread over all 260 units (median 51 % of a unit's functions). Even every unit at -O1 saved only 7 % of the compile (1,214 to 1,129 job-seconds on a Ryzen 7 5800X): at this size the compile is mostly parsing and code generation, not optimisation |
-g0 instead of -gline-tables-only for players' generated code (TP-6) |
6 % less compile (1,140 job-seconds) and half the object size, but Windows crash reports would lose the line numbers of generated frames (the names stay). Not worth 4 s on 16 threads |
| Preparing shaders in the background so Play is offered at once (TP-7) | the stutter it removes is already measured: with an empty driver cache, preparation cut frame time over budget in the first race from 13.0 s to 5.7 s and the worst frame from 1.35 to 0.53 s (Renderer). Two minutes saved is not worth that first race |
The probe build's symbol ordering file on x86-64 (lld --symbol-ordering-file on Linux, lld-link /order on Windows, with -ffunction-sections on the generated code; 2026-11-14) |
Deck race, three interleaved pairs against the same build without the order, with code on 2 MiB pages in both: instruction cache misses rose 12 % (1,906-1,917 against 1,679-1,720 a million instructions), instruction TLB walks rose slightly and IPC did not move. On the laptop (UHD 620, three pairs) the frame time and process CPU did not change. The order was made from the Odin's call counts; on Android it saves resident memory, which the desktop does not need. BOLT, which lays code out from a profile of the target CPU, cut the misses 10-15 % below the plain build, but is opt-in while its builds stop at the title menu more often (recompiler) |
-mtune=znver2 on the Linux build (the Deck's Zen 2 cores, on top of -march=x86-64-v3; 2026-11-14) |
Deck race, three pairs (one tuned run stuck on the title menu): IPC 1.169-1.212 tuned against 1.224-1.251 generic, with no other counter better. Generic tuning stays |
Non-temporal (streaming) stores for the shader constants written to the uniform ring (_mm_stream_si128, 64-byte aligned blocks, 2026-11-14) |
The copies are about 14 % of the Deck's recorder thread, mostly glibc's memmove loop on 160-768-byte blocks. In-run A/B on the Deck race (two runs, 11 blocks each): recorder CPU -0.10 and -0.15 ms against a 95 % interval of 0.33, and the same or more recorder time a draw. The ring's lines are read by the GPU soon after, so bypassing the cache gains nothing measurable |
| Skipping meshes smaller than a pixel in the camera views at the native scene culling seam (box diagonal against distance, 2 px of 720 lines; 2026-11-15) | Deck race in-run A/B, two runs: draws changed by +10 and -16 a frame, within the noise. The game's own distance and LOD culling already removes nearly everything that small, so the 15-31 % of draws the earlier census found off-screen are large items whose boxes cross the frustum, which only per-mesh bounds would catch |
| 2 MiB pages for guest memory (2026-11-15) | Not possible without changing a system setting: guest memory is one shared memory file mapped into several views, and SteamOS sets shared-memory huge pages to never (root only); Windows needs the lock-pages privilege. The Deck takes about 300 data TLB walks a million instructions, roughly 1 % of cycles, which bounds the gain |
Returning the native allocator's free pages on a timer (malloc_trim(0) with glibc, M_PURGE on Android, every 60 s in a race; NR-2, 2026-11-16) |
The Deck's anonymous memory is mostly glibc thread arenas (43, 38 and 35 MB), so trimming looked like a cheap RSS cut. In a race it returned 1-11 MB on the Deck LCD (anonymous 149 to 138 MB at the first pass, 1 MB by the third) and 3-5 MB on the Odin, each call 0.2-3.4 ms. The arenas hold live data, not freed pages. A per-site allocation census needs heaptrack or heapprofd, not set up here. |
| Native twins of more FMOD mixer units after the stereo change and ParamEQ (NR-3, 2026-11-16) | The bar was two or three leaves holding over 60 % of the Deck's mixer thread; none does. Reverb, the largest left, is about a fifth of it and switching it off saved 0.28-0.31 ms, so a twin at half its cost saves about 0.15 ms (estimate), for a fidelity risk at the 60 dB bar. Not built. |
Dead-work census of the minor guest threads (82E1C3E8, 829F6620, 830C6918; NR-4, 2026-11-16) |
Together 0.2 ms a frame on the Deck LCD and 0.36 ms on the Odin, and their output is read: 82E1C3E8 serves a request queue, 829F6620 is D3D's tiling worker. Their cost is waits and mutex releases, which the XAPI wait fast path (NR-7) would address, not skipping (threads). |
Other recompilers' published optimizations, and which applied here, are surveyed in RECOMP_OPTIMIZATION_SURVEY.md.
Keep the record#
Every finding about the game (a function's purpose, a structure offset, a setting's effect, an address in the title update) goes into the repository in the same change: semantic names in config/mod/fh1-symbols.toml, everything else as a record in site/findings/, which the Reverse engineering pages render, with how it was established and a confidence. Negative results count. The record holds analysis only, never disassembly, decompiled code or game data (Legal).