Skip to content

xcl run: XCL_PREPARE=0 starts the title without the shader preparation - #2976

Merged
Prime1997 merged 1 commit into
xcl-dev:mainfrom
Prime1997:contrib/prepare-off-switch
Nov 27, 2026
Merged

Prime1997 merged 1 commit into
xcl-dev:mainfrom
Prime1997:contrib/prepare-off-switch

Conversation

@Prime1997

Copy link
Copy Markdown
Collaborator

Requested by Prime · project thread

Since #2555 every start on main runs the shader preparation before the title's code, and nothing turns it off. With a cold cache on a retail title's pack (26,503 records) that is hours on an RTX 3060 Ti, before a minute of play that a change needs, and a regression run of main or of a PR's head sits through it first. nvidia-dev has the switch in the same place: with XCL_PREPARE=0 the preparation is left out and the title builds the shaders it uses as it goes, standing still for those builds, as before #2555. Unset, or any other value, prepares as now.

What is in it

  • crates/xcl/src/hle/d3d12x/present/preparation.rs: before_guest returns before the preparation when left_out(XCL_PREPARE); test only_xcl_prepare_0_leaves_the_preparation_out.
  • README.md: the switch, next to the preparation's description.

Tested

  • NVIDIA GeForce RTX 3060 Ti 8 GB (driver 32.0.16.1714), Intel Core i5-10400, Windows 11 26200, rustc 1.100.0; debug tests, release smoke.
  • cargo test --locked --workspace --no-fail-fast -- --test-threads=4 with XCL_DXC_DIR set to DXC 1.9.2609.5: 1454 passed, 3 failed, 47 ignored. The 3 failures are tests that fail on main c2ee10e4 itself (1453 passed, 3 failed, 47 ignored there, same command): test_title_draws_with_a_root_signature_under_the_debug_layer, test_title_runs_and_game_folder_is_untouched, test_title_runs_under_the_debug_layer_with_dred.
  • SKIPPED on this adapter: 27 (no wave64: 21, per-lane f16 form refused: 3, no dxc.exe: 1, cannot disable the driver cache (Windows Developer Mode is required): The application requested an operation that depend: 1, no heap windows: 1).

Regression run
A commit of main (b49be183, the last one before the shader preparation of #2555, which prepares every record before the title and does not fit a 60 s run):

xcl-smoke v1
commit: b49be1836844fe0b0cdb3211dce3cb7fb4e21ac7
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 363 (PresentX 363)
presents per 2 s (last 3): 16 17 16
device removals: 0
crashes: 0
peak commit: 15320 MB

This PR's head (with XCL_PREPARE=0, the switch of this PR):

xcl-smoke v1
commit: 8617577b67c3b2c67542ff3d47d6e631967c16c6
gpu: NVIDIA GeForce RTX 3060 Ti
title: 419239bf
seconds: 60
exit: 0x0
frames shown: 419 (PresentX 419)
presents per 2 s (last 3): 16 14 12
device removals: 0
crashes: 0
peak commit: 15456 MB

Not tested

  • The preparation itself with the switch unset: unchanged code path, not run here (the smoke below sets the switch, which is what makes it fit 60 s).

AI use
Claude Code (Claude Opus 5.5) wrote the code, ran the suite and the regression runs on the hardware above, and wrote this description; Prime asked for it and owns the account. We coordinate the 8 GB work on the XCL Discord too: https://discord.gg/gK3y7WRRY

🤖 Generated with Claude Code

Since xcl-dev#2555 every start on main runs the shader preparation before the
title's code, and it has no way out: on a retail title with a shader pack
of 26,503 records and a cold cache that is hours on an RTX 3060 Ti, for a
look at a change that needs a minute of play, and a regression run of
main or of a PR's head sits through it first. nvidia-dev has the switch
(present/preparation.rs, the same place): with XCL_PREPARE=0 the
preparation is left out and the title builds the shaders it uses as it
goes, standing still for those builds, as before xcl-dev#2555. Unset, or any
other value, prepares as now.

Test: only_xcl_prepare_0_leaves_the_preparation_out. README: the switch,
next to the preparation's description.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@luckyteagirl luckyteagirl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the XCL_PREPARE=0 check run before probing shaders.rpf? The archive existence check uses try_exists()?, so a filesystem error aborts startup before the opt-out is read. The host exits on any error from before_guest, even though skipping shader preparation needs no access to the archive.

I reproduced this on Windows with a scratch directory where shaders.rpf is a junction in a loop. A CPU-only harness using the PR's branch order returned Windows error 1921 with the opt-out set. Checking the opt-out first returned success for 0 and still returned error 1921 when the variable was unset. This exercises the filesystem probe and branch order. It does not launch a title.

Preparation branch · Host error handling

AI-assisted review (GPT-6.2 Sol).

@A1wace-dev

Copy link
Copy Markdown

I checked the startup path with XCL_PREPARE unset, set to 0, and set to 1 on both the PR and its exact parent. On the PR, only 0 bypassed shader preparation. The default and 1 still discovered the bundled shader and entered preparation.

Tested

Windows 11 build 26300.9711, Core Ultra 7 265KF, RTX 5080 (driver 617.42), Rust 1.100.0 MSVC, debug. Both clean checkouts built with cargo build --workspace --locked --offline.

XCL_PREPARE Main c2ee10e4e905eb736e56953c52b749e18bcc7ede PR 8617577b67c3b2c67542ff3d47d6e631967c16c6
Unset Entered preparation Entered preparation
0 Entered preparation Skipped preparation
1 Entered preparation Entered preparation

I used XCL's bundled synthetic title and the same loose shader as test_title_runs_and_game_folder_is_untouched. Each invocation of xcl run <fixture> -- --hello started with its own data and DXIL cache directories. In the preparation runs, stdout listed one shader to precompile and the preparation window handle matched the swap-chain window. For the PR with 0, the log recorded the opt-out, there was no precompile line or preparation window, and the title still created a swap chain.

I ran each combination three times. All 18 runs exited 0, the test title reported zero failures, and a before/after SHA-256 snapshot showed the game directory was unchanged.

The PR's only_xcl_prepare_0_leaves_the_preparation_out unit test also passed (1 passed, 0 failed, 0 ignored).

Not tested

Retail titles, startup performance with a large shader pack, and the full workspace test suite.

AI use

OpenAI Codex (GPT-6 family, exact serving variant unavailable) built both revisions, scripted and ran the comparison, and drafted this report.

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.

3 participants