embree: fix x86 build.

This commit is contained in:
Jerome Duval
2018-11-24 17:10:37 +01:00
parent 276db7385a
commit 33cef26655
2 changed files with 109 additions and 13 deletions

View File

@@ -10,7 +10,7 @@ algorithms that best matches the instruction set of your CPU"
HOMEPAGE="https://embree.github.io"
COPYRIGHT="2013-2017 Intel Corporation"
LICENSE="Apache v2"
REVISION="1"
REVISION="2"
SOURCE_URI="https://github.com/embree/embree/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="29b78b13728f81ced69ad24edb0bfe3f5e0298b83648371636394c9ecbc08752"
PATCHES="embree-$portVersion.patchset"

View File

@@ -1,14 +1,14 @@
From d0f67235368636157455a59caf93246147fc3c5c Mon Sep 17 00:00:00 2001
From dbe060fad2b764cbe49812864389fdbfb1323e9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 11 Nov 2017 10:59:41 +0100
Subject: Embree: Haiku platform support
diff --git a/common/sys/alloc.cpp b/common/sys/alloc.cpp
index ae9d77d..0eaa7ce 100644
index e24df4e..d51fd84 100644
--- a/common/sys/alloc.cpp
+++ b/common/sys/alloc.cpp
@@ -263,6 +263,8 @@ namespace embree
@@ -262,6 +262,8 @@ namespace embree
hugepages = true;
return ptr;
}
@@ -18,7 +18,7 @@ index ae9d77d..0eaa7ce 100644
void* ptr = mmap(0, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_HUGETLB, -1, 0);
if (ptr != MAP_FAILED) {
diff --git a/common/sys/platform.h b/common/sys/platform.h
index dfdc2c5..6b78f2f 100644
index 4f834ef..eea43f2 100644
--- a/common/sys/platform.h
+++ b/common/sys/platform.h
@@ -85,6 +85,13 @@
@@ -36,10 +36,10 @@ index dfdc2c5..6b78f2f 100644
#if defined(__unix__) || defined (unix) || defined(__unix) || defined(_unix)
# if !defined(__UNIX__)
diff --git a/common/sys/sysinfo.cpp b/common/sys/sysinfo.cpp
index 0dc6198..f963a04 100644
index 2a6dfed..9284cf6 100644
--- a/common/sys/sysinfo.cpp
+++ b/common/sys/sysinfo.cpp
@@ -46,6 +46,10 @@ namespace embree
@@ -49,6 +49,10 @@ namespace embree
return "Mac OS X (32bit)";
#elif defined(__MACOSX__) && defined(__X86_64__)
return "Mac OS X (64bit)";
@@ -50,7 +50,7 @@ index 0dc6198..f963a04 100644
#elif defined(__UNIX__) && !defined(__X86_64__)
return "Unix (32bit)";
#elif defined(__UNIX__) && defined(__X86_64__)
@@ -403,7 +407,7 @@ namespace embree
@@ -406,7 +410,7 @@ namespace embree
/// Linux Platform
////////////////////////////////////////////////////////////////////////////////
@@ -59,11 +59,8 @@ index 0dc6198..f963a04 100644
#include <stdio.h>
#include <unistd.h>
diff --git a/include/embree2/rtcore_version.h b/include/embree2/rtcore_version.h
old mode 100755
new mode 100644
diff --git a/tutorials/common/math/sampling.h b/tutorials/common/math/sampling.h
index d9a03e4..4a2977f 100644
index 46444f0..1bec7b3 100644
--- a/tutorials/common/math/sampling.h
+++ b/tutorials/common/math/sampling.h
@@ -26,6 +26,18 @@
@@ -86,5 +83,104 @@ index d9a03e4..4a2977f 100644
inline Vec3fa cartesian(const float phi, const float sinTheta, const float cosTheta)
{
--
2.15.0
2.19.1
From 3597bd1a386a817b7ddf7a3038c4e6523bc6132e Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 24 Nov 2018 17:07:38 +0100
Subject: fix for Haiku x86
diff --git a/common/math/math.h b/common/math/math.h
index bd66796..4bdfa05 100644
--- a/common/math/math.h
+++ b/common/math/math.h
@@ -176,7 +176,10 @@ namespace embree
__forceinline int64_t min(int64_t a, int64_t b) { return a<b ? a:b; }
__forceinline float min(float a, float b) { return a<b ? a:b; }
__forceinline double min(double a, double b) { return a<b ? a:b; }
-#if defined(__X86_64__)
+#if !defined(__X86_64__) && defined (__HAIKU__)
+ __forceinline ssize_t min(ssize_t a, ssize_t b) { return a<b ? a:b; }
+#endif
+#if defined(__X86_64__) || defined (__HAIKU__)
__forceinline size_t min(size_t a, size_t b) { return a<b ? a:b; }
#endif
@@ -193,7 +196,10 @@ namespace embree
__forceinline int64_t max(int64_t a, int64_t b) { return a<b ? b:a; }
__forceinline float max(float a, float b) { return a<b ? b:a; }
__forceinline double max(double a, double b) { return a<b ? b:a; }
-#if defined(__X86_64__)
+#if !defined(__X86_64__) && defined (__HAIKU__)
+ __forceinline ssize_t max(ssize_t a, ssize_t b) { return a<b ? b:a; }
+#endif
+#if defined(__X86_64__) || defined (__HAIKU__)
__forceinline size_t max(size_t a, size_t b) { return a<b ? b:a; }
#endif
diff --git a/common/sys/array.h b/common/sys/array.h
index db61047..efdfe36 100644
--- a/common/sys/array.h
+++ b/common/sys/array.h
@@ -152,7 +152,7 @@ namespace embree
__forceinline Ty& operator[](const unsigned i) { assert(i<N); return data[i]; }
__forceinline const Ty& operator[](const unsigned i) const { assert(i<N); return data[i]; }
-#if defined(__X86_64__)
+#if defined(__X86_64__) || defined(__HAIKU__)
__forceinline Ty& operator[](const size_t i) { assert(i<N); return data[i]; }
__forceinline const Ty& operator[](const size_t i) const { assert(i<N); return data[i]; }
#endif
diff --git a/common/sys/intrinsics.h b/common/sys/intrinsics.h
index d59a16e..e486d2e 100644
--- a/common/sys/intrinsics.h
+++ b/common/sys/intrinsics.h
@@ -111,7 +111,7 @@ namespace embree
return i;
}
-#if defined(__X86_64__)
+#if defined(__X86_64__) || defined (__HAIKU__)
__forceinline size_t __bscf(size_t& v)
{
size_t i = __bsf(v);
@@ -240,7 +239,7 @@ namespace embree
#endif
}
-#if defined(__X86_64__)
+#if defined(__X86_64__) || defined (__HAIKU__)
__forceinline unsigned __bsf(unsigned v)
{
#if defined(__AVX2__)
@@ -406,6 +405,12 @@ namespace embree
__forceinline unsigned __popcnt(unsigned in) {
return _mm_popcnt_u32(in);
}
+
+#if !defined(__X86_64__) && defined(__HAIKU__)
+ __forceinline size_t __popcnt(size_t in) {
+ return _mm_popcnt_u32(in);
+ }
+#endif
#if defined(__X86_64__)
__forceinline size_t __popcnt(size_t in) {
diff --git a/kernels/builders/bvh_builder_sah.h b/kernels/builders/bvh_builder_sah.h
index 307d78c..34072f0 100644
--- a/kernels/builders/bvh_builder_sah.h
+++ b/kernels/builders/bvh_builder_sah.h
@@ -52,7 +52,7 @@ namespace embree
{
if (RTC_BUILD_SETTINGS_HAS(settings,maxBranchingFactor)) branchingFactor = settings.maxBranchingFactor;
if (RTC_BUILD_SETTINGS_HAS(settings,maxDepth )) maxDepth = settings.maxDepth;
- if (RTC_BUILD_SETTINGS_HAS(settings,sahBlockSize )) logBlockSize = __bsr(settings.sahBlockSize);
+ if (RTC_BUILD_SETTINGS_HAS(settings,sahBlockSize )) logBlockSize = __bsr((size_t)settings.sahBlockSize);
if (RTC_BUILD_SETTINGS_HAS(settings,minLeafSize )) minLeafSize = settings.minLeafSize;
if (RTC_BUILD_SETTINGS_HAS(settings,maxLeafSize )) maxLeafSize = settings.maxLeafSize;
if (RTC_BUILD_SETTINGS_HAS(settings,travCost )) travCost = settings.travCost;
--
2.19.1