From 31a9afb135cc5ffcf634e638e88232b71444d975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Wed, 5 May 2021 18:01:39 +0200 Subject: [PATCH 1/2] SCons: Disable embree-based modules on x86 (32-bit) Fixes #48482. (cherry picked from commit e53422c8f96770c9a9b7497955c84f4b742fdd73) --- modules/raycast/config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/raycast/config.py b/modules/raycast/config.py index 26493da41bf..3da9ace9d88 100644 --- a/modules/raycast/config.py +++ b/modules/raycast/config.py @@ -1,10 +1,16 @@ def can_build(env, platform): + # Depends on Embree library, which supports only x86_64 (originally) + # and aarch64 (thanks to the embree-aarch64 fork). + if platform == "android": - return env["android_arch"] in ["arm64v8", "x86", "x86_64"] + return env["android_arch"] in ["arm64v8", "x86_64"] if platform == "javascript": return False # No SIMD support yet + if env["bits"] == "32": + return False + return True From 1cab622e9461cf49629449d2c16369a0496825cc Mon Sep 17 00:00:00 2001 From: JFonS Date: Wed, 5 May 2021 18:24:13 +0200 Subject: [PATCH 2/2] Add checks for __SSE2__ in the lightmap raycaster (cherry picked from commit 20717990fd2a7ad300fd9c6fab0394f25e3b7294) --- modules/raycast/lightmap_raycaster.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/raycast/lightmap_raycaster.cpp b/modules/raycast/lightmap_raycaster.cpp index 56bdb5900be..0583acc1194 100644 --- a/modules/raycast/lightmap_raycaster.cpp +++ b/modules/raycast/lightmap_raycaster.cpp @@ -32,7 +32,9 @@ #include "lightmap_raycaster.h" +#ifdef __SSE2__ #include +#endif LightmapRaycaster *LightmapRaycasterEmbree::create_embree_raycaster() { return memnew(LightmapRaycasterEmbree); @@ -171,8 +173,10 @@ void embree_error_handler(void *p_user_data, RTCError p_code, const char *p_str) } LightmapRaycasterEmbree::LightmapRaycasterEmbree() { +#ifdef __SSE2__ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); +#endif embree_device = rtcNewDevice(nullptr); rtcSetDeviceErrorFunction(embree_device, &embree_error_handler, nullptr); @@ -180,8 +184,10 @@ LightmapRaycasterEmbree::LightmapRaycasterEmbree() { } LightmapRaycasterEmbree::~LightmapRaycasterEmbree() { +#ifdef __SSE2__ _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF); +#endif if (embree_scene != nullptr) { rtcReleaseScene(embree_scene);