From 25bad4c78e2821050d9a640cff22df8460059b45 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:17:59 -0400 Subject: [PATCH 1/7] Fix wrong name for mat2::columns - It should really be mat2::cols --- glm/detail/type_mat2x2.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/detail/type_mat2x2.hpp b/glm/detail/type_mat2x2.hpp index c24d929a..1405cf98 100644 --- a/glm/detail/type_mat2x2.hpp +++ b/glm/detail/type_mat2x2.hpp @@ -56,7 +56,7 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR length_t columns = 2; + static GLM_RELAXED_CONSTEXPR length_t cols = 2; static GLM_RELAXED_CONSTEXPR length_t rows = 2; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS From 3400352e8140b4abc9fef756d171125f74c85072 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:20:04 -0400 Subject: [PATCH 2/7] Reverse the mat::rows and mat::cols fields - Oops, I mixed up the row_type and col_type typedefs --- glm/detail/type_mat2x3.hpp | 4 ++-- glm/detail/type_mat2x4.hpp | 4 ++-- glm/detail/type_mat3x2.hpp | 4 ++-- glm/detail/type_mat3x4.hpp | 4 ++-- glm/detail/type_mat4x2.hpp | 4 ++-- glm/detail/type_mat4x3.hpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/glm/detail/type_mat2x3.hpp b/glm/detail/type_mat2x3.hpp index f0e4fbdc..735bce3b 100644 --- a/glm/detail/type_mat2x3.hpp +++ b/glm/detail/type_mat2x3.hpp @@ -52,8 +52,8 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR length_t cols = 3; - static GLM_RELAXED_CONSTEXPR length_t rows = 2; + static GLM_RELAXED_CONSTEXPR length_t cols = 2; + static GLM_RELAXED_CONSTEXPR length_t rows = 3; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS diff --git a/glm/detail/type_mat2x4.hpp b/glm/detail/type_mat2x4.hpp index 6b0f190b..230d3758 100644 --- a/glm/detail/type_mat2x4.hpp +++ b/glm/detail/type_mat2x4.hpp @@ -52,8 +52,8 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 2; - static GLM_RELAXED_CONSTEXPR length_t cols = 4; - static GLM_RELAXED_CONSTEXPR length_t rows = 2; + static GLM_RELAXED_CONSTEXPR length_t cols = 2; + static GLM_RELAXED_CONSTEXPR length_t rows = 4; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS diff --git a/glm/detail/type_mat3x2.hpp b/glm/detail/type_mat3x2.hpp index 1ee94214..30ecff2b 100644 --- a/glm/detail/type_mat3x2.hpp +++ b/glm/detail/type_mat3x2.hpp @@ -52,8 +52,8 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 3; - static GLM_RELAXED_CONSTEXPR length_t cols = 2; - static GLM_RELAXED_CONSTEXPR length_t rows = 3; + static GLM_RELAXED_CONSTEXPR length_t cols = 3; + static GLM_RELAXED_CONSTEXPR length_t rows = 2; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS diff --git a/glm/detail/type_mat3x4.hpp b/glm/detail/type_mat3x4.hpp index 12a27820..2229f601 100644 --- a/glm/detail/type_mat3x4.hpp +++ b/glm/detail/type_mat3x4.hpp @@ -52,8 +52,8 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 3; - static GLM_RELAXED_CONSTEXPR length_t cols = 4; - static GLM_RELAXED_CONSTEXPR length_t rows = 3; + static GLM_RELAXED_CONSTEXPR length_t cols = 3; + static GLM_RELAXED_CONSTEXPR length_t rows = 4; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS diff --git a/glm/detail/type_mat4x2.hpp b/glm/detail/type_mat4x2.hpp index 99a1dd74..3cc4b3f5 100644 --- a/glm/detail/type_mat4x2.hpp +++ b/glm/detail/type_mat4x2.hpp @@ -52,8 +52,8 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR length_t cols = 2; - static GLM_RELAXED_CONSTEXPR length_t rows = 4; + static GLM_RELAXED_CONSTEXPR length_t cols = 4; + static GLM_RELAXED_CONSTEXPR length_t rows = 2; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS diff --git a/glm/detail/type_mat4x3.hpp b/glm/detail/type_mat4x3.hpp index a29c7fb2..e19cf6a9 100644 --- a/glm/detail/type_mat4x3.hpp +++ b/glm/detail/type_mat4x3.hpp @@ -52,8 +52,8 @@ namespace glm # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 4; - static GLM_RELAXED_CONSTEXPR length_t cols = 3; - static GLM_RELAXED_CONSTEXPR length_t rows = 4; + static GLM_RELAXED_CONSTEXPR length_t cols = 4; + static GLM_RELAXED_CONSTEXPR length_t rows = 3; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS From 4aa385a37a09b24218be4dddd3419c316effbfbd Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:21:31 -0400 Subject: [PATCH 3/7] Change dualquat::components to 2, not 8 --- glm/gtx/dual_quaternion.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index 624470f4..45561b34 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -65,7 +65,7 @@ namespace glm typedef glm::tquat part_type; # ifdef GLM_META_PROG_HELPERS - static GLM_RELAXED_CONSTEXPR length_t components = 8; + static GLM_RELAXED_CONSTEXPR length_t components = 2; static GLM_RELAXED_CONSTEXPR precision prec = P; # endif//GLM_META_PROG_HELPERS From c2b4e2a5c08f2598587dd294fc5f4448f80bcfbe Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:25:26 -0400 Subject: [PATCH 4/7] Change the value_type of simdVec4 and simdQuat to a float - Having it as __m128 didn't quite feel consistent with vec4/quat --- glm/gtx/simd_quat.hpp | 2 +- glm/gtx/simd_vec4.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index 0c30e501..fd9c2871 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -69,7 +69,7 @@ namespace detail { GLM_ALIGNED_STRUCT(16) fquatSIMD { - typedef __m128 value_type; + typedef float value_type; typedef std::size_t size_type; static size_type value_size(); diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index 905af456..aa3c6b4c 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -92,7 +92,7 @@ namespace detail /// \ingroup gtx_simd_vec4 GLM_ALIGNED_STRUCT(16) fvec4SIMD { - typedef __m128 value_type; + typedef float value_type; typedef std::size_t size_type; static size_type value_size(); From a8659bb7675b9d38de15205488d70806fc395c10 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:26:55 -0400 Subject: [PATCH 5/7] Remove unused value_size static methods in simdQuat and simdVec4 - They didn't even have implementations --- glm/gtx/simd_quat.hpp | 1 - glm/gtx/simd_vec4.hpp | 1 - 2 files changed, 2 deletions(-) diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index fd9c2871..fd8daf04 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -71,7 +71,6 @@ namespace detail { typedef float value_type; typedef std::size_t size_type; - static size_type value_size(); typedef fquatSIMD type; typedef tquat bool_type; diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index aa3c6b4c..cd73a602 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -94,7 +94,6 @@ namespace detail { typedef float value_type; typedef std::size_t size_type; - static size_type value_size(); typedef fvec4SIMD type; typedef tvec4 bool_type; From f46249620a2b0f4f191d1dd74ad51ac4a9c050ca Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:28:24 -0400 Subject: [PATCH 6/7] Add pure typedefs to the SIMD types --- glm/gtx/simd_mat4.hpp | 5 +++++ glm/gtx/simd_quat.hpp | 1 + glm/gtx/simd_vec4.hpp | 1 + 3 files changed, 7 insertions(+) diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index a321d1ed..3f7dbb1f 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -71,6 +71,11 @@ namespace detail typedef fmat4x4SIMD type; typedef fmat4x4SIMD transpose_type; + typedef tmat4x4 pure_type; + typedef tvec4 pure_row_type; + typedef tvec4 pure_col_type; + typedef tmat4x4 pure_transpose_type; + # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 4; static GLM_RELAXED_CONSTEXPR length_t cols = 4; diff --git a/glm/gtx/simd_quat.hpp b/glm/gtx/simd_quat.hpp index fd8daf04..9f1eb46a 100644 --- a/glm/gtx/simd_quat.hpp +++ b/glm/gtx/simd_quat.hpp @@ -74,6 +74,7 @@ namespace detail typedef fquatSIMD type; typedef tquat bool_type; + typedef tquat pure_type; # ifdef GLM_META_PROG_HELPERS static GLM_RELAXED_CONSTEXPR length_t components = 4; diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index cd73a602..d8ab633b 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -96,6 +96,7 @@ namespace detail typedef std::size_t size_type; typedef fvec4SIMD type; + typedef tvec4 pure_type; typedef tvec4 bool_type; # ifdef GLM_META_PROG_HELPERS From 2a947b7ff139a07c3b5b81f23a923865e4aaa7c5 Mon Sep 17 00:00:00 2001 From: Jesse Talavera-Greenberg Date: Sat, 25 Jul 2015 14:33:01 -0400 Subject: [PATCH 7/7] Add GLM_META_PROG_HELPERS tests to each type - Add new tests to the matrix types - Add vector tests to use the static values instead of constants - Wrap the quaternion tests in #ifdefs - Add new tests to the simdMat4 and simdVec4 tests --- test/core/core_type_mat2x2.cpp | 5 +++++ test/core/core_type_mat2x3.cpp | 5 +++++ test/core/core_type_mat2x4.cpp | 5 +++++ test/core/core_type_mat3x2.cpp | 5 +++++ test/core/core_type_mat3x3.cpp | 5 +++++ test/core/core_type_mat3x4.cpp | 7 ++++++- test/core/core_type_mat4x2.cpp | 5 +++++ test/core/core_type_mat4x3.cpp | 5 +++++ test/core/core_type_mat4x4.cpp | 5 +++++ test/core/core_type_vec1.cpp | 1 + test/core/core_type_vec2.cpp | 1 + test/core/core_type_vec3.cpp | 1 + test/core/core_type_vec4.cpp | 1 + test/gtc/gtc_quaternion.cpp | 5 ++++- test/gtx/gtx_dual_quaternion.cpp | 4 ++++ test/gtx/gtx_simd_mat4.cpp | 9 +++++++++ test/gtx/gtx_simd_vec4.cpp | 5 +++++ 17 files changed, 72 insertions(+), 2 deletions(-) diff --git a/test/core/core_type_mat2x2.cpp b/test/core/core_type_mat2x2.cpp index ea5145ca..6f6fef63 100644 --- a/test/core/core_type_mat2x2.cpp +++ b/test/core/core_type_mat2x2.cpp @@ -124,6 +124,11 @@ int main() { int Error(0); +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat2::rows == glm::mat2::row_type::components); + assert(glm::mat2::cols == glm::mat2::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); Error += test_inverse(); diff --git a/test/core/core_type_mat2x3.cpp b/test/core/core_type_mat2x3.cpp index 45cad31b..195a94d2 100644 --- a/test/core/core_type_mat2x3.cpp +++ b/test/core/core_type_mat2x3.cpp @@ -98,6 +98,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat2x3::rows == glm::mat2x3::row_type::components); + assert(glm::mat2x3::cols == glm::mat2x3::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat2x4.cpp b/test/core/core_type_mat2x4.cpp index 4811ee09..c030d98d 100644 --- a/test/core/core_type_mat2x4.cpp +++ b/test/core/core_type_mat2x4.cpp @@ -98,6 +98,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat2x4::rows == glm::mat2x4::row_type::components); + assert(glm::mat2x4::cols == glm::mat2x4::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat3x2.cpp b/test/core/core_type_mat3x2.cpp index a1b631e6..9ff88783 100644 --- a/test/core/core_type_mat3x2.cpp +++ b/test/core/core_type_mat3x2.cpp @@ -102,6 +102,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat3x2::rows == glm::mat3x2::row_type::components); + assert(glm::mat3x2::cols == glm::mat3x2::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat3x3.cpp b/test/core/core_type_mat3x3.cpp index d4d5f3a0..5555cdf0 100644 --- a/test/core/core_type_mat3x3.cpp +++ b/test/core/core_type_mat3x3.cpp @@ -161,6 +161,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat3::rows == glm::mat3::row_type::components); + assert(glm::mat3::cols == glm::mat3::col_type::components); +#endif + Error += test_ctr(); Error += test_mat3x3(); Error += test_operators(); diff --git a/test/core/core_type_mat3x4.cpp b/test/core/core_type_mat3x4.cpp index 0b29887a..3d7c380a 100644 --- a/test/core/core_type_mat3x4.cpp +++ b/test/core/core_type_mat3x4.cpp @@ -101,7 +101,12 @@ int test_ctr() int main() { int Error = 0; - + +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat3x4::rows == glm::mat3x4::row_type::components); + assert(glm::mat3x4::cols == glm::mat3x4::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x2.cpp b/test/core/core_type_mat4x2.cpp index 13bea3f6..f732478b 100644 --- a/test/core/core_type_mat4x2.cpp +++ b/test/core/core_type_mat4x2.cpp @@ -106,6 +106,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat4x2::rows == glm::mat4x2::row_type::components); + assert(glm::mat4x2::cols == glm::mat4x2::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x3.cpp b/test/core/core_type_mat4x3.cpp index a91f7e25..f8b6aa62 100644 --- a/test/core/core_type_mat4x3.cpp +++ b/test/core/core_type_mat4x3.cpp @@ -106,6 +106,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat4x3::rows == glm::mat4x3::row_type::components); + assert(glm::mat4x3::cols == glm::mat4x3::col_type::components); +#endif + Error += test_ctr(); Error += test_operators(); diff --git a/test/core/core_type_mat4x4.cpp b/test/core/core_type_mat4x4.cpp index c37f2deb..4a073c02 100644 --- a/test/core/core_type_mat4x4.cpp +++ b/test/core/core_type_mat4x4.cpp @@ -278,6 +278,11 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::mat4::rows == glm::mat4::row_type::components); + assert(glm::mat4::cols == glm::mat4::col_type::components); +#endif + Error += test_ctr(); Error += test_inverse_dmat4x4(); Error += test_inverse_mat4x4(); diff --git a/test/core/core_type_vec1.cpp b/test/core/core_type_vec1.cpp index f648e9d2..9a14efe1 100644 --- a/test/core/core_type_vec1.cpp +++ b/test/core/core_type_vec1.cpp @@ -190,6 +190,7 @@ int main() assert(v.length() == 1); # ifdef GLM_META_PROG_HELPERS + assert(glm::vec1::components == glm::vec1().length()); assert(glm::vec1::components == 1); # endif diff --git a/test/core/core_type_vec2.cpp b/test/core/core_type_vec2.cpp index 2701d7a6..3f6cee99 100644 --- a/test/core/core_type_vec2.cpp +++ b/test/core/core_type_vec2.cpp @@ -349,6 +349,7 @@ int main() assert(v.length() == 2); # ifdef GLM_META_PROG_HELPERS + assert(glm::vec2::components == glm::vec2().length()); assert(glm::vec2::components == 2); # endif diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index 025253d5..2e41729f 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -517,6 +517,7 @@ int main() assert(v.length() == 3); # ifdef GLM_META_PROG_HELPERS + assert(glm::vec3::components == glm::vec3().length()); assert(glm::vec3::components == 3); # endif diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 2a3adfd9..be3eb30c 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -493,6 +493,7 @@ int main() assert(v.length() == 4); # ifdef GLM_META_PROG_HELPERS + assert(glm::vec4::components == glm::vec4().length()); assert(glm::vec4::components == 4); # endif diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index d9b3ddf1..4c3b74ce 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -325,7 +325,10 @@ int main() { int Error(0); - assert(glm::quat::components == 4); +#ifdef GLM_META_PROG_HELPERS + assert(glm::quat::components == 4); + assert(glm::quat::components == glm::quat().length()); +#endif Error += test_quat_ctr(); Error += test_quat_mul_vec(); diff --git a/test/gtx/gtx_dual_quaternion.cpp b/test/gtx/gtx_dual_quaternion.cpp index 01a81b3d..c3fdaccc 100644 --- a/test/gtx/gtx_dual_quaternion.cpp +++ b/test/gtx/gtx_dual_quaternion.cpp @@ -209,6 +209,10 @@ int main() { int Error(0); +#ifdef GLM_META_PROG_HELPERS + assert(glm::dualquat::components == glm::dualquat().length()); +#endif + Error += test_dual_quat_ctr(); Error += test_dquat_type(); Error += test_scalars(); diff --git a/test/gtx/gtx_simd_mat4.cpp b/test/gtx/gtx_simd_mat4.cpp index c7ea4592..11230466 100644 --- a/test/gtx/gtx_simd_mat4.cpp +++ b/test/gtx/gtx_simd_mat4.cpp @@ -256,6 +256,15 @@ int main() { int Error = 0; +#ifdef GLM_META_PROG_HELPERS + assert(glm::simdMat4::rows == glm::simdMat4::row_type::components); + assert(glm::simdMat4::cols == glm::simdMat4::col_type::components); + + assert(glm::simdMat4::components == glm::simdMat4::pure_type::components); + assert(glm::simdMat4::rows == glm::simdMat4::pure_row_type::components); + assert(glm::simdMat4::cols == glm::simdMat4::pure_col_type::components); +#endif + std::vector Data(64 * 64 * 1); for(std::size_t i = 0; i < Data.size(); ++i) Data[i] = glm::mat4( diff --git a/test/gtx/gtx_simd_vec4.cpp b/test/gtx/gtx_simd_vec4.cpp index e71a60b9..b86eb272 100644 --- a/test/gtx/gtx_simd_vec4.cpp +++ b/test/gtx/gtx_simd_vec4.cpp @@ -37,6 +37,11 @@ int main() { + +#ifdef GLM_META_PROG_HELPERS + assert(glm::simdVec4::components == glm::simdVec4::pure_type::components); +#endif + glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f); glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f); glm::simdVec4 C1 = A1 + B1;