Size thread pools by the CPUs of the process's affinity mask

Eight places sized a pool (pipeline workers, library prebuild, translator prewarm and seeding, the multithreaded ASTC decoder) by GetActiveProcessorCount, every logical processor of the machine. A process limited with start /affinity, Task Manager or a launcher then started a pool for 16 CPUs on 4. plat_cpu_usable counts the affinity mask (all active processors for a process that spans processor groups); plat_cpu_count, the machine's count, stays for the system info. Idea from MMadmer's UsableCpuCount in a fork of the Shadow of the Colossus PC port.
This commit is contained in:
Lucas-blip-png committed 2026-10-31 04:51:14 -04:00
1 parent adf9c768c3
commit 91c5312932
6 files changed
+24 -9

No files matched your search

+2 -1
View File
@@ -18,6 +18,7 @@
#include "fs.h"
#include "gfx.h"
#include "nvn_api.h"
#include "platform/platform.h"
#include "vk.h"
#define SYM_INIT_START "_ZN2nn4init5StartEmmPFvvES2_S2_"
@@ -326,7 +327,7 @@ static DWORD WINAPI prewarm_main(void *arg) {
vk_pipeline_prewarm();
const char *prep = cfg_get("TOTK_TEST_PREPARE_SHADERS"); // Task 2.3 test hook; Task 2.6 builds the preparation
if (prep && !strcmp(prep, "1")) {
int cpus = (int)GetActiveProcessorCount(ALL_PROCESSOR_GROUPS);
int cpus = (int)plat_cpu_usable();
gfx_shader_prepare_recorded(cpus, cpus / 2 > 16 ? 16 : cpus / 2 < 1 ? 1 : cpus / 2);
}
return 0;