From 9b8a099bd1b5666f24d5b2d75d378c881cafbc6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 20 May 2021 14:54:33 +0200 Subject: [PATCH] embree: Re-apply custom fix for MinGW crash Re-do of #45380 lost in #48455. Rediff patch on current embree-aarch64 upstream. Fixes #48822. --- thirdparty/embree/common/sys/platform.h | 2 +- thirdparty/embree/patches/godot-changes.patch | 33 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h index 737f14aa6e3..e3be41a27ac 100644 --- a/thirdparty/embree/common/sys/platform.h +++ b/thirdparty/embree/common/sys/platform.h @@ -91,7 +91,7 @@ #define dll_import #endif -#ifdef __WIN32__ +#if defined(__WIN32__) && !defined(__MINGW32__) #if !defined(__noinline) #define __noinline __declspec(noinline) #endif diff --git a/thirdparty/embree/patches/godot-changes.patch b/thirdparty/embree/patches/godot-changes.patch index 79a60ce3a59..0c68d375afe 100644 --- a/thirdparty/embree/patches/godot-changes.patch +++ b/thirdparty/embree/patches/godot-changes.patch @@ -247,10 +247,39 @@ index 4e8928242e..12f143f131 100644 /* hint for transparent huge pages (THP) */ diff --git a/thirdparty/embree/common/sys/platform.h b/thirdparty/embree/common/sys/platform.h -index 7914eb7a52..737f14aa6e 100644 +index 7375b2c2e8..e3be41a27a 100644 --- a/thirdparty/embree/common/sys/platform.h +++ b/thirdparty/embree/common/sys/platform.h -@@ -174,11 +174,19 @@ +@@ -91,7 +91,7 @@ + #define dll_import + #endif + +-#ifdef __WIN32__ ++#if defined(__WIN32__) && !defined(__MINGW32__) + #if !defined(__noinline) + #define __noinline __declspec(noinline) + #endif +@@ -146,6 +146,9 @@ + #define DELETED = delete + #endif + ++// -- GODOT start -- ++#ifndef likely ++// -- GODOT end -- + #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) + #define likely(expr) (expr) + #define unlikely(expr) (expr) +@@ -153,6 +156,9 @@ + #define likely(expr) __builtin_expect((bool)(expr),true ) + #define unlikely(expr) __builtin_expect((bool)(expr),false) + #endif ++// -- GODOT start -- ++#endif ++// -- GODOT end -- + + //////////////////////////////////////////////////////////////////////////////// + /// Error handling and debugging +@@ -168,11 +174,19 @@ #define PRINT4(x,y,z,w) embree_cout << STRING(x) << " = " << (x) << ", " << STRING(y) << " = " << (y) << ", " << STRING(z) << " = " << (z) << ", " << STRING(w) << " = " << (w) << embree_endl #if defined(DEBUG) // only report file and line in debug mode