Add checks for __SSE2__ in the lightmap raycaster

(cherry picked from commit 20717990fd)
This commit is contained in:
JFonS 2021-05-05 18:24:13 +02:00 committed by Rémi Verschelde
parent b97b37f91c
commit 6a84390cd6
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 6 additions and 0 deletions

View File

@ -30,7 +30,9 @@
#include "lightmap_raycaster.h" #include "lightmap_raycaster.h"
#ifdef __SSE2__
#include <pmmintrin.h> #include <pmmintrin.h>
#endif
LightmapRaycaster *LightmapRaycasterEmbree::create_embree_raycaster() { LightmapRaycaster *LightmapRaycasterEmbree::create_embree_raycaster() {
return memnew(LightmapRaycasterEmbree); return memnew(LightmapRaycasterEmbree);
@ -180,8 +182,10 @@ void embree_error_handler(void *p_user_data, RTCError p_code, const char *p_str)
} }
LightmapRaycasterEmbree::LightmapRaycasterEmbree() { LightmapRaycasterEmbree::LightmapRaycasterEmbree() {
#ifdef __SSE2__
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
#endif
embree_device = rtcNewDevice(nullptr); embree_device = rtcNewDevice(nullptr);
rtcSetDeviceErrorFunction(embree_device, &embree_error_handler, nullptr); rtcSetDeviceErrorFunction(embree_device, &embree_error_handler, nullptr);
@ -189,8 +193,10 @@ LightmapRaycasterEmbree::LightmapRaycasterEmbree() {
} }
LightmapRaycasterEmbree::~LightmapRaycasterEmbree() { LightmapRaycasterEmbree::~LightmapRaycasterEmbree() {
#ifdef __SSE2__
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF); _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_OFF);
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF); _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_OFF);
#endif
if (embree_scene != nullptr) { if (embree_scene != nullptr) {
rtcReleaseScene(embree_scene); rtcReleaseScene(embree_scene);