summaryrefslogtreecommitdiffstats
path: root/tests/auto/core
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/core')
-rw-r--r--tests/auto/core/CMakeLists.txt6
-rw-r--r--tests/auto/core/matrix4x4_avx2/CMakeLists.txt18
-rw-r--r--tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro8
-rw-r--r--tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp507
-rw-r--r--tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp2
-rw-r--r--tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp2
-rw-r--r--tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp2
7 files changed, 8 insertions, 537 deletions
diff --git a/tests/auto/core/CMakeLists.txt b/tests/auto/core/CMakeLists.txt
index edd2e9766..28d859fcd 100644
--- a/tests/auto/core/CMakeLists.txt
+++ b/tests/auto/core/CMakeLists.txt
@@ -29,11 +29,9 @@ if(QT_FEATURE_private_tests)
add_subdirectory(aspectcommanddebugger)
add_subdirectory(qscheduler)
endif()
-if(QT_FEATURE_private_tests AND QT_FEATURE_qt3d_simd_sse2)
+if(QT_FEATURE_private_tests AND NOT (CMAKE_OSX_ARCHITECTURES MATCHES ";") AND
+ (TEST_architecture_arch STREQUAL i386 OR TEST_architecture_arch STREQUAL x86_64))
add_subdirectory(vector4d_sse)
add_subdirectory(vector3d_sse)
add_subdirectory(matrix4x4_sse)
endif()
-if(QT_FEATURE_private_tests AND QT_FEATURE_qt3d_simd_avx2)
- add_subdirectory(matrix4x4_avx2)
-endif()
diff --git a/tests/auto/core/matrix4x4_avx2/CMakeLists.txt b/tests/auto/core/matrix4x4_avx2/CMakeLists.txt
deleted file mode 100644
index 378c1da25..000000000
--- a/tests/auto/core/matrix4x4_avx2/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: BSD-3-Clause
-
-# Generated from matrix4x4_avx2.pro.
-
-#####################################################################
-## tst_matrix4x4_avx2 Test:
-#####################################################################
-
-qt_internal_add_test(tst_matrix4x4_avx2
- SOURCES
- tst_matrix4x4_avx2.cpp
- LIBRARIES
- Qt::3DCore
- Qt::3DCorePrivate
- Qt::3DRenderPrivate
- Qt::Gui
-)
diff --git a/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro b/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro
deleted file mode 100644
index 4db8a1975..000000000
--- a/tests/auto/core/matrix4x4_avx2/matrix4x4_avx2.pro
+++ /dev/null
@@ -1,8 +0,0 @@
-TARGET = tst_matrix4x4_avx2
-CONFIG += testcase
-QT += testlib 3dcore 3dcore-private 3drender-private
-
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_AVX2
-
-SOURCES += tst_matrix4x4_avx2.cpp
-
diff --git a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp
deleted file mode 100644
index cc5071aa9..000000000
--- a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp
+++ /dev/null
@@ -1,507 +0,0 @@
-// Copyright (C) 2016 Paul Lemire <paul.lemire350@gmail.com>
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-#include <QtTest/QtTest>
-#include <Qt3DCore/private/matrix4x4_avx2_p.h>
-#include <Qt3DCore/private/aligned_malloc_p.h>
-
-using namespace Qt3DCore;
-
-class tst_Matrix4x4_AVX2: public QObject
-{
- Q_OBJECT
-public:
- void *operator new(size_t, void *ptr) { return ptr; }
- void operator delete(void *, void *) {}
- QT3D_ALIGNED_MALLOC_AND_FREE()
-
-private Q_SLOTS:
-
- void defaultConstruction()
- {
- // GIVEN
- Matrix4x4_AVX2 mat4;
-
- // THEN
- QCOMPARE(mat4.m11(), 1.0f);
- QCOMPARE(mat4.m12(), 0.0f);
- QCOMPARE(mat4.m13(), 0.0f);
- QCOMPARE(mat4.m14(), 0.0f);
-
- QCOMPARE(mat4.m21(), 0.0f);
- QCOMPARE(mat4.m22(), 1.0f);
- QCOMPARE(mat4.m23(), 0.0f);
- QCOMPARE(mat4.m24(), 0.0f);
-
- QCOMPARE(mat4.m31(), 0.0f);
- QCOMPARE(mat4.m32(), 0.0f);
- QCOMPARE(mat4.m33(), 1.0f);
- QCOMPARE(mat4.m34(), 0.0f);
-
- QCOMPARE(mat4.m41(), 0.0f);
- QCOMPARE(mat4.m42(), 0.0f);
- QCOMPARE(mat4.m43(), 0.0f);
- QCOMPARE(mat4.m44(), 1.0f);
-
- }
-
- void checkExplicitConstruction()
- {
- // GIVEN
- Matrix4x4_AVX2 mat4(11.0f, 12.0f, 13.0f, 14.0f,
- 21.0f, 22.0f, 23.0f, 24.0f,
- 31.0f, 32.0f, 33.0f, 34.0f,
- 41.0f, 42.0f, 43.0f, 44.0f);
-
- // THEN
- QCOMPARE(mat4.m11(), 11.0f);
- QCOMPARE(mat4.m12(), 12.0f);
- QCOMPARE(mat4.m13(), 13.0f);
- QCOMPARE(mat4.m14(), 14.0f);
-
- QCOMPARE(mat4.m21(), 21.0f);
- QCOMPARE(mat4.m22(), 22.0f);
- QCOMPARE(mat4.m23(), 23.0f);
- QCOMPARE(mat4.m24(), 24.0f);
-
- QCOMPARE(mat4.m31(), 31.0f);
- QCOMPARE(mat4.m32(), 32.0f);
- QCOMPARE(mat4.m33(), 33.0f);
- QCOMPARE(mat4.m34(), 34.0f);
-
- QCOMPARE(mat4.m41(), 41.0f);
- QCOMPARE(mat4.m42(), 42.0f);
- QCOMPARE(mat4.m43(), 43.0f);
- QCOMPARE(mat4.m44(), 44.0f);
- }
-
- void checkTransposed()
- {
- // GIVEN
- Matrix4x4_AVX2 mat4(11.0f, 12.0f, 13.0f, 14.0f,
- 21.0f, 22.0f, 23.0f, 24.0f,
- 31.0f, 32.0f, 33.0f, 34.0f,
- 41.0f, 42.0f, 43.0f, 44.0f);
-
- // WHEN
- mat4 = mat4.transposed();
-
- // THEN
- QCOMPARE(mat4.m11(), 11.0f);
- QCOMPARE(mat4.m12(), 21.0f);
- QCOMPARE(mat4.m13(), 31.0f);
- QCOMPARE(mat4.m14(), 41.0f);
-
- QCOMPARE(mat4.m21(), 12.0f);
- QCOMPARE(mat4.m22(), 22.0f);
- QCOMPARE(mat4.m23(), 32.0f);
- QCOMPARE(mat4.m24(), 42.0f);
-
- QCOMPARE(mat4.m31(), 13.0f);
- QCOMPARE(mat4.m32(), 23.0f);
- QCOMPARE(mat4.m33(), 33.0f);
- QCOMPARE(mat4.m34(), 43.0f);
-
- QCOMPARE(mat4.m41(), 14.0f);
- QCOMPARE(mat4.m42(), 24.0f);
- QCOMPARE(mat4.m43(), 34.0f);
- QCOMPARE(mat4.m44(), 44.0f);
- }
-
- void checkMultiplication()
- {
- {
- // GIVEN
- QMatrix4x4 mat1;
- QMatrix4x4 mat2;
-
- mat1.rotate(45.0f, QVector3D(1.0f, 0.0f, 0.0f));
- mat2.translate(5.0f, 12.0f, 11.0f);
-
- const Matrix4x4_AVX2 mat1fast(mat1);
- const Matrix4x4_AVX2 mat2fast(mat2);
-
- // WHEN
- const Matrix4x4_AVX2 ret = mat1fast * mat2fast;
-
- // THEN
- QCOMPARE(ret.toQMatrix4x4(), mat1 * mat2);
- }
- {
- // GIVEN
- QMatrix4x4 mat1;
- QMatrix4x4 mat2;
-
- mat1.rotate(45.0f, QVector3D(1.0f, 0.0f, 0.0f));
- mat2.translate(5.0f, 12.0f, 11.0f);
-
- const Matrix4x4_AVX2 mat1fast(mat1);
- const Matrix4x4_AVX2 mat2fast(mat2);
-
- // WHEN
- const Matrix4x4_AVX2 ret = mat2fast * mat1fast;
-
- // THEN
- QCOMPARE(ret.toQMatrix4x4(), mat2 * mat1);
- }
- }
-
- void checkAddition()
- {
- {
- // GIVEN
- QMatrix4x4 mat1;
- QMatrix4x4 mat2;
-
- mat1.rotate(45.0f, QVector3D(1.0f, 0.0f, 0.0f));
- mat2.translate(5.0f, 12.0f, 11.0f);
-
- const Matrix4x4_AVX2 mat1fast(mat1);
- const Matrix4x4_AVX2 mat2fast(mat2);
-
- // WHEN
- const Matrix4x4_AVX2 ret = mat1fast + mat2fast;
-
- // THEN
- QCOMPARE(ret.toQMatrix4x4(), mat1 + mat2);
- }
- {
- // GIVEN
- QMatrix4x4 mat1;
- QMatrix4x4 mat2;
-
- mat1.rotate(45.0f, QVector3D(1.0f, 0.0f, 0.0f));
- mat2.translate(5.0f, 12.0f, 11.0f);
-
- const Matrix4x4_AVX2 mat1fast(mat1);
- const Matrix4x4_AVX2 mat2fast(mat2);
-
- // WHEN
- const Matrix4x4_AVX2 ret = mat2fast + mat1fast;
-
- // THEN
- QCOMPARE(ret.toQMatrix4x4(), mat2 + mat1);
- }
- }
-
- void checkSubstraction()
- {
- {
- // GIVEN
- QMatrix4x4 mat1;
- QMatrix4x4 mat2;
-
- mat1.rotate(45.0f, QVector3D(1.0f, 0.0f, 0.0f));
- mat2.translate(5.0f, 12.0f, 11.0f);
-
- const Matrix4x4_AVX2 mat1fast(mat1);
- const Matrix4x4_AVX2 mat2fast(mat2);
-
- // WHEN
- const Matrix4x4_AVX2 ret = mat1fast - mat2fast;
-
- // THEN
- QCOMPARE(ret.toQMatrix4x4(), mat1 - mat2);
- }
- {
- // GIVEN
- QMatrix4x4 mat1;
- QMatrix4x4 mat2;
-
- mat1.rotate(45.0f, QVector3D(1.0f, 0.0f, 0.0f));
- mat2.translate(5.0f, 12.0f, 11.0f);
-
- const Matrix4x4_AVX2 mat1fast(mat1);
- const Matrix4x4_AVX2 mat2fast(mat2);
-
- // WHEN
- const Matrix4x4_AVX2 ret = mat2fast - mat1fast;
-
- // THEN
- QCOMPARE(ret.toQMatrix4x4(), mat2 - mat1);
- }
- }
-
- void checkEquality()
- {
- {
- // GIVEN
- Matrix4x4_AVX2 c1;
- Matrix4x4_AVX2 c2;
-
- // THEN
- QVERIFY(c1 == c2);
- }
- {
- QMatrix4x4 tmp;
- tmp.translate(5.0f, 8.0f, 14.0f);
-
- // GIVEN
- Matrix4x4_AVX2 c1(tmp);
- Matrix4x4_AVX2 c2(tmp);
-
- // THEN
- QVERIFY(c1 == c2);
- }
- {
- QMatrix4x4 tmp;
- tmp.translate(5.0f, 8.0f, 14.0f);
-
- // GIVEN
- Matrix4x4_AVX2 c1;
- Matrix4x4_AVX2 c2(tmp);
-
- // THEN
- QVERIFY(!(c1 == c2));
- }
- }
-
- void checkInequality()
- {
- {
- // GIVEN
- Matrix4x4_AVX2 c1;
- Matrix4x4_AVX2 c2;
-
- // THEN
- QVERIFY(!(c1 != c2));
- }
- {
- // GIVEN
- QMatrix4x4 tmp;
- tmp.translate(5.0f, 8.0f, 14.0f);
-
- Matrix4x4_AVX2 c1(tmp);
- tmp.translate(3.0f, 9.0f, -4.0f);
- Matrix4x4_AVX2 c2(tmp);
-
- // THEN
- QVERIFY(c1 != c2);
- }
- }
-
- void checkMatrixVector4DMultiplication()
- {
-
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector4D tmpVec4(1.0f, 2.0f, 3.0f, 4.0f);
- tmpMat.translate(5.0f, 8.0f, 14.0f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector4D vec4(tmpVec4);
-
- // WHEN
- const Vector4D resultingVec = mat * vec4;
-
- // THEN
- QCOMPARE(resultingVec.toQVector4D(), tmpMat * tmpVec4);
- }
-
- void checkVector4DMatrixMultiplication()
- {
-
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector4D tmpVec4(1.0f, 2.0f, 3.0f, 4.0f);
- tmpMat.translate(5.0f, 8.0f, 14.0f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector4D vec4(tmpVec4);
-
- // WHEN
- const Vector4D resultingVec = vec4 * mat;
-
- // THEN
- QCOMPARE(resultingVec.toQVector4D(), tmpVec4 * tmpMat);
- }
-
- void checkMatrixVector3DMultiplication()
- {
-
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector3D tmpVec3(1.0f, 2.0f, 3.0f);
- tmpMat.translate(5.0f, 8.0f, 14.0f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector3D vec3(tmpVec3);
-
- // WHEN
- const Vector3D resultingVec = mat * vec3;
-
- // THEN
- QCOMPARE(resultingVec.toQVector3D(), tmpMat * tmpVec3);
- }
-
- void checkVector3DMatrixMultiplication()
- {
-
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector3D tmpVec3(1.0f, 2.0f, 3.0f);
- tmpMat.translate(5.0f, 8.0f, 14.0f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector3D vec3(tmpVec3);
-
- // WHEN
- const Vector3D resultingVec = vec3 * mat;
-
- // THEN
- QCOMPARE(resultingVec.toQVector3D(), tmpVec3 * tmpMat);
- }
-
- void checkRows()
- {
- // GIVEN
- const Matrix4x4_AVX2 mat4(11.0f, 12.0f, 13.0f, 14.0f,
- 21.0f, 22.0f, 23.0f, 24.0f,
- 31.0f, 32.0f, 33.0f, 34.0f,
- 41.0f, 42.0f, 43.0f, 44.0f);
-
- {
- // WHEN
- const Vector4D row = mat4.row(0);
-
- // THEN
- QCOMPARE(row.x(), 11.0f);
- QCOMPARE(row.y(), 12.0f);
- QCOMPARE(row.z(), 13.0f);
- QCOMPARE(row.w(), 14.0f);
- }
- {
- // WHEN
- const Vector4D row = mat4.row(1);
-
- // THEN
- QCOMPARE(row.x(), 21.0f);
- QCOMPARE(row.y(), 22.0f);
- QCOMPARE(row.z(), 23.0f);
- QCOMPARE(row.w(), 24.0f);
- }
- {
- // WHEN
- const Vector4D row = mat4.row(2);
-
- // THEN
- QCOMPARE(row.x(), 31.0f);
- QCOMPARE(row.y(), 32.0f);
- QCOMPARE(row.z(), 33.0f);
- QCOMPARE(row.w(), 34.0f);
- }
- {
- // WHEN
- const Vector4D row = mat4.row(3);
-
- // THEN
- QCOMPARE(row.x(), 41.0f);
- QCOMPARE(row.y(), 42.0f);
- QCOMPARE(row.z(), 43.0f);
- QCOMPARE(row.w(), 44.0f);
- }
- }
-
- void checkColumns()
- {
- // GIVEN
- const Matrix4x4_AVX2 mat4(11.0f, 12.0f, 13.0f, 14.0f,
- 21.0f, 22.0f, 23.0f, 24.0f,
- 31.0f, 32.0f, 33.0f, 34.0f,
- 41.0f, 42.0f, 43.0f, 44.0f);
-
- {
- // WHEN
- const Vector4D row = mat4.column(0);
-
- // THEN
- QCOMPARE(row.x(), 11.0f);
- QCOMPARE(row.y(), 21.0f);
- QCOMPARE(row.z(), 31.0f);
- QCOMPARE(row.w(), 41.0f);
- }
- {
- // WHEN
- const Vector4D row = mat4.column(1);
-
- // THEN
- QCOMPARE(row.x(), 12.0f);
- QCOMPARE(row.y(), 22.0f);
- QCOMPARE(row.z(), 32.0f);
- QCOMPARE(row.w(), 42.0f);
- }
- {
- // WHEN
- const Vector4D row = mat4.column(2);
-
- // THEN
- QCOMPARE(row.x(), 13.0f);
- QCOMPARE(row.y(), 23.0f);
- QCOMPARE(row.z(), 33.0f);
- QCOMPARE(row.w(), 43.0f);
- }
- {
- // WHEN
- const Vector4D row = mat4.column(3);
-
- // THEN
- QCOMPARE(row.x(), 14.0f);
- QCOMPARE(row.y(), 24.0f);
- QCOMPARE(row.z(), 34.0f);
- QCOMPARE(row.w(), 44.0f);
- }
- }
-
- void checkVectorMapVector()
- {
- {
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector3D tmpVec3(1.0f, 0.0f, 0.0f);
- tmpMat.rotate(90.f, 0.f, 1.f, 0.f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector3D vec3(tmpVec3);
-
- // WHEN
- const Vector3D resultingVec = mat.mapVector(vec3);
-
- // THEN
- QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
- }
- {
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector3D tmpVec3(0.0f, 0.0f, -1.0f);
- tmpMat.rotate(90.f, 0.f, 1.f, 0.f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector3D vec3(tmpVec3);
-
- // WHEN
- const Vector3D resultingVec = mat.mapVector(vec3);
-
- // THEN
- QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
- }
- {
- // GIVEN
- QMatrix4x4 tmpMat;
- QVector3D tmpVec3(3.0f, -3.0f, -1.0f);
- tmpMat.rotate(90.f, 0.33f, 0.33f, 0.33f);
-
- Matrix4x4_AVX2 mat(tmpMat);
- Vector3D vec3(tmpVec3);
-
- // WHEN
- const Vector3D resultingVec = mat.mapVector(vec3);
-
- // THEN
- QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
- }
- }
-};
-
-QTEST_MAIN(tst_Matrix4x4_AVX2)
-
-#include "tst_matrix4x4_avx2.moc"
diff --git a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp
index 575cb5ad1..24880430c 100644
--- a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp
+++ b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp
@@ -11,6 +11,7 @@ class tst_Matrix4x4_SSE: public QObject
{
Q_OBJECT
+#ifdef __SSE2__
private Q_SLOTS:
void defaultConstruction()
@@ -496,6 +497,7 @@ private Q_SLOTS:
QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3));
}
}
+#endif // __SSE2__
};
QTEST_MAIN(tst_Matrix4x4_SSE)
diff --git a/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp b/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp
index 7f89a4ef9..8e0bd856d 100644
--- a/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp
+++ b/tests/auto/core/vector3d_sse/tst_vector3d_sse.cpp
@@ -9,6 +9,7 @@ using namespace Qt3DCore;
class tst_Vector3D_SSE: public QObject
{
Q_OBJECT
+#ifdef __SSE2__
private Q_SLOTS:
void defaultConstruction()
{
@@ -787,6 +788,7 @@ private Q_SLOTS:
QVERIFY(!v0.isNull());
}
}
+#endif // __SSE2__
};
QTEST_APPLESS_MAIN(tst_Vector3D_SSE)
diff --git a/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp b/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp
index 79d673640..2cce8d141 100644
--- a/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp
+++ b/tests/auto/core/vector4d_sse/tst_vector4d_sse.cpp
@@ -10,6 +10,7 @@ using namespace Qt3DCore;
class tst_Vector4D_SSE: public QObject
{
Q_OBJECT
+#ifdef __SSE2__
private Q_SLOTS:
void defaultConstruction()
{
@@ -890,6 +891,7 @@ private Q_SLOTS:
QVERIFY(!v0.isNull());
}
}
+#endif
};
QTEST_APPLESS_MAIN(tst_Vector4D_SSE)