Browse Source

Merge pull request #108969 from adamscott/patch-the-editor

[Web] Fix the editor `{godot,emscripten}PoolSize` config values
Thaddeus Crews 1 tháng trước cách đây
mục cha
commit
73d3d2f2ff
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      misc/dist/html/editor.html

+ 6 - 0
misc/dist/html/editor.html

@@ -674,6 +674,10 @@ function startEditor(zip) {
 		}
 		}
 	}
 	}
 
 
+	const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
+	// We need at least 6 free threads from the pool to start the editor.
+	// At least 4 more will be reserved for the godot thread pool (3 is the bare minimum with the multithreaded variant of the servers).
+	const concurrency = clamp(navigator.hardwareConcurrency ?? 1, 12, 24);
 	const editorConfig = {
 	const editorConfig = {
 		'unloadAfterInit': false,
 		'unloadAfterInit': false,
 		'onProgress': function progressFunction(current, total) {
 		'onProgress': function progressFunction(current, total) {
@@ -700,6 +704,8 @@ function startEditor(zip) {
 		},
 		},
 		'onExecute': Execute,
 		'onExecute': Execute,
 		'persistentPaths': persistentPaths,
 		'persistentPaths': persistentPaths,
+		'emscriptenPoolSize': concurrency,
+		'godotPoolSize': Math.floor(concurrency / 3), // Ensures at least 4 threads for the pool (see above).
 	};
 	};
 	editor = new Engine(editorConfig);
 	editor = new Engine(editorConfig);