Files
haikuports/media-libs/embree/patches/embree-2.17.0.patchset
2017-11-12 18:07:35 +01:00

91 lines
2.6 KiB
Plaintext

From d0f67235368636157455a59caf93246147fc3c5c 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
--- a/common/sys/alloc.cpp
+++ b/common/sys/alloc.cpp
@@ -263,6 +263,8 @@ namespace embree
hugepages = true;
return ptr;
}
+#elif defined(__HAIKU__)
+ hugepages = false;
#else
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
--- a/common/sys/platform.h
+++ b/common/sys/platform.h
@@ -85,6 +85,13 @@
# endif
#endif
+/* detect Haiku platform */
+#if defined(__HAIKU__)
+# if !defined(__UNIX__)
+# define __UNIX__
+# endif
+#endif
+
/* try to detect other Unix systems */
#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
--- a/common/sys/sysinfo.cpp
+++ b/common/sys/sysinfo.cpp
@@ -46,6 +46,10 @@ namespace embree
return "Mac OS X (32bit)";
#elif defined(__MACOSX__) && defined(__X86_64__)
return "Mac OS X (64bit)";
+#elif defined(__HAIKU__) && !defined(__X86_64__)
+ return "Haiku (32bit)";
+#elif defined(__HAIKU__) && defined(__X86_64__)
+ return "Haiku (64bit)";
#elif defined(__UNIX__) && !defined(__X86_64__)
return "Unix (32bit)";
#elif defined(__UNIX__) && defined(__X86_64__)
@@ -403,7 +407,7 @@ namespace embree
/// Linux Platform
////////////////////////////////////////////////////////////////////////////////
-#if defined(__LINUX__)
+#if defined(__LINUX__) || defined(__HAIKU__)
#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
--- a/tutorials/common/math/sampling.h
+++ b/tutorials/common/math/sampling.h
@@ -26,6 +26,18 @@
namespace embree {
+#ifdef __HAIKU__
+/* FIXME! */
+inline void sincosf (float x, float* sine, float* cosine)
+{
+ #if defined(__GNUC__) && defined(__linux__) && !defined(__clang__)
+ __builtin_sincosf(x, sine, cosine);
+ #else
+ *sine = std::sin(x);
+ *cosine = std::cos(x);
+ #endif
+}
+#endif
inline Vec3fa cartesian(const float phi, const float sinTheta, const float cosTheta)
{
--
2.15.0