upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/Build-Shaders.cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Build-Shaders.cmd')
-rw-r--r--Build-Shaders.cmd77
1 files changed, 77 insertions, 0 deletions
diff --git a/Build-Shaders.cmd b/Build-Shaders.cmd
new file mode 100644
index 0000000..568c16d
--- /dev/null
+++ b/Build-Shaders.cmd
@@ -0,0 +1,77 @@
1@echo off
2rem Makes every shader and every pipeline of the title ahead of play (the program's own "warm"), so that a
3rem session starts with nothing left to compile. ASCII only.
4rem
5rem Build-Shaders.cmd the title's executable is looked for as play looks for it
6rem Build-Shaders.cmd <title exe> ... or given
7rem Build-Shaders.cmd <title exe> <options> the SAME options you give "play" (--res, --series-s, --set NAME=VALUE):
8rem pipelines are made for the settings a session will have
9rem Without options: --res 1080to1440, the settings the README's numbers are measured with.
10rem
11rem More options of the program's own (victory warm --help):
12rem --used only the pipelines earlier sessions drew with (a few minutes)
13rem --jobs N processes at once (default: every logical core)
14rem --verify makes nothing: asks for what was made once more and counts what came from where
15rem
16rem How long (measured on a GeForce RTX 4070 with 28 threads): about 20 minutes the first time for all
17rem of about 83,500 pipelines; about 12 minutes when most are already in the pipeline library; --used
18rem about 3 minutes. It can be stopped with Ctrl+C and started again: what is made stays made.
19rem
20rem Three things that matter:
21rem 1. Run it with the SAME victory.exe, in the SAME folder, that you play with. The graphics driver keeps
22rem its own shader cache by the program's path: the same pipelines took 11 seconds to load from the
23rem path they were made from and about 1,100 seconds from another.
24rem 2. Run it from a normal window, not as administrator (the driver then keeps its cache elsewhere).
25rem 3. It uses every core and up to 0.7 GB of memory a process. Close the game first. It starts no further
26rem process while less than about 8 GB of memory is free and stops below 3 GB (--min-free-mb).
27setlocal EnableExtensions DisableDelayedExpansion
28
29set "runner=%VICTORY_EXE%"
30if not defined runner set "runner=%~dp0target\release\victory.exe"
31if not exist "%runner%" set "runner=%~dp0victory.exe"
32if not exist "%runner%" (
33 echo No victory.exe found. Build it first: cargo build --release --locked -p victory 1>&2
34 echo ^(or set VICTORY_EXE to the one you play with^) 1>&2
35 exit /b 2
36)
37
38set "title="
39if not "%~1"=="" (
40 set "first=%~1"
41 setlocal EnableDelayedExpansion
42 if not "!first:~0,2!"=="--" (
43 endlocal
44 set "title=%~1"
45 shift
46 ) else (
47 endlocal
48 )
49)
50if defined title if not exist "%title%" (
51 echo No such file: %title% 1>&2
52 exit /b 2
53)
54
55set "options="
56:collect
57if "%~1"=="" goto :collected
58set "options=%options% %1"
59shift
60goto :collect
61:collected
62if not defined options set "options= --res 1080to1440"
63
64echo Making the title's shaders and pipelines ahead of play.
65echo program: %runner%
66if defined title echo title: %title%
67echo options:%options%
68echo.
69if defined title (
70 "%runner%" warm%options% "%title%"
71) else (
72 "%runner%" warm%options%
73)
74set "code=%errorlevel%"
75echo.
76if "%code%"=="0" (echo Done. Start the game as usual.) else (echo Ended with code %code%. Run it again to go on where it stopped.)
77exit /b %code%