Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Update Emscripten to 6.0.1

Mikael Hermansson07be50387588
diff --git a/.github/workflows/web_builds.yml b/.github/workflows/web_builds.yml
index 11c2f9e56e5..74341fbb487 100644
--- a/.github/workflows/web_builds.yml
+++ b/.github/workflows/web_builds.yml
@@ -9,7 +9,7 @@ env:
dev_mode=yes
debug_symbols=no
use_closure_compiler=yes
- EM_VERSION: 4.0.11
+ EM_VERSION: 6.0.1
jobs:
web-template:
diff --git a/main/main.cpp b/main/main.cpp
index 572780c66ee..be4016f14d9 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -214,8 +214,8 @@ static String locale;
static String log_file;
static bool show_help = false;
static uint64_t quit_after = 0;
-static ProcessID editor_pid = 0;
#ifdef TOOLS_ENABLED
+static ProcessID editor_pid = 0;
static bool found_project = false;
static bool recovery_mode = false;
static bool auto_build_solutions = false;
@@ -1889,6 +1889,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
"To be able to use it, use the `target=template_debug` SCons option when compiling Godot.\n");
goto error;
#endif // defined(DEBUG_ENABLED) || defined (TOOLS_ENABLED)
+#ifdef TOOLS_ENABLED
} else if (arg == "--editor-pid") { // not exposed to user
if (N) {
editor_pid = N->get().to_int();
@@ -1897,6 +1898,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->print("Missing editor PID argument, aborting.\n");
goto error;
}
+#endif // TOOLS_ENABLED
} else if (arg == "--disable-render-loop") {
disable_render_loop = true;
} else if (arg == "--fixed-fps") {
@@ -2257,9 +2259,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#if defined(DEBUG_ENABLED) || defined(TOOLS_ENABLED)
EngineDebugger::initialize(debug_uri, skip_breakpoints, ignore_error_breaks, breakpoints, []() {
+#ifdef TOOLS_ENABLED
if (editor_pid) {
DisplayServer::get_singleton()->enable_for_stealing_focus(editor_pid);
}
+#endif
});
#endif
diff --git a/platform/web/detect.py b/platform/web/detect.py
index 25f68b4052a..d544b501f7b 100644
--- a/platform/web/detect.py
+++ b/platform/web/detect.py
@@ -114,8 +114,8 @@ def configure(env: "SConsEnvironment"):
cc_semver = (cc_version["major"], cc_version["minor"], cc_version["patch"])
# Minimum emscripten requirements.
- if cc_semver < (4, 0, 0):
- print_error("The minimum Emscripten version to build Godot is 4.0.0, detected: %s.%s.%s" % cc_semver)
+ if cc_semver < (6, 0, 1):
+ print_error("The minimum Emscripten version to build Godot is 6.0.1, detected: %s.%s.%s" % cc_semver)
sys.exit(255)
env.Append(LIBEMITTER=[library_emitter])
@@ -168,12 +168,6 @@ def configure(env: "SConsEnvironment"):
if env["lto"] == "auto": # Enable LTO for production.
env["lto"] = "thin"
- if env["lto"] == "thin" and cc_semver < (4, 0, 9):
- print_warning(
- '"lto=thin" support requires Emscripten 4.0.9 (detected %s.%s.%s), using "lto=full" instead.' % cc_semver
- )
- env["lto"] = "full"
-
if env["lto"] != "none":
if env["lto"] == "thin":
env.Append(CCFLAGS=["-flto=thin"])
@@ -199,13 +193,6 @@ def configure(env: "SConsEnvironment"):
env.Append(LINKFLAGS=["-sSAFE_HEAP=1"])
# Closure compiler
- if env["use_closure_compiler"] and cc_semver < (4, 0, 11):
- print_warning(
- '"use_closure_compiler=yes" support requires Emscripten 4.0.11 (detected %s.%s.%s), using "use_closure_compiler=no" instead.'
- % cc_semver
- )
- env["use_closure_compiler"] = False
-
if env["use_closure_compiler"]:
# For emscripten support code.
env.Append(LINKFLAGS=["--closure", "1"])
@@ -269,11 +256,11 @@ def configure(env: "SConsEnvironment"):
if env["threads"]:
# Thread support (via SharedArrayBuffer).
env.Append(CPPDEFINES=["PTHREAD_NO_RENAME"])
- env.Append(CCFLAGS=["-sUSE_PTHREADS=1"])
- env.Append(LINKFLAGS=["-sUSE_PTHREADS=1"])
+ env.Append(CCFLAGS=["-pthread"])
+ env.Append(LINKFLAGS=["-pthread"])
env.Append(LINKFLAGS=["-sDEFAULT_PTHREAD_STACK_SIZE=%sKB" % env["default_pthread_stack_size"]])
env.Append(LINKFLAGS=["-sPTHREAD_POOL_SIZE=\"Module['emscriptenPoolSize']||8\""])
- env.Append(LINKFLAGS=["-sWASM_MEM_MAX=2048MB"])
+ env.Append(LINKFLAGS=["-sMAXIMUM_MEMORY=2048MB"])
if not env["dlink_enabled"]:
# Workaround https://github.com/emscripten-core/emscripten/issues/21844#issuecomment-2116936414.
# Not needed (and potentially dangerous) when dlink_enabled=yes, since we set EXPORT_ALL=1 in that case.
diff --git a/platform/web/js/libs/library_godot_webgl2.externs.js b/platform/web/js/libs/library_godot_webgl2.externs.js
index 99190ab009b..b9d07294edb 100644
--- a/platform/web/js/libs/library_godot_webgl2.externs.js
+++ b/platform/web/js/libs/library_godot_webgl2.externs.js
@@ -1,40 +1,4 @@
-/**
- * @constructor OVR_multiview2
- */
-function OVR_multiview2() {}
-
-/**
- * @type {number}
- */
-OVR_multiview2.prototype.FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR;
-
-/**
- * @type {number}
- */
-OVR_multiview2.prototype.FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR;
-
-/**
- * @type {number}
- */
-OVR_multiview2.prototype.MAX_VIEWS_OVR;
-
-/**
- * @type {number}
- */
-OVR_multiview2.prototype.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR;
-
-/**
- * @param {number} target
- * @param {number} attachment
- * @param {WebGLTexture} texture
- * @param {number} level
- * @param {number} baseViewIndex
- * @param {number} numViews
- * @return {void}
- */
-OVR_multiview2.prototype.framebufferTextureMultiviewOVR = function(target, attachment, texture, level, baseViewIndex, numViews) {};
-
/**
* @constructor OCULUS_multiview
*/
diff --git a/thirdparty/README.md b/thirdparty/README.md
index 510e494bf88..1b50b18886e 100644
--- a/thirdparty/README.md
+++ b/thirdparty/README.md
@@ -656,6 +656,7 @@ Patches:
- `0001-msvc-node-debug-rename.patch` ([GH-75769](https://github.com/godotengine/godot/pull/75769))
- `0002-msvc-arm64-fpstrict.patch` ([GH-94655](https://github.com/godotengine/godot/pull/94655))
- `0003-clang-cl-sse2-sse41-avx2.patch` ([GH-92316](https://github.com/godotengine/godot/pull/92316))
+- `0004-emscripten-cppdefine.patch` ([GH-122412](https://github.com/godotengine/godot/pull/122412))
## linuxbsd_headers
diff --git a/thirdparty/libwebp/patches/0004-emscripten-cppdefine.patch b/thirdparty/libwebp/patches/0004-emscripten-cppdefine.patch
new file mode 100644
index 00000000000..f090501e11f
--- /dev/null
+++ b/thirdparty/libwebp/patches/0004-emscripten-cppdefine.patch
@@ -0,0 +1,13 @@
+diff --git a/thirdparty/libwebp/src/dsp/cpu.c b/thirdparty/libwebp/src/dsp/cpu.c
+index 816892fbc..b707fc38d 100644
+--- a/thirdparty/libwebp/src/dsp/cpu.c
++++ b/thirdparty/libwebp/src/dsp/cpu.c
+@@ -179,7 +179,7 @@ static int AndroidCPUInfo(CPUFeature feature) {
+ }
+ WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
+ VP8CPUInfo VP8GetCPUInfo = AndroidCPUInfo;
+-#elif defined(EMSCRIPTEN) // also needs to be before generic NEON test
++#elif defined(__EMSCRIPTEN__) // also needs to be before generic NEON test
+ // Use compile flags as an indicator of SIMD support instead of a runtime check.
+ static int wasmCPUInfo(CPUFeature feature) {
+ switch (feature) {
diff --git a/thirdparty/libwebp/src/dsp/cpu.c b/thirdparty/libwebp/src/dsp/cpu.c
index 816892fbc8a..b707fc38d6c 100644
--- a/thirdparty/libwebp/src/dsp/cpu.c
+++ b/thirdparty/libwebp/src/dsp/cpu.c
@@ -179,7 +179,7 @@ static int AndroidCPUInfo(CPUFeature feature) {
}
WEBP_EXTERN VP8CPUInfo VP8GetCPUInfo;
VP8CPUInfo VP8GetCPUInfo = AndroidCPUInfo;
-#elif defined(EMSCRIPTEN) // also needs to be before generic NEON test
+#elif defined(__EMSCRIPTEN__) // also needs to be before generic NEON test
// Use compile flags as an indicator of SIMD support instead of a runtime check.
static int wasmCPUInfo(CPUFeature feature) {
switch (feature) {