Stop flushing the shader cache files every read checks, so shader preparation translates twice as fast.

Each translation flushed its .spv and .res.json to the disk, wrote its .use mask with a flushed, written-through
rename and renamed its outputs written through: about six waits for the drive per shader. An NVMe drive does about
1,100 flushed files a second, a SATA SSD or a hard drive far fewer, so the translators sat mostly idle. Every read
already checks these files (spirv_complete, reflection_valid, the .use magic and size) and a torn one is translated
again, so they are now written whole but not flushed (plat_file_write_cached, plat_file_replace without durable).
The .in files stay flushed: they hold the guest's code and only their header and size are checked.

4,683 shaders of the install's preparation on a Ryzen 7 7700X and a Samsung 990 PRO: translation 36.4 and 37.2 s
before, 18.4 and 18.9 s after; every .spv, .res.json, .use and .in file and shader-prepared.bin are the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xyzzyy
2026-11-08 20:38:24 -04:00
committed by chrg6
parent 6c971b790e
commit a4ee74b74e
5 changed files with 42 additions and 17 deletions

View File

@@ -123,7 +123,7 @@ static void log_open(int game) {
if (i > 1) snprintf(from, sizeof from, "%s/nx2navi.%d.log", dir, i - 1);
else snprintf(from, sizeof from, "%s/nx2navi.log", dir);
snprintf(to, sizeof to, "%s/nx2navi.%d.log", dir, i);
if (plat_file_exists(from)) plat_file_replace(from, to);
if (plat_file_exists(from)) plat_file_replace(from, to, 1);
}
snprintf(g_log_path, sizeof g_log_path, "%s/nx2navi.log", dir);
g_log_file = plat_append_open(g_log_path);