summaryrefslogtreecommitdiff
path: root/thirdparty
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty')
-rw-r--r--thirdparty/jpeg-compressor/jpgd.cpp16
-rw-r--r--thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch44
-rw-r--r--thirdparty/vhacd/0005-fix-scale-calculation.patch20
-rw-r--r--thirdparty/vhacd/inc/vhacdVolume.h4
4 files changed, 73 insertions, 11 deletions
diff --git a/thirdparty/jpeg-compressor/jpgd.cpp b/thirdparty/jpeg-compressor/jpgd.cpp
index 257d0b7574..baf6ea0484 100644
--- a/thirdparty/jpeg-compressor/jpgd.cpp
+++ b/thirdparty/jpeg-compressor/jpgd.cpp
@@ -37,16 +37,14 @@
#ifndef JPGD_USE_SSE2
- #if defined(__GNUC__)
-
- #if (defined(__x86_64__) || defined(_M_X64))
- #if defined(__SSE2__)
- #define JPGD_USE_SSE2 (1)
- #endif
+ #if defined(__GNUC__)
+ #if defined(__SSE2__)
+ #define JPGD_USE_SSE2 (1)
+ #endif
+ #elif defined(_MSC_VER)
+ #if defined(_M_X64)
+ #define JPGD_USE_SSE2 (1)
#endif
-
- #else
- #define JPGD_USE_SSE2 (1)
#endif
#endif
diff --git a/thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch b/thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch
new file mode 100644
index 0000000000..830b03b0c0
--- /dev/null
+++ b/thirdparty/jpeg-compressor/patches/fix-msvc-sse2-detection.patch
@@ -0,0 +1,44 @@
+From ae74fa2fcdef8ec44b925a649f66e8cbefce8315 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
+Date: Thu, 7 May 2020 12:14:09 +0200
+Subject: [PATCH] Fix detection of SSE2 with Visual Studio
+
+The previous code assumed that SSE2 is available when building with
+Visual Studio, but that's not accurate on ARM with UWP.
+
+SSE2 could also be enabled on x86 if `_M_IX86_FP == 2`, but it requires
+checking first that it's not actually set to 2 for AVX, AVX2 or AVX512
+(see https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019),
+so I left it out for this quick fix.
+---
+ jpgd.cpp | 16 +++++++---------
+ 1 file changed, 7 insertions(+), 9 deletions(-)
+
+diff --git a/jpgd.cpp b/jpgd.cpp
+index 91e66ad..db1f3b4 100644
+--- a/jpgd.cpp
++++ b/jpgd.cpp
+@@ -37,16 +37,14 @@
+
+ #ifndef JPGD_USE_SSE2
+
+- #if defined(__GNUC__)
+-
+- #if (defined(__x86_64__) || defined(_M_X64))
+- #if defined(__SSE2__)
+- #define JPGD_USE_SSE2 (1)
+- #endif
++ #if defined(__GNUC__)
++ #if defined(__SSE2__)
++ #define JPGD_USE_SSE2 (1)
++ #endif
++ #elif defined(_MSC_VER)
++ #if defined(_M_X64)
++ #define JPGD_USE_SSE2 (1)
+ #endif
+-
+- #else
+- #define JPGD_USE_SSE2 (1)
+ #endif
+
+ #endif
diff --git a/thirdparty/vhacd/0005-fix-scale-calculation.patch b/thirdparty/vhacd/0005-fix-scale-calculation.patch
new file mode 100644
index 0000000000..4b05f64fbf
--- /dev/null
+++ b/thirdparty/vhacd/0005-fix-scale-calculation.patch
@@ -0,0 +1,20 @@
+diff --git a/thirdparty/vhacd/inc/vhacdVolume.h b/thirdparty/vhacd/inc/vhacdVolume.h
+index 8c47fa1e2c..c445f20122 100644
+--- a/thirdparty/vhacd/inc/vhacdVolume.h
++++ b/thirdparty/vhacd/inc/vhacdVolume.h
+@@ -316,13 +316,13 @@ void Volume::Voxelize(const T* const points, const uint32_t stridePoints, const
+
+ double d[3] = { m_maxBB[0] - m_minBB[0], m_maxBB[1] - m_minBB[1], m_maxBB[2] - m_minBB[2] };
+ double r;
+- if (d[0] > d[1] && d[0] > d[2]) {
++ if (d[0] >= d[1] && d[0] >= d[2]) {
+ r = d[0];
+ m_dim[0] = dim;
+ m_dim[1] = 2 + static_cast<size_t>(dim * d[1] / d[0]);
+ m_dim[2] = 2 + static_cast<size_t>(dim * d[2] / d[0]);
+ }
+- else if (d[1] > d[0] && d[1] > d[2]) {
++ else if (d[1] >= d[0] && d[1] >= d[2]) {
+ r = d[1];
+ m_dim[1] = dim;
+ m_dim[0] = 2 + static_cast<size_t>(dim * d[0] / d[1]);
diff --git a/thirdparty/vhacd/inc/vhacdVolume.h b/thirdparty/vhacd/inc/vhacdVolume.h
index 8c47fa1e2c..c445f20122 100644
--- a/thirdparty/vhacd/inc/vhacdVolume.h
+++ b/thirdparty/vhacd/inc/vhacdVolume.h
@@ -316,13 +316,13 @@ void Volume::Voxelize(const T* const points, const uint32_t stridePoints, const
double d[3] = { m_maxBB[0] - m_minBB[0], m_maxBB[1] - m_minBB[1], m_maxBB[2] - m_minBB[2] };
double r;
- if (d[0] > d[1] && d[0] > d[2]) {
+ if (d[0] >= d[1] && d[0] >= d[2]) {
r = d[0];
m_dim[0] = dim;
m_dim[1] = 2 + static_cast<size_t>(dim * d[1] / d[0]);
m_dim[2] = 2 + static_cast<size_t>(dim * d[2] / d[0]);
}
- else if (d[1] > d[0] && d[1] > d[2]) {
+ else if (d[1] >= d[0] && d[1] >= d[2]) {
r = d[1];
m_dim[1] = dim;
m_dim[0] = 2 + static_cast<size_t>(dim * d[0] / d[1]);