upleb.uk

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

summaryrefslogtreecommitdiff
path: root/Build-Shaders.cmd
blob: 568c16d8bdb95c429e27e3bcb4f2506c4a3e8d75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
@echo off
rem Makes every shader and every pipeline of the title ahead of play (the program's own "warm"), so that a
rem session starts with nothing left to compile. ASCII only.
rem
rem   Build-Shaders.cmd                         the title's executable is looked for as play looks for it
rem   Build-Shaders.cmd <title exe>             ... or given
rem   Build-Shaders.cmd <title exe> <options>   the SAME options you give "play" (--res, --series-s, --set NAME=VALUE):
rem                                             pipelines are made for the settings a session will have
rem   Without options: --res 1080to1440, the settings the README's numbers are measured with.
rem
rem   More options of the program's own (victory warm --help):
rem     --used        only the pipelines earlier sessions drew with (a few minutes)
rem     --jobs N      processes at once (default: every logical core)
rem     --verify      makes nothing: asks for what was made once more and counts what came from where
rem
rem How long (measured on a GeForce RTX 4070 with 28 threads): about 20 minutes the first time for all
rem of about 83,500 pipelines; about 12 minutes when most are already in the pipeline library; --used
rem about 3 minutes. It can be stopped with Ctrl+C and started again: what is made stays made.
rem
rem Three things that matter:
rem  1. Run it with the SAME victory.exe, in the SAME folder, that you play with. The graphics driver keeps
rem     its own shader cache by the program's path: the same pipelines took 11 seconds to load from the
rem     path they were made from and about 1,100 seconds from another.
rem  2. Run it from a normal window, not as administrator (the driver then keeps its cache elsewhere).
rem  3. It uses every core and up to 0.7 GB of memory a process. Close the game first. It starts no further
rem     process while less than about 8 GB of memory is free and stops below 3 GB (--min-free-mb).
setlocal EnableExtensions DisableDelayedExpansion

set "runner=%VICTORY_EXE%"
if not defined runner set "runner=%~dp0target\release\victory.exe"
if not exist "%runner%" set "runner=%~dp0victory.exe"
if not exist "%runner%" (
  echo No victory.exe found. Build it first: cargo build --release --locked -p victory 1>&2
  echo ^(or set VICTORY_EXE to the one you play with^) 1>&2
  exit /b 2
)

set "title="
if not "%~1"=="" (
  set "first=%~1"
  setlocal EnableDelayedExpansion
  if not "!first:~0,2!"=="--" (
    endlocal
    set "title=%~1"
    shift
  ) else (
    endlocal
  )
)
if defined title if not exist "%title%" (
  echo No such file: %title% 1>&2
  exit /b 2
)

set "options="
:collect
if "%~1"=="" goto :collected
set "options=%options% %1"
shift
goto :collect
:collected
if not defined options set "options= --res 1080to1440"

echo Making the title's shaders and pipelines ahead of play.
echo   program: %runner%
if defined title echo   title:   %title%
echo   options:%options%
echo.
if defined title (
  "%runner%" warm%options% "%title%"
) else (
  "%runner%" warm%options%
)
set "code=%errorlevel%"
echo.
if "%code%"=="0" (echo Done. Start the game as usual.) else (echo Ended with code %code%. Run it again to go on where it stopped.)
exit /b %code%