mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 12:29:57 -04:00
Stop the replay from searching the environment on every draw, remember setting lookups, and spread texture streaming over more frames.
The draw path called getenv("NX2NAVI_SKIP_PROG") for each of ~2,000 draws a frame, and getenv walks the whole environment block: in a replay-thread profile it was a sixth of the samples. That switch, the polygon offset log and the ASTC alpha probe now read the environment once. The replay's cost per draw went from 3.7-5.0 us to 1.2-2.8 us in play, and the mean frame rate by minute from 60-131 fps to 103-243 fps (different places in each run, so the figures are approximate).
cfg_get and cfg_value keep each thread's answers per name until the settings version changes (cfg_set, cfg_reset, cfg_load, and cfg_setenv, which the code that sets NX2NAVI_ variables in the process's own environment now uses); NX2NAVI_CFG_MEMO=0 asks every time.
The texture pool creates at most pool_create_budget (NX2NAVI_POOL_CREATE_BUDGET, default 16, was a fixed 64) new texture entries per refresh. The refresh holds the texture lock throughout, and streaming new textures in made 20-40 ms frames; at 16 the lock was held 5 ms per slow frame instead of 24 in a dense area, and the frames over 25 ms in a heavy minute fell from 111-188 to 89, with no pop-in seen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -243,7 +243,7 @@ static char *lang(void) {
|
||||
return s;
|
||||
}
|
||||
|
||||
static void set_env(const char *name, const char *value) { plat_setenv(name, value); } // NULL removes it
|
||||
static void set_env(const char *name, const char *value) { cfg_setenv(name, value); } // NULL removes it
|
||||
|
||||
static void probe_oe(void) {
|
||||
char *keep_lang = cfg_get("NX2NAVI_LANG") ? strdup(cfg_get("NX2NAVI_LANG")) : NULL;
|
||||
@@ -956,9 +956,9 @@ static void probe_main(Cpu *c) {
|
||||
static uint32_t run_child(const char *mode, const char *env, char *out, size_t cap) {
|
||||
char name[64] = "";
|
||||
const char *eq = env ? strchr(env, '=') : NULL;
|
||||
if (eq) snprintf(name, sizeof name, "%.*s", (int)(eq - env), env), plat_setenv(name, eq + 1);
|
||||
if (eq) snprintf(name, sizeof name, "%.*s", (int)(eq - env), env), cfg_setenv(name, eq + 1);
|
||||
int code = plat_run_self(CHILD_ENV, mode, out, cap, 0);
|
||||
if (eq) plat_setenv(name, NULL);
|
||||
if (eq) cfg_setenv(name, NULL);
|
||||
if (code < 0) rt_fatal("probe-services: cannot start the %s child", mode);
|
||||
return (uint32_t)code;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user