Skip to content

VFS: XCL's shader cache on a drive a console mount names stays where it is - #331

Merged
ivall merged 1 commit into
xcl-dev:mainfrom
imnicho:vfs-shader-cache
Nov 24, 2026
Merged

ivall merged 1 commit into
xcl-dev:mainfrom
imnicho:vfs-shader-cache

Conversation

@imnicho

@imnicho imnicho commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

With the shader cache on a PC drive that the title's mounts name – XCL_DXIL_CACHE=D:\…, or a user profile on D:, the console's game drive – the title's process takes the cache's paths for console paths: it writes its DXIL and translations into the title's overlay and reads them from there. The folder that was named is neither read nor written, so what xcl shaders --precompile writes (no mounts there) is not found by the title, and a title's cache is in its own overlay instead of the folder titles share. in_own_folders (#49) already keeps the game folder and the title's data folder out of the mounts; the shader cache is outside both.

What is in it

  • crates/xcl/src/vfs.rs: Vfs::own_folder names a folder of XCL's own besides the title's data, and in_own_folders counts it. Test a_console_drive_mount_leaves_xcls_shader_cache_on_that_drive: without own_folder the cache file is classified as a game file (written to the overlay), with it the path is passed through; a sibling folder and the rest of the drive stay the console's.
  • crates/xcl/src/host.rs: the host names recomp::dxc::cache_dir().

Tested

  • hardware: Intel Core i7-7700K, 16 GB RAM, NVIDIA GeForce RTX 5080 (driver 610.47), Windows 10 22H2 (19045), rustc 1.100.0 stable-x86_64-pc-windows-msvc; debug for the tests, release for the title.

  • cargo build --workspace && cargo test --workspace -- --test-threads=4 on 603cdd3: 666 passed, 0 failed, 41 ignored (SKIPPED GPU tests: gpu_wave32_program_in_wave64_hardware, gpu_geometry_wave32_prefix_count_over_a_mask – no wave64).

  • game checked: the newer retail title of the README, with the game folder and XCL_DXIL_CACHE both on D:. The cache folder was filled beforehand (402 files, a new folder name, so nothing of it in the overlay), then three 60 s runs, DXIL cache hits / misses from report.json:

    run build hits misses files added to the folder files under <title data>\overlay\<the folder's path>
    1 main 85bdf21 3 26 0 23
    2 main 85bdf21 29 0 0 23
    3 this PR 603cdd3 29 0 0 23 (as left by main)

    With the folder full, main misses 26 of 29 lookups and leaves 23 files in the overlay; its second run reads those. The PR's build reads the folder.

Regression run

main:

xcl-smoke v1
commit: 85bdf2193e7a793d568485b35f9cae5e8159bc39
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 23 (PresentX 23)
presents per 2 s (last 3): 1 1 2
device removals: 0
crashes: 0
peak commit: 14139 MB

PR:

xcl-smoke v1
commit: 603cdd395c8f1fc42d5928a750e19d64bf6ff304
gpu: NVIDIA GeForce RTX 5080
title: retail-title
seconds: 60
exit: 0x0
frames shown: 26 (PresentX 26)
presents per 2 s (last 3): 1 1 2
device removals: 0
crashes: 0
peak commit: 14149 MB

(The frame count is this Intel CPU's: #306 is about that and is not part of this change.)

Not tested

  • Other folders of XCL's own that a user can point at such a drive (XCL_DXC_DIR, XCL_D3D12_DIR): not looked at.
  • A cache written by xcl shaders --precompile itself: the folder in the runs above was filled by an earlier run of the title with this change, not by a precompile.
  • A cache that an earlier build left in a title's overlay: nothing moves or removes it, and with this change the title no longer reads it.
  • AMD and Intel GPUs (the change is not GPU code).

AI use

  • Claude Code with Claude Fable 5.2: found the cause from a run whose cache folder stayed empty, wrote the change, the test and this description, and ran the test suite and the title runs above on the machine named.

Duplicate check before opening (2026-11-23 23:32 UTC, main db1ddb2): read #49, #150, #158, #160, #171, #174, #255, #316 (case folding and verbatim roots in the same file, other lines; the two merge together cleanly).

🤖 Generated with Claude Code

…it is

With XCL_DXIL_CACHE (or %LOCALAPPDATA%) on the PC's D: drive, the title's
process took the cache's paths for the console's D:\ (the game folder): it
wrote its DXIL and translations into the title's overlay and read them from
there. The folder that was named was neither read nor written, so a cache
filled outside the title (xcl shaders --precompile, no mounts there) was
not found.

Vfs::own_folder names a folder of XCL's own besides the title's data; the
host passes the shader cache folder.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ivall
ivall merged commit da28099 into xcl-dev:main Nov 24, 2026
1 check passed
@ivall

ivall commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Merged (a6f5f7a). Checked on an RX 9070 (RDNA4) on main a6f5f7a, together with #335, #322, #331, #330, #338, #318 and #332: cargo test --workspace -- --test-threads=4 - 636 unit tests passed, 0 failed; the retail game reaches its menu and draws it (frame dump) and goes on past it.

CalvyPZ pushed a commit to CalvyPZ/xcl that referenced this pull request Nov 24, 2026
The Agility SDK probe (gpu::agility, is_file and fs::read of
<dir>\D3D12Core.dll) runs after the VFS hooks are installed. When
XCL_D3D12_DIR, <exe dir>\D3D12 or <exe dir> is on a drive letter a
console mount names (G:, D:, S: in the report), the hooked file APIs
translate the host path to the game folder, the DLL is not found there,
and the SDK is reported as unavailable.

host.rs now registers each candidate's D3D12Core.dll as one of XCL's
own paths before the hooks go in, the mechanism xcl-dev#49 and xcl-dev#331 use for
the game folder, the data folder and the shader cache. It registers
the files, not their directories: the exe directory can be a drive
root (D:\xcl.exe), and a root among the own folders would take the
whole drive from the console mount. CreateDeviceFactory loads the DLL
through the loader, which is not hooked.

The test registers what agility::sdk_files returns for the env
override, the exe dir and a drive-root exe dir, and checks that each
DLL path passes while the rest of the drive, beside the SDK and at its
root, stays the console's. Registering the directories instead fails
it at the drive-root check; registering nothing fails it too.

Fixes xcl-dev#595

Assisted-by: Claude Code (Claude Opus 4.6 found the cause and wrote the first version; Claude Opus 5.5 narrowed it to the DLL files and rewrote the test)
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