Scripts: add .env configuration support and launcher scripts #1389
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1399"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by WTactic on 2026-11-24T15:37:48Z.
Allows developers to configure local paths and environment settings (such as
GAME_PATH,XCL_DXC_DIR,XCL_DXC_THREADS, memory throttle overrides, and test thread limits) centrally inscripts/.envrather than manually passing repetitive command-line parameters.What is in it
.gitignore: ignores local.envfiles across the tree.scripts/.env.example: template documenting available configuration variables (GAME_PATH,XCL_DXC_DIR,XCL_DXC_THREADS,XCL_MEMORY_RESERVE_GB,XCL_MEMORY_WAIT_SECS,SMOKE_SECONDS,TEST_THREADS).scripts/smoke.ps1: loads defaults fromscripts/.env, allowing execution without mandatory-Gameargument whenGAME_PATHis defined.scripts/test.ps1: loads settings fromscripts/.env, supporting configurableTEST_THREADS.scripts/test-native-stderr.tests.ps1: initializes environment defaults fromscripts/.env.scripts/run-game.ps1: generic helper script to launch any title with active.envconfiguration.scripts/precompile-shaders.ps1: generic utility to precompile game shaders into the disk cache.Tested
rustc 1.97.1 (8bab26f4f 2026-07-14)powershell -ExecutionPolicy Bypass -File .\scripts\test-native-stderr.tests.ps1: passed (exit code 0)cargo test --workspace -- --test-threads=4: 741 passed, 0 failed, 41 ignoredSKIPPEDGPU tests on this adapter:gpu::recomp::tests::gpu_geometry_wave32_prefix_count_over_a_mask: no wave64gpu::recomp::tests::gpu_wave32_program_in_wave64_hardware: no wave64scripts/smoke.ps1runs without-Gameargument, picking upGAME_PATHfromscripts/.env.Regression run
Not applicable: this PR modifies only scripts and
.gitignore, with zero changes tocrates/xcl/src.Not tested
AI use
Imported from ivall/xcl. Originally posted by futurepro62 on 2026-11-24T16:52:43Z.
Script check for this PR, since it has no test report yet. Tested exact head
ed4d8d6.Tested
powershell.exe -NoProfile -File scripts/test-native-stderr.tests.ps1at the head: exit 0.main's scripts: also exit 0, as expected. The PR changes this test only so that it loads.envand finds its folder without$PSScriptRoot. It doesn't test the new behaviour..envloading (smoke.ps1,test.ps1,precompile-shaders.ps1,run-game.ps1). One thing to note: the test file now loadsscripts/.envor the repo-root.envinto its own process first. On a machine that has a.env, the test then runs with the developer's settings rather than a clean environment.Not tested
run-game.ps1,precompile-shaders.ps1andsmoke.ps1with a real.env, because I have no title to run them against.AI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-24T17:01:43Z.
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~21 ignored.Thanks!
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T15:35:51Z.
I’ll check the .env defaults and the new launch helpers on this head using a synthetic native executable, so the child arguments, environment precedence and exit codes are observable without a game. Testing
1746a9e2dawith OpenAI Codex (GPT-6).Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T15:52:55Z.
Tested
1746a9e2da8be8c2e0df46d7f5320c072566e003on Windows 11 with Windows PowerShell 5.1 and PowerShell 7.6.9. When a fixture xcl.exe returned 23, both run-game.ps1 and precompile-shaders.ps1 reported success to the caller. Exit 0 can cause an automation to treat a failed launch as successful.I pushed a fix and regression tests to the
RavenCurseBurg/xclfork, branchscripts/propagate-launch-helper-exits, commit0bb5997ace40ed3c3d411f271323a22c1dc15ef2. After the fix both scripts returned 23. When a stub build failed with 17, run-game.ps1 stopped before launch and returned 17. The new regression test and the existing native-stderr tests passed in both shells. All 16 independent checks for environment precedence, paths with spaces, arguments and exit codes passed.Tests used disposable files and native fixtures. No games or GPU workload. OpenAI Codex (GPT-6) ran the checks and prepared the patch and report.
Rebase for the reported smoke conflict
I reproduced the conflict between
1746a9e2da8band mainb49be1836844in the parameter list ofscripts/smoke.ps1. I preserved this PR's optional game, duration and launcher parameters alongside main's-OutDir. Rebased author commit. The second commit also carries the previous launch-helper exit-code fix as a separate commit. Main is an ancestor of the rebased series.I ran
launch-helpers.tests.ps1,test-native-stderr.tests.ps1,test-smoke-artifacts.tests.ps1andsmoke-title.tests.ps1on that second commit under Windows PowerShell 5.1 and PowerShell 7. All eight runs exited 0. Four additional CLI runs combined-OutDirwith a private.envand a stand-in launcher emittingsee the log:. Both shells honored the configured game and duration, then the explicit overrides, and preserved the synthetic log and report bytes in the saved artifacts. No game, GPU workload or workspace build. OpenAI Codex (GPT-6) prepared the rebase and ran the checks.I also checked review 6069065597 on this series. Neither memory variable is read by the Rust runtime. The example assigned both, and the launcher echoed the unused reserve value beside the effective thread count. A separate third commit removes those assignments and the reserve banner field.
git grep -n -E 'XCL_MEMORY_(RESERVE_GB|WAIT_SECS)' -- crates scriptshas no remaining matches. I reranlaunch-helpers.tests.ps1withXCL_DXC_THREADS=2; all three cases passed in each shell. The third commit changes launcher text and configuration examples only.Imported from ivall/xcl. Originally posted by luckyteagirl on 2026-11-26T05:38:35Z.
Review: COMMENTED
Could the template omit
XCL_MEMORY_RESERVE_GBandXCL_MEMORY_WAIT_SECSuntil the DXC admission code reads them? At this head, neither variable is consumed by XCL:dxc.rsinitializes its reserve to 6 GiB, offline precompile sets it internally to 2 GiB, and the memory wait has fixed behavior. Copying the example therefore does not uncap workers or make admission immediate as its comments promise.run-game.ps1also prints a reserve value it has not applied. Removing the entries and display would keep the example accurate. Source review at exact head1746a9e2da8be8c2e0df46d7f5320c072566e003; no runtime test. AI-assisted review with Codex.Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-26T05:13:13Z.
Re-verification on RTX 3060 Ti (Windows 11): still a merge conflict with current
mainon the new head — needs another rebase before it can be tested.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T05:37:50Z.
Triage (#1607) – head
1746a9eNo open or merged PR adds .env support to the scripts (#1500 is a separate preset launcher, not the same change).
Problems in the diff: scripts/.env.example sets XCL_MEMORY_RESERVE_GB and XCL_MEMORY_WAIT_SECS, which nothing in crates/ reads (the reserve on main is the RESERVE_GB static in dxc.rs), so those lines and the run-game.ps1 'Memory Reserve' print do nothing. main now has its own scripts/precompile-shaders.ps1 (-Package , -Pipelines, ...); this PR adds a file at the same path with a different interface, which is the conflict and would replace the existing script.
smoke.ps1 and test.ps1 now pull any XCL_* variable from a local .env, so a smoke block can be produced with switches that are not visible in the command; precompile-shaders.ps1/run-game.ps1 overwrite already-set variables while smoke.ps1/test.ps1 do not.
Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.