summaryrefslogtreecommitdiffstats
path: root/src/core/transforms
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2018-01-24 15:32:48 +0100
committerPaul Lemire <paul.lemire@kdab.com>2018-01-25 15:54:11 +0000
commit03165f9f17d9b351ad9f5a1a9dcf38360149f31c (patch)
tree202adf3a344f99cb52bb3f3670314cf3dcd836c6 /src/core/transforms
parent0851956b9b5bf17a8be097cdd0161eb708629070 (diff)
SIMD: Only include SSE classes if options activated
Relying on the SSE2 or AVX2 defines results in some SSE/AVX classes being included even though the options were disabled, resulting in compile failures. Change-Id: Ie1e3ce2f093eeb3f749ef215835fa0846fbb5019 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/core/transforms')
-rw-r--r--src/core/transforms/matrix4x4_p.h8
-rw-r--r--src/core/transforms/vector3d_p.h5
-rw-r--r--src/core/transforms/vector4d_p.h5
3 files changed, 14 insertions, 4 deletions
diff --git a/src/core/transforms/matrix4x4_p.h b/src/core/transforms/matrix4x4_p.h
index 1aded0f9c..18f5db4c3 100644
--- a/src/core/transforms/matrix4x4_p.h
+++ b/src/core/transforms/matrix4x4_p.h
@@ -52,8 +52,12 @@
//
#include <private/qsimd_p.h>
+#include <Qt3DCore/private/qt3dcore-config_p.h>
-#if defined(__AVX2__) && defined(QT_COMPILER_SUPPORTS_AVX2)
+
+// We check if sse or avx config option was enabled as it could
+// be disabled even though a given platform supports SSE2 or AVX2 instructions
+#if QT_CONFIG(qt3d_simd_avx2) && defined(__AVX2__) && defined(QT_COMPILER_SUPPORTS_AVX2)
#include <Qt3DCore/private/matrix4x4_avx2_p.h>
@@ -61,7 +65,7 @@ QT_BEGIN_NAMESPACE
using Matrix4x4 = Qt3DCore::Matrix4x4_AVX2;
QT_END_NAMESPACE
-#elif defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)
+#elif QT_CONFIG(qt3d_simd_sse2) && defined(__SSE2__) && defined(QT_COMPILER_SUPPORTS_SSE2)
#include <Qt3DCore/private/matrix4x4_sse_p.h>
diff --git a/src/core/transforms/vector3d_p.h b/src/core/transforms/vector3d_p.h
index fa72c9f2f..6467d7686 100644
--- a/src/core/transforms/vector3d_p.h
+++ b/src/core/transforms/vector3d_p.h
@@ -52,8 +52,11 @@
//
#include <private/qsimd_p.h>
+#include <Qt3DCore/private/qt3dcore-config_p.h>
-#if (defined(__AVX2__) || defined(__SSE2__)) && defined(QT_COMPILER_SUPPORTS_SSE2)
+// We check if sse config option was enabled as it could
+// be disabled even though a given platform supports SSE2 instructions
+#if QT_CONFIG(qt3d_simd_sse2) && (defined(__AVX2__) || defined(__SSE2__)) && defined(QT_COMPILER_SUPPORTS_SSE2)
#include <Qt3DCore/private/vector3d_sse_p.h>
diff --git a/src/core/transforms/vector4d_p.h b/src/core/transforms/vector4d_p.h
index 584eb470b..a03dc234f 100644
--- a/src/core/transforms/vector4d_p.h
+++ b/src/core/transforms/vector4d_p.h
@@ -52,8 +52,11 @@
//
#include <private/qsimd_p.h>
+#include <Qt3DCore/private/qt3dcore-config_p.h>
-#if (defined(__AVX2__) || defined(__SSE2__)) && defined(QT_COMPILER_SUPPORTS_SSE2)
+// We check if sse config option was enabled as it could
+// be disabled even though a given platform supports SSE2 instructions
+#if QT_CONFIG(qt3d_simd_sse2) && (defined(__AVX2__) || defined(__SSE2__)) && defined(QT_COMPILER_SUPPORTS_SSE2)
#include <Qt3DCore/private/vector4d_sse_p.h>