Skip to content

xcl run: prepare shaders in the game window before title execution - #2555

Open
bmjask wants to merge 3 commits into
xcl-dev:mainfrom
bmjask:shaders/startup-preparation
Open

bmjask wants to merge 3 commits into
xcl-dev:mainfrom
bmjask:shaders/startup-preparation

Conversation

@bmjask

@bmjask bmjask commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Part of #2508. Titles with a discoverable shader pack or loose shader containers can spend their first draws waiting for known compute pipelines. Run the existing precompiler on each graphical launch before the host maps or executes the title. The D3D12 presenter owns the same game window throughout preparation and gameplay.

What is in it

  • A dark preparation view in the presentation HWND reports processed records and holds at 99% until workers finish successfully. It shows seconds without a completed record and elapsed time since recovery from a gap of at least five seconds.

  • Prepare supported stages and compute pipelines for root shaders.rpf and shaders/**/*.dxbc, including the chain-root whole form for split compute shaders. Reuse the runtime cache. A compile failure or cancellation stops the launch.

  • With presentation off, preparation runs headlessly. Null-renderer runs and titles without either input retain their existing launch behavior. Graphics PSOs requiring runtime state are still created during play.

  • For a cold full pack, scripts/smoke.ps1 -StartupTimeoutSeconds sets the extra launcher allowance. Its default is still 120 seconds and the smoke block still reports guest measurement time.

Tested

  • NVIDIA GeForce RTX 4090, driver 610.88, Intel Core i9-12900K, Windows x64, rustc 1.100.0.

  • Clean head 5bec5877: cargo build --locked --workspace and cargo build --locked --release -p xcl --bin xcl succeeded. cargo test --locked --workspace --no-fail-fast -- --test-threads=4 --show-output: 1,427 passed, 0 failed, 46 ignored. 25 explicit GPU skip messages across 15 tests (wave size, unsupported per-lane forms and heap-fallback configuration).

  • Local cold and warm launches of the repository test title with one split compute shader both completed with zero failed title checks. The same HWND was used for preparation and swap-chain creation on each launch (cold 0xd60f6e, warm 0x14e0380). The cold pass built two pieces and the whole pipeline; the warm process loaded 3/3 blobs.

  • The repository e2e title test now compares the preparation HWND with the HWND passed to the successful DXGI swap-chain creation. The HWND identity test passed in the clean full-suite run. An additional WM_CLOSE check on a local fixture stopped before guest execution and exited with code 2. On the full archive we visually verified the progress bar and timer in the shared game window.

Regression run

main:


xcl-smoke v1

commit: e1d84b7d9153f86a97d2ec5d209d196046fc0bea

gpu: NVIDIA GeForce RTX 4090

title: 6ca5cab7

seconds: 60

exit: 0x0

frames shown: 1020 (PresentX 1020)

presents per 2 s (last 3): 47 47 41

device removals: 0

crashes: 0

peak commit: 15910 MB

PR: the standard scripts/smoke.ps1 -Seconds 60 run at clean head defe7ef1 reached the preparation view and its 180-second process deadline while processing 26,503 records. The launcher and host exited before guest execution; the script emitted no smoke block. The end-to-end retail regression requirement remains open.

Not tested

  • Hardware other than the RTX 4090, archive formats outside the documented sources, and full-archive completion through the first real-title frame. No world-entry speedup is claimed.

AI use

  • Codex, GPT-6, implemented the change, wrote tests, ran local checks and drafted this description.

Count completed records in the offline shader path and display progress while the launcher waits for the worker. Warm both pieces and the whole compute fallback for split records. A cancelled or unsuccessful pass leaves the host unstarted.
Keep the guest behind the preparation gate in the host. The presenter owns its window throughout warm-up and swap-chain creation. Let its message thread draw progress and handle cancellation until the guest is ready. Leave the runtime clock and input timing anchored to title startup.
@bmjask bmjask changed the title xcl run: show shader preparation before starting the title xcl run: prepare shaders in the game window before title execution Nov 25, 2026
@bmjask
bmjask marked this pull request as ready for review November 25, 2026 23:05
The host starts the measured title interval only after the shader gate succeeds. Let a full-pack run specify a longer launcher deadline and record that setting in the evidence manifest. Keep the default timeout and regression block unchanged.
@DavidM1911

Copy link
Copy Markdown
Contributor

Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

Thanks!

— Devin

@DavidM1911

Copy link
Copy Markdown
Contributor

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

@SlopTart

Copy link
Copy Markdown

Tested: current PR head merged onto current origin/main (clean), Linux (Arch, kernel 7.2.15), Mesa 26.2.5 RADV, Radeon RX 7900 XT (NAVI31), cargo target x86_64-pc-windows-gnu run under wine-11.0 (Proton), rustc 1.94.0, vkd3d-proton 3.1 with the XCL patch, official MS DXC (binaries 2026-09-29).

gpu_ suite (cold cache): 165 passed / 3 failed, no crashes. The three are the known baseline on this lane (seed-1003 fuzz, mad/mac contraction, promoted-UAV-clear driver gap, PR #2490); none caused by this PR.
Targeted run of clock_advances_during_a_stall_and_remembers_recovery, close_before_the_ready_message_cancels_the_handoff, only_a_successful_join_releases_the_last_percent: 3 passed. Timing note: verified against this head on 2026-11-26; the PR has since gone unmergeable as upstream moved, results refer to the tested head. Real title execution and the game-window handoff itself are outside this lane; the state-machine tests around it run here.

Not tested: retail titles (no title data on this lane, counts only).

AI use: Hermes agent (local Qwen-class) ran both machines and drafted this; I checked it before posting.

Royalflamejlh pushed a commit to Royalflamejlh/xcl that referenced this pull request Nov 26, 2026
… the game window

Taken as it is at 5bec587 for a test on a title. One conflict in
shaders.rs: the fork's slice of the shader list and its rodata option
are kept with the pull request's counting of records and errors.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Royalflamejlh pushed a commit to Royalflamejlh/xcl that referenced this pull request Nov 26, 2026
The driver builds about two pipelines at a time for one process, so the
preparation before a title (xcl-dev#2555) stood for minutes on each stretch of
large compute programs. The stages are still translated in the host;
the compute pipelines are built by worker processes of the same program,
each on its own slice of the records: the processors less two, 16 at
most, 3 GB of the commit left for each (XCL_PREPARE_WORKERS; 1: as
before). With a list of the pipelines an earlier run used, only those
are built before the title starts. A worker that fails is logged and the
title starts; a worker ends when the host does. A worker reports every
record while a title waits on it, and the host logs its progress every
5 s.

Measured on a retail title, RTX 5090, 32 threads: the first 92 % of the
steps in 85 s (one process: 84 % of one pass after several minutes).

Co-Authored-By: Claude Fable 5.2 <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 startup shader preparation use the title's adapter fallback? On main, a configured adapter that no longer matches any device produces a warning and falls back to automatic selection. With a shader pack present on this head, Pipelines::for_adapter returns an error for the same setting and the host exits before the title can use that fallback. A launch fixture with shader input, an unmatched adapter name, and an available automatic adapter would cover the regression. The standalone shader CLI can keep reporting a selector mismatch.

Source review at 5bec587753ddf8234193f0f8bb6d6f367315c36d. No title run. AI-assisted review with Codex (GPT-6.2 Sol).

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.

4 participants