1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Web: Add godot_pool_size/emscripten_pool_size config

This commit is contained in:
Marcos Casagrande
2025-03-21 20:01:48 +01:00
parent 209a446e36
commit a7d18f51a2
8 changed files with 50 additions and 2 deletions

View File

@@ -133,6 +133,16 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
* @type {Array.<string>}
*/
fileSizes: [],
/**
* @ignore
* @type {number}
*/
emscriptenPoolSize: 8,
/**
* @ignore
* @type {number}
*/
godotPoolSize: 4,
/**
* A callback function for handling Godot's ``OS.execute`` calls.
*
@@ -259,6 +269,8 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
this.serviceWorker = parse('serviceWorker', this.serviceWorker);
this.gdextensionLibs = parse('gdextensionLibs', this.gdextensionLibs);
this.fileSizes = parse('fileSizes', this.fileSizes);
this.emscriptenPoolSize = parse('emscriptenPoolSize', this.emscriptenPoolSize);
this.godotPoolSize = parse('godotPoolSize', this.godotPoolSize);
this.args = parse('args', this.args);
this.onExecute = parse('onExecute', this.onExecute);
this.onExit = parse('onExit', this.onExit);
@@ -278,6 +290,7 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
'thisProgram': this.executable,
'noExitRuntime': false,
'dynamicLibraries': [`${loadPath}.side.wasm`].concat(this.gdextensionLibs),
'emscriptenPoolSize': this.emscriptenPoolSize,
'instantiateWasm': function (imports, onSuccess) {
function done(result) {
onSuccess(result['instance'], result['module']);
@@ -350,6 +363,7 @@ const InternalConfig = function (initConfig) { // eslint-disable-line no-unused-
'locale': locale,
'persistentDrops': this.persistentDrops,
'virtualKeyboard': this.experimentalVK,
'godotPoolSize': this.godotPoolSize,
'focusCanvas': this.focusCanvas,
'onExecute': this.onExecute,
'onExit': function (p_code) {

View File

@@ -61,6 +61,7 @@ const GodotConfig = {
canvas_resize_policy: 2, // Adaptive
virtual_keyboard: false,
persistent_drops: false,
godot_pool_size: 4,
on_execute: null,
on_exit: null,
@@ -70,6 +71,7 @@ const GodotConfig = {
GodotConfig.locale = p_opts['locale'] || GodotConfig.locale;
GodotConfig.virtual_keyboard = p_opts['virtualKeyboard'];
GodotConfig.persistent_drops = !!p_opts['persistentDrops'];
GodotConfig.godot_pool_size = p_opts['godotPoolSize'];
GodotConfig.on_execute = p_opts['onExecute'];
GodotConfig.on_exit = p_opts['onExit'];
if (p_opts['focusCanvas']) {
@@ -346,6 +348,17 @@ const GodotOS = {
return concurrency < 2 ? concurrency : 2;
},
godot_js_os_thread_pool_size_get__proxy: 'sync',
godot_js_os_thread_pool_size_get__sig: 'i',
godot_js_os_thread_pool_size_get: function () {
if (typeof PThread === 'undefined') {
// Threads aren't supported, so default to `1`.
return 1;
}
return GodotConfig.godot_pool_size;
},
godot_js_os_download_buffer__proxy: 'sync',
godot_js_os_download_buffer__sig: 'viiii',
godot_js_os_download_buffer: function (p_ptr, p_size, p_name, p_mime) {