mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 06:09:58 -04:00
Pack the shader cache after the launcher prepares the shaders, as the installer did.
The launcher builds through tools/make_game.py, whose shaders step never ran tools/pack_shader_cache.py, so a launcher install keeps about 175,000 loose files (4.9 GB) in shader-cache/. The game looks them up one by one at every start and reads the use masks of 42,000 of them for 20 s after it. make_game.py now packs the cache after the preparation; a failure is reported and the build goes on, since the game still reads loose files. The kit and the launcher ship the tool.
This commit is contained in:
committed by
chrg6
parent
59069502f3
commit
6589476872
@@ -1412,6 +1412,27 @@ def step_shaders(out, update=False):
|
||||
'meets them. Run the build again to retry this step')
|
||||
for seed in ('seed-programs.bin', 'seed-answers.bin'): # translated now: the shader cache holds them
|
||||
(out / seed).unlink(missing_ok=True)
|
||||
pack_shader_cache(out)
|
||||
|
||||
|
||||
def pack_shader_cache(out):
|
||||
"""The prepared shader cache folded into shader-cache/shader-cache.pack (tools/pack_shader_cache.py): the
|
||||
preparation leaves four files per shader, about 175,000 for the whole game, which the game looks up one by one at
|
||||
every start (gfx_shader.c gfx_shader_prewarm, the use masks read after it) and which are slow to scan, copy and
|
||||
back up. The game reads the pack first and the loose files after it, so a cache left unpacked still works: a
|
||||
failure here is said and the build goes on."""
|
||||
tool = KIT / 'tools' / 'pack_shader_cache.py'
|
||||
if not tool.is_file() or not (out / 'shader-cache').is_dir():
|
||||
return
|
||||
t0 = time.monotonic()
|
||||
r = subprocess.run([sys.executable, '-u', str(tool), str(out / 'shader-cache')], stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT, text=True, encoding='utf-8', errors='replace')
|
||||
for line in r.stdout.splitlines():
|
||||
say(' ' + line)
|
||||
if r.returncode:
|
||||
say(f' packing the shader cache failed (code {r.returncode}); the game reads the loose files instead')
|
||||
else:
|
||||
say(f' shader cache packed in {time.monotonic() - t0:.0f} s')
|
||||
|
||||
|
||||
def prompt_art_dir():
|
||||
|
||||
Reference in New Issue
Block a user