Skip to content

fix(vfs): correct DEVKIT mount path and absolute path resolution - #55

Closed
Uraniumm wants to merge 665 commits into
xenios-jp:xeniosfrom
Uraniumm:devkit-vfs-fix
Closed

Uraniumm wants to merge 665 commits into
xenios-jp:xeniosfrom
Uraniumm:devkit-vfs-fix

Conversation

@Uraniumm

Copy link
Copy Markdown

Summary

Fixes a crash when force_mount_devkit is enabled by resolving the DEVKIT VFS mount path relative to storage_root_ instead of using a relative "devkit" path.

Previously, directory creation could fail on platforms such as iOS, resulting in an unhandled std::filesystem exception and application termination.

Changes

  • Change the DEVKIT mount path from "devkit" to storage_root_ / "devkit".
  • Keep DEVKIT mount behavior consistent with other storage-backed VFS devices.

Testing

Tested on XeniOS for iOS with force_mount_devkit = true.
Platform: iPhone 18 Pro, iOS 27.0.1, LiveContainer

  • XeniOS initializes without crashing.
  • XShell successfully detects executables on the DEVKIT mount (xe:).
  • Executables can be launched successfully through XShell.
IMG_0343

… what led up to it

A crash in JIT code, or in a helper JIT code called, records the guest
function, instruction, link register and a few return addresses from the
guest stack (code addresses only), the guest fault address and whether the
fault read, wrote or fetched. Crash records also carry the crashed thread's
role (never its name), the last 16 events (game start, first frame, shader
bursts, memory warnings, backgrounding, thermal steps, JIT failures), the
game's version, settings changed from their defaults (bools, numbers and
enum words from emulation categories only) and how JIT is provided.
The cache root moves from Library/Caches, which iOS may empty while the app
isn't running, to Library/Application Support/xenia/cache, excluded from
backup. An existing Library/Caches/xenia is moved there once.
MetalShaderLibraryCache was keyed on the executable's LC_UUID, so every
build, including updates that leave translation alone, discarded every
stored shader library and the next session compiled them all again.

The key now comes from what shapes the libraries: a hash generated each
build by shader_cache_version.cmake over the translator's sources (the
xenia/gpu files the translation code includes, by content) and the commit
and uncommitted diff of spirv2air, Mesa, glslang, SPIRV-Tools and
SPIRV-Headers, plus the Metal shader converter's own build and the GPU and
Metal options at run time. The generated header changes only when the key
does, and the inputs are listed beside it.
A warm launch translated every guest shader again only to set its texture and
sampler bindings, though the library was loaded from the cache. Records now
hold those bindings beside the used buffer mask (format 3), and a hit
publishes them and loads the library without translating
(SpirvShader::PublishBindings, also used after a translation). Halo 3 menu on
the Mac: warm translation 102 shaders in 239-265 ms -> none; stored and
translated bindings matched for 111 of 111 shaders.
…it ends

The shader capsule and the launch screen took the rebuild's progress from the
global compile counters, from the load's start to the queued count once every
stored pipeline was queued. Three things went wrong:

- The game's own compiles go ahead of the stored ones and counted as done, so
  the bar ran ahead and the load was called over while stored pipelines were
  still queued: the capsule switched to "Building shaders" and a Wait hold
  ended early.
- The stored shaders compile before any pipeline is queued, often most of the
  load on a phone, with no total published: an indeterminate bar, no estimate
  and no Wait offer, then a jump.
- storage_loading was only cleared on the blocking path, so after a background
  rebuild the launch screen said "Preparing shaders" until the first frame.

The backend now counts the rebuild's own requests (the shaders the stored
pipelines need, tagged when queued, then the stored pipelines it already
tracks for the rebuild record), publishes the total from the start (each
stored description not yet queued counts as one) and clears storage_loading
when the last of them is done. The rebuild record times the whole load
(xrebuild2; xrebuild1 records are ignored). The UI reads one sample through a
UIKit-free header shared by the capsule and the launch screen.
In the fast and fast-alt occlusion query modes, every draw after the first
query report required the guest's exact shaders, so a draw whose shader was
still compiling blocked the draw thread. Those draws now take the normal async
path (placeholder or skip); the report they fall in is marked inexact and
retires with the fast-mode estimate. Strict mode is unchanged.

The pipeline archive gets its own key (path and device), since archive lookups
are keyed by content and a miss falls back to compiling.

Adds metal_compile_thread_qos (default unchanged), logs the device's
maximumConcurrentCompilationTaskCount, and logs per-stage compile times
(translate, cached library, AIR, specialize, pipeline, draw wait) every 5 s
while compiles happen.
Halo 3 sets a 485-row window scissor per strip, clamped to 485 in the
last strip, and shared code replaces it before any draw; learning failed
every session with "the window scissor isn't the strip's rows". Learning
draws mark the strip-own writes still in their registers; the layout
checks skip the writes no draw saw, in merged sessions as the last
verified learning session found them.
Shared code in Halo 3 later sets the window scissor to the last strip's
own 485-row value, so comparing values called that strip's register its
own and the others' overwritten, and learning failed with "strip-own
writes differ between strips". Type-0 and shared SET_CONSTANT writes now
mark the strip's own registers they cover as overwritten until the strip
writes them again.
…tate

Every strip's first draw in Halo 3 is auto-indexed and still has the
previous strip's last index buffer in VGT_DMA_BASE/SIZE, so learning
failed with "a draw sees different inherited state between strips".
Draws with indices in memory set both from their packet; other draws
don't read them.
Halo 3's per-strip clear quads read identical 84-byte vertex copies at a
different address in every strip, so learning failed with "a draw sees
different inherited state between strips" on vertex fetch constant 0.
For strip-own draws the state hash takes the contents of each vertex
fetch range up to 64 KB instead of its address.

StripMerge now takes the guest memory, and the recording of strip-own
resolves moves into it (StripMerge::NoteResolve) from the Metal command
processor.
Hashing every vertex fetch range of an own draw also hashed unused fetch
constants that point at memory the strips' resolves change.
HashDrawState now only leaves the vertex fetch addresses out for
strip-own draws, and CheckDraw hashes the ranges the vertex shader's
bindings use.
Halo 3 sets RB_COPY_DEST_PITCH's height to the rows left below each
strip before that strip's resolve, so learning failed with "a draw sees
different inherited state between strips". Strip-own resolves are
already compared with it in DeriveLayout.
A frame may run several tiling sessions, and a later one reset the
candidate of the one before, so none verified. The candidate, the verified
count, the relearn count and the previous strip bits are now kept per
session slot: the session's order since the last unpredicated swap.

A session classifies its packets with the strip bits of the last session
that had more than one strip. A session whose strips draw nothing is
neutral: it leaves the learned state alone, and merging begins at the first
strip's first draw. Only the session at the same place in the frame as the
one that left the carry merges, so a session never starts its later bands
from another session's.
…n't merge

StripMergeBegin and RenderTargetCache::BeginStripMerge now return why they
won't merge, and the learning session fails with it, so the log names the
limit and learning doesn't verify a layout that never merges.
A strip-own resolve of the merged first strip no longer ends the pass
first: GetStripMergedResolveRectangle already gives the strip-merged
render target as the one source over every band, so the 4x color
resolves run as tile dispatches in the merged pass. A depth resolve left
to the pass end keeps the strip merge resolve bottom it was queued with,
so it reads the merged bands when it runs.
The next merged session started its later bands from a carry render
target that every session end filled with a copy of bands 0..N-2 of each
owner. Read those bands in place instead: a key bit (strip_merge_alt)
sends the next session's draws to the second of its two strip-merged
render targets, so the previous one stays unwritten until its tiles are
first claimed, and the copy-in reads band k - 1 with a band shift. The
copies out at the session end are gone, and the second render targets
replace the carry ones.

Also remove the shared storage of 4x 8_8_8_8 and 2_10_10_10 color
targets (FindUnorm32ColorStoragePartner, ElideAliasedStorageTransfers
and the storage root), unused since those targets stopped using
PixelFormatView.
Learning failed every session with a strip-own packet other than
SET_CONSTANT. SET_CONSTANT2, SET_SHADER_CONSTANTS and LOAD_ALU_CONSTANT now
go through the same RegisterWrites view (payload words, or big-endian guest
memory for LOAD_ALU_CONSTANT), which stale marking and own-state recording
share. Own fetch, bool or loop constants, and own writes outside the
context registers and the float constants, fail learning with their own
reasons.
Some titles select a bin bit above 31 for the rest of the frame, not per
strip, which ended the session as a single strip. A select that changes
only bits 32-63 now continues the current strip, a session may start with
such bits set, and the strip masks use bits 0-30 only.

A session whose record mask, limited to its strip bits, is neither empty,
all of them nor exactly one strip's fails before layout derivation with a
reason of its own: its strips run different sets of draws.
The clear quad rule was off for every draw on a strip-merged surface, so
the transfers into strip-merged render targets copied all of every band
where an unmerged strip copies only what its clear quads leave (in Halo
3, the pitch padding columns). A merged draw in frame space covers the
merged render targets' rows as it covers the frame's, and now takes the
rule as is. A draw addressing the strip's band is drawn once per band,
clamped to the band: if it covers the whole band, it covers the same
columns of every band, which is the rectangle the rule takes; anything
less is left alone. Constant contents stay off for strip-merged render
targets, whose bands are read at offsets.
With --strip_merge_log, a strip-own resolve that doesn't read one
strip-merged render target logs its EDRAM span and the owner of its
first tile, so the case (another render target, a partial owner, a pitch
or row mismatch) can be told apart from a log.
The tile path refused one-sample bit copies of 8_8_8_8_GAMMA and
2_10_10_10 render targets as "format", so each went to a compute resolve
after ending the pass. Two tile kernels pack the pixel as the dump
shader does: PWL gamma of the linear RGBA16Unorm value then 8 bits per
component, or 10:10:10:2 from RGB10A2Unorm.
A constant depth clear quad on a strip-merged depth render target now
leaves its constant as on any other: the rectangle the clear quad rule
takes, over every band for a quad drawn in each band. A color render
target taking the same pixels from such a source, each band from the
same band of another strip-merged render target, starts from the
constant and transfers only what lies outside it, as unmerged strips do
(in Halo 3, the 8_8_8_8 color at the depth's EDRAM). Only for transfers
over whole bands, so the destination's rows of every band are one
rectangle; carries, band shifts and unmerged sources keep the full
transfer.
…ng resolves

Three predicated tiling patterns that learning failed on:

- A strip-own draw only the first strip does (a quad masked to the first
  tile clears it, the later tiles start from what the previous one left).
  Learning aligns the first strip's draws with the second's; the unmatched
  ones must be strip-own and are kept in the layout. Merged, they draw into
  the first band alone. Such a draw through another surface over the strip
  surface's tiles keeps the carry: the merged render targets take the first
  band from that surface and the later bands from the carry.
- A bin mask naming a subset of one strip's bits is that strip's own
  packet, not a partial one.
- A strip-own resolve that clears in a prefix of the strips. The layout
  keeps the frame row the clears reach, and the merged resolve clears every
  band of those strips, in the session's own render target.

Occlusion queries in a strip and tiles side by side fail with reasons that
name them.
…e bottom

D3D clips the last strip's window to the frame (720 rows as 512 + 208).
Every band is the strip height in EDRAM, but the scissors aren't linear, so
learning failed. The layout now has frame_rows, the last strip's window
bottom, anywhere in its band. Frame-space draws of the merged first strip
get a window down to it. Each strip-own resolve's merged bottom is the last
strip's rows below its band top, applied after the scissor clamp in
GetResolveInfo, so the merged resolve writes exactly the rows the strips
wrote.
A tile resolve whose refreshed texture an earlier draw of the open pass
sampled ended the pass for a compute resolve. The dispatch now writes
those textures' texels into a scratch texture of their shape, copied
into them by a blit when the pass ends, in guest order with the resolves
left to the pass end. The pass is resolve-only from then on, so no draw
samples the textures before the copy. Textures no earlier draw sampled
are still written in the pass.
The end of a merged session moved each strip-merged render target's last
band into its twin with a transfer pass (in the Halo 3 lobby, four 4x
passes a frame, color and depth). Source and twin have the same format,
sample count and EDRAM layout, so the blit path now takes them: the
band's rows offset by the band shift, every sample, and for depth the
separate stencil texture too; the depth is the source's own host depth,
so the copy is the same. The blit path no longer takes transfers into a
strip-merged render target, whose bands it doesn't place.
A merged session's later bands of a color render target over a depth
carry (in Halo 3, the 8_8_8_8 color over the D24FS8 carry) took the
carry as their host depth source too. A transfer into color doesn't read
host depth, and the draw pass refuses a host depth source into color, so
the copy-in ran in a standalone pass of its own. A depth carry now is
its own host depth source only into depth, as the ownership transfers
do.
A shader-done fence written with no render pass open took a blit encoder
of its own (CopyToBufferGpuOrdered). Halo 3 writes them in runs with
nothing encoded between them, ten before a lobby frame's first draw.
Such fences now join the list the open-pass fences use and are copied in
one blit encoder before the next encoder on the command buffer or its
commit: EndSharedComputeEncoder encodes them, and every encoder site
calls it first (directly, through EndRenderEncoder or
EndEncodersForCommandBuffer, or BeginSharedComputeEncoder, which ends
the render encoder before creating its own), as the shared compute
encoder already requires. The first fence of a run orders itself after
everything encoded so far the way CopyToBufferGpuOrdered did, so each
fence keeps its place in the GPU order.
Merging draws a draw on the strip surface once into the frame when its
window scissor is the first strip's, else into every band. That is every
strip's draw only if the strips' windows differ at the draw exactly when it
is in the first strip's window. DeriveLayout now records, per draw, whether
the strips' window offset or scissor differ and checks that against the
draw's scissor. With the window offset differing, the draw must also have
the window offset enabled and a scissor the offset moves.
The transfer address constant gives a strip-merged source its tile offset
from the destination in 12 bits, biased by the EDRAM tile count, so a band
could be at most 2047 tiles from the first. Two shader key bits mark an
offset of the EDRAM tile count or more, stored unbiased. The key is taken
from the transfer's own offset, so nearer transfers keep their shaders.
StripMergeBegin now refuses only bands 4096 tiles or more away.
xenios-jp and others added 26 commits November 12, 2026 16:12
The window's volume slider and mute set the volume cvar, which the SDL and
XAudio2 drivers scale by. The PHASE driver used only its own volume, so on
macOS mute and the slider did nothing.
A game found by its default.xbe is recorded as an original Xbox game.

Two discs of a title that carry the same disc number (Halo 3 and its Mythic
disc are both disc 1 of 1) had the same label. Each now goes by its file's
name, and the ZAR converter keeps an image's own name for them instead of
naming both after the title.
…t row

Original Xbox games get their own section, with the shaders and saves they
share under the console's Xbox emulator listed there instead of as an unnamed
game. A game kept as loose files counts its whole folder, not only its
executable. Selecting several items starts from a labelled row above the games
instead of a Select button in the header.
The log was grey text on a light sheet. It is now a dark console in the theme's
colours: a mark per line in its level's colour, the name before the first colon
picked out, frame and thread hidden unless asked for, a filter for warnings or
errors, their counts in the footer and a Latest button when scrolled up.
The flash and system partitions were always mounted from the system
folder of the storage root. system_files_path names another folder laid
out the same way, so several installed system versions can be kept and
one picked for a launch. Empty keeps the folder under the storage root.
The Dashboard of the version games use ran with the configured kernel
build. When an older version is made the one games use, its Dashboard
would see a newer kernel than the console it comes from. Every
Dashboard launch now has the kernel report that Dashboard's build, for
that launch only; games keep the configured build.
Start with the Dashboard always opened the Dashboard of the version
games use. With several versions installed, Settings has a Startup
Dashboard choice beside it, and each version in System Software has
Open at Startup. Games exit to that Dashboard too.

The choice is kept by version number (boot_dashboard_version), so it
stays with the version when another becomes the one games use. It
falls back to the version games use when the chosen one is removed.
Start with the Dashboard sat on a page called Automation, at the end
of Advanced, next to the StikDebug switch. Both are what XeniOS does
when it starts, so the page is Startup now and is the first one under
App. The StikDebug switch is named for what it does: Turn On JIT
Automatically.
The setting was only in Settings. The Turn On JIT sheet has it as a
switch under the steps now. The offer made after StikDebug turned JIT
on also follows the library's Open StikDebug button, and is made once:
Not Now is remembered, and the switch stays where it is.
Install from Files took a USB system update only, and its picker
opened copies, which a folder can't be picked as: Open did nothing for
one. The picker opens in place now and also takes dash.xex with the
files beside it, picked together or as their folder. Such a Dashboard
is installed as a version with only a flash, like a system update's.
A branch in dynamic code to an address that follows a call went through
ResolveCachedReturnSite every time: a host call that walks the live frames
and searches the code cache twice to confirm the frame it found.

The dynamic call cache entry of a return site now also keeps the host
address FindLiveReturn matched for it. Code is never freed, so a live frame
whose host return address is that one returns to the guest address with no
further lookup. A small emitted helper uses it for the two usual outcomes:
the innermost live frame returns to the target with nothing popped, or no
live frame returns there and the function entered at the address is taken.
Deeper frames, popped stack, a possible longjmp and unknown addresses are
left to ResolveCachedReturnSite as before.

Halo 2 under the original Xbox emulator on macOS, with every helper answer
compared against ResolveCachedReturnSite: 395.5 M of 404.7 M lookups
answered by the helper, none different.
Original Xbox games run through the Xbox 360's own Xbox emulator,
which XeniOS doesn't include. The app had no way to install it, and a
game started without it failed with a generic error.

System Software has an Original Xbox Games section now. Install from
Files takes the Compatibility folder, a folder that has one, or the
files picked together, and copies them (Configs and dash included) to
the xefu folder beside a temporary folder that is swapped in whole, so
a failed or cancelled install keeps what was there. It asks before
replacing an install and can remove it. Start Games With lists
Automatic (xbox.xex picks a build for each game) and every build or
config loader installed, and saves the choice in xefu_launcher; a
choice that is gone falls back to xbox.xex or the first build.

Opening an original Xbox game without the emulator, or without the
chosen build, offers to open the section instead of failing at launch.
Storage counts the xefu folder as system software.
The Xbox emulator build could only be set for every game at once, in
System Software. An original Xbox game's settings now offer Xbox
Emulator Build: Default (named by what it currently is), Automatic when
xbox.xex is installed, and each installed build or config loader. The
choice is saved as xefu_launcher in the game's own config, which the
launch already loads before the build is picked; Default removes the
key. Without the Xbox emulator the row opens System Software.

The check before a launch uses the game's build. One that is no longer
installed is removed from the game's settings and the default is used;
the Xbox Emulator Needed alert only shows when the default is not
usable either. The default is read from the saved setting, so the build
of the game that ran last no longer shows as the default.
Predicated tiling draws a frame too big for EDRAM as several strips,
running every draw once per strip (Halo 3: 1152x640 4x MSAA as 4 strips
of 160 rows). With --strip_merge (on by default), the strips are
rendered as one full-height pass sequence once every strip is verified
to draw the same thing.

- StripMerge (strip_merge.{h,cc}) watches predicated tiling sessions
  from the PM4 hooks, learns and verifies that every strip draws the
  same thing (shared packets hashed, strip-own writes linear in the
  strip's frame row, strip-own resolves tiling the destination, per-draw
  inherited state), and then merges: the first strip runs with the
  window scissor and strip-own resolves extended to the frame bottom,
  the later strips skip their draws and resolves and run every other
  packet. Merged sessions are verified again at intervals. A session
  that fails verification pauses merging for a while; one that fails
  after merging has begun logs a warning, as that frame may be wrong.
  Nothing merges while a GPU trace is being written.
- RenderTargetCache: strip-merged render targets, N bands tall, own the
  first strip's EDRAM tiles; transfers into them are banded, a
  strip-merged source is addressed unwrapped; at the end each one's last
  band moves into its ordinary twin, and bands 0..N-2 are kept as the
  next session's carry.
- EDRAM transfer shader: source_unwrapped / host_depth_source_unwrapped
  key bits.
- Metal: band-addressed draws (clear quads) replicated into each band,
  strip-own resolves of every strip's rows from one rectangle, host
  depth store refused for strip-merged depth, merged render targets
  sized N bands.

Only the Metal backend merges. --strip_merge_log logs every session.
Halo 3 sets RB_COPY_DEST_BASE to the first strip's value with a type-0
write, then writes every strip's own value, before each strip's resolve,
so strip k reaches its resolve after k + 1 of its own writes and has 3 -
k more after it. Learning failed every session with "strip-own packets
differ between strips".

A strip-own SET_CONSTANT that repeats the strip's latest own values is
left out of the own sequence. To keep that exact, every learning draw
also records how many own writes preceded it, which of the strip's own
registers still hold its own values and the values shared code put in
the others, and the left-out registers the strip hasn't written; the
strips must match at every draw.
D3D clips the last tile to the frame (720 rows as 256 + 256 + 208) and its
tiling clear quad with it.

- An ended merged session's last band holds the EDRAM only in the last
  strip's rows; the rows below them are read from the band before.
- Learning checks that the last strip leaves those rows alone: its own
  resolves read and clear no row past the frame, and no draw of it claims a
  tile of the strip surface's rows past the frame.
- The tiling clear quad of the last strip, clipped to the frame, matches
  the first strip's: the merged first strip draws that one.

Frame-space draws in frame coordinates don't rasterize bit for bit as in
band coordinates, so depth can differ by a step or two in a later strip.
strip_merge_clipped_last_strip turns these sessions off.
The host snaps vertices to its own subpixel grid after a float viewport
transform, so the same primitive rasterizes slightly differently at another
integer viewport origin. That is the whole difference between merged and
unmerged strips, and with snap_vertices they compare equal. It changes
every draw's output slightly, so it is off by default: a validation tool
for strip merging. Host-clipped primitives and the rectangle and point
expansion paths aren't snapped.
With XENIOS_MACOS_SIGN_IDENTITY set, build_apple_release.sh signs the Mac
app and its dylibs with the hardened runtime and a secure timestamp, leaving
out get-task-allow and allow-dyld-environment-variables, which notarization
refuses. The DMG is then signed, submitted with notarytool (a keychain
profile, or an Apple ID, team ID and app-specific password), and stapled; a
rejection prints Apple's log and fails the build. Without an identity the
app is ad-hoc signed as before.

apple-publish.yml imports the certificate from the repository secret
XENIOS_MACOS_DEVELOPER_ID_P12 (a base64 .p12 exported with the passphrase
"xenios"; the file is the secret) into a temporary keychain, passes the
XENIOS_NOTARY_PASSWORD secret and the XENIOS_NOTARY_APPLE_ID and
XENIOS_NOTARY_TEAM_ID repository variables to the script, and deletes the
keychain at the end of the job. Publishing runs fail without the
certificate or the notary settings; build-only runs fall back to ad hoc.

Checked on a Mac: notarization Accepted, stapled, and Gatekeeper reports
the DMG and the app as Notarized Developer ID.
Function constant values compiled into the code on request (f4a59fd), and
folding of integer bit intrinsics and exact roundings of constants
(e22fc12). Xenia's zero-multiply guard, NMin(|x|, |y|) == 0, lowered as two
compares (7a870d4). Loads of private memory in vertex functions take the
value last stored or loaded when nothing can have written it since
(0f798da). Vector variables written one component at a time become
registers (d1a572e). Conversion takes less CPU time with the same output:
flat block graphs and tag lookups in CSE and jump threading, interned types,
an IR arena that threads reuse, operand views (dbc51ef..857de38). Constant
conditions of a baked shader fold right after translation (8cd72c3, b33b2cc;
output version 1.0.8, aff1b4c), and a branch marked KeepBranch stays a
branch (84638ce).

The submodule now tracks spirv2air's main branch.
A guest shader's fetch-state constants (vertex fetch endianness, bool and
loop constants, finite-multiply flags, texture scale and decode bits,
blend control) are function constants that Metal specializes when a
pipeline is created. Specializing is a compile of its own inside Metal for
every constant set, and it is repeated whenever the system shader cache is
empty, as after an app update or a restart.

With metal_bake_fetch_state (on by default) spirv2air compiles the values
into the code instead. The library is kept in the title's shader library
cache as a variant record, keyed by the shader and the values, so later
launches load it. GetSpecializedFunction asks for the baked function first
and falls back to Metal's specialization when the shader's SPIR-V isn't at
hand (a shader loaded from the library cache) or the title has no library
cache. metal_bake_fetch_state_uncached bakes without a cache, for frame
checks of baked code.

Cold compile of ten game traces in Trace Bench on an iPhone (A19): 98.8 s
with Metal's specialization, 77.0 s baked. With the constant folding of
spirv2air e22fc12, measured in a later session with both sides baked:
73.7 s before the folding, 66.1 s with it.

Frames of 92 game traces with baking forced on: 87 are identical; 5 differ
in 4 to 356 pixels on geometry edges. Those are the register-layout
differences of the folding (spirv2air docs/air.md, "Implicit derivatives
in non-uniform control flow"): with the previous converter the frames are
the same with and without baking. 28.1 M result words of 54 gpugen traces
are the same as without baking.
With fetch-state constants compiled in (metal_bake_fetch_state), the
pipelines of a shader that has such constants only take baked libraries.
Its generic library, the one with function constants, was still converted
to AIR and loaded to mark the shader ready, and then went unused.

Such a shader is now ready once it is translated. The library cache keeps
a record of its bindings and buffer mask alone, so a later launch makes it
ready without translating it; a constant set with no stored variant then
translates the shader on demand. If spirv2air can't compile a constant set
in, the generic library is made at that point and Metal specializes it.
metal_bake_fetch_state_generic_library turns the skip off.

The library cache format changes (XEMTLLB4), so stored libraries are
rebuilt once.

A Halo: Reach trace replayed on a Mac converts 3 generic libraries instead
of 274 (1 ms instead of 382 ms, one run each).

Frames of 92 game traces with baking forced on are identical with and
without the change. For 44 traces, one per title, a replay from an empty
shader storage, a second from what the first stored and a third that
ignores the stored baked libraries all draw the frames of a replay without
storage.
@Uraniumm Uraniumm changed the title fix(vfs): use storage root for devkit mount fix(vfs): correct DEVKIT mount path and absolute path resolution Nov 21, 2026
@xenios-jp
xenios-jp force-pushed the xenios branch 2 times, most recently from 0a754de to 597119d Compare November 25, 2026 04:32
@Uraniumm Uraniumm closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants