mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-16 15:59:59 -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:
@@ -1835,6 +1835,10 @@ void plat_child_stop(PlatChild *c) {
|
||||
free(c);
|
||||
}
|
||||
|
||||
void plat_child_lower(PlatChild *c) { // a higher nice value needs no privilege
|
||||
if (c) setpriority(PRIO_PROCESS, (id_t)c->pid, 19);
|
||||
}
|
||||
|
||||
// A child that died makes the write fail with EPIPE; SIGPIPE is ignored for the process (main.c), as Windows has none.
|
||||
int plat_child_write(PlatChild *c, const void *data, size_t n) { return write_all(c->in, data, n); }
|
||||
|
||||
|
||||
@@ -459,6 +459,9 @@ typedef struct PlatChild PlatChild;
|
||||
// Children start one at a time so none inherits another pipe ends.
|
||||
PlatChild *plat_child_start(const char *exe, const char *arg, uint32_t *err);
|
||||
void plat_child_stop(PlatChild *c); // kills the child and frees c
|
||||
// Runs the child below every normal-priority process (Windows: the idle priority class; elsewhere nice 19), for work
|
||||
// that must not slow the game down (gfx_shader.c, the carry pass).
|
||||
void plat_child_lower(PlatChild *c);
|
||||
int plat_child_write(PlatChild *c, const void *data, size_t n); // 1 when all n bytes were written
|
||||
#define PLAT_CHILD_READ_MS 120000 // plat_child_read gives up on a child that sends nothing for this long
|
||||
long plat_child_read(PlatChild *c, void *buf, size_t cap); // bytes read (at least 1); 0 or negative: pipe broke or timed out
|
||||
|
||||
@@ -1913,6 +1913,10 @@ void plat_child_stop(PlatChild *c) {
|
||||
free(c);
|
||||
}
|
||||
|
||||
void plat_child_lower(PlatChild *c) {
|
||||
if (c) SetPriorityClass(c->proc, IDLE_PRIORITY_CLASS);
|
||||
}
|
||||
|
||||
int plat_child_write(PlatChild *c, const void *data, size_t n) {
|
||||
DWORD put = 0;
|
||||
return WriteFile(c->in, data, (DWORD)n, &put, NULL) && put == n;
|
||||
|
||||
Reference in New Issue
Block a user