diff options
author | Paul Lemire <paul.lemire@kdab.com> | 2019-08-19 15:38:15 +0200 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2019-08-20 11:16:54 +0000 |
commit | 765cac3cba88cb13d029fa7c8fb12ed57de49b51 (patch) | |
tree | ad32436cb67bea868fe670b52f5794c7b4f80684 /tests/auto/core | |
parent | 6388eb98a12a639a263ef34553269fc36b582269 (diff) |
Matrix_SSE/Matrix_AVX2: fix mapVector
Change-Id: I4584d2c879a72eccbaf273d0e84b3b6f6bb55295
Task-number: QTBUG-77675
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests/auto/core')
-rw-r--r-- | tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp | 49 | ||||
-rw-r--r-- | tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp | 49 |
2 files changed, 98 insertions, 0 deletions
diff --git a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp index 144df6711..12eaab263 100644 --- a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp +++ b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp @@ -474,6 +474,55 @@ private Q_SLOTS: 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) diff --git a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp index bbd6596d4..dccf90d10 100644 --- a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp +++ b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp @@ -471,6 +471,55 @@ private Q_SLOTS: 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_SSE 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_SSE 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_SSE mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + } }; QTEST_MAIN(tst_Matrix4x4_SSE) |