mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 09:09:56 -04:00
Keep serving the previous translator's shader translations after a translator update, and translate them again in the background.
Every shader cache key names the translator, so a release with a new translator had no cached translation at all: the launcher re-translated about 42,000 programs before play, and play waited for any program not prepared. The cache now lists the translator identities it holds translations of in shader-cache/identities.txt, newest first. A shader the current translator has no translation of uses a previous one's, looked up with that identity mixed with this machine's host options and read with the usual checks; it keeps that translation for the rest of the session, so no pipeline is built twice. After the boot prewarm a background pass translates every stored input that has a previous translator's entry again under the current one, on its own translator child at idle priority that waits while the game translates. A program the new translator refuses keeps its old translation and is logged. Once the pass has gone through every such input, the old entries of what it covered are dropped: loose files are deleted, and a pruned copy of shader-cache.pack replaces the pack at the next start when the pack is still the one it was copied from. --prepare-shaders still translates everything under the current translator. NX2NAVI_SHADER_CARRY=0 keeps the earlier behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,8 +62,13 @@ const uint8_t *gfx_shader_input_id(const GfxShader *s); // the 32-byte input
|
||||
// By input id from memory or disk; xlate 1 also translates it from its stored inputs. NULL if absent.
|
||||
const GfxShader *gfx_shader_load_input(const uint8_t iid[32], int xlate);
|
||||
// Boot prewarm: out[i] = gfx_shader_load_input(iids[i], 1) on `threads` threads with up to `procs` translators, then
|
||||
// every other stored input not cached under this translator is translated. Logs progress and the total.
|
||||
// every other stored input not cached under this translator is translated (one a previous translator's translation
|
||||
// serves is left to gfx_shader_carry_start's pass). Logs progress and the total.
|
||||
void gfx_shader_prewarm(const uint8_t (*iids)[32], size_t n, const GfxShader **out, int threads, int procs);
|
||||
// After the boot prewarm of a game run (boot.c): when the shader cache holds translations of a previous translator
|
||||
// (NX2NAVI_SHADER_CARRY), starts the background pass that translates them again under the current one for the next
|
||||
// start and then drops the old ones (gfx_shader.c, "Carry").
|
||||
void gfx_shader_carry_start(void);
|
||||
// How far the running (or last) gfx_shader_prewarm is: shaders done of total, and how many of them it translated (the
|
||||
// rest were cached). Any thread; the numbers lag the workers by at most 100 ms.
|
||||
void gfx_shader_prewarm_progress(int64_t *done, int64_t *total, int64_t *translated);
|
||||
|
||||
Reference in New Issue
Block a user