From 5d7c896a3f214b1b8e04b829be30c181e897e2c3 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 24 Sep 2013 01:21:55 +0200 Subject: [PATCH] Fixed build on Visual C++ 2005 --- glm/core/func_integer.inl | 2 +- glm/core/setup.hpp | 27 ++++++++++++++++++++++++++- test/gtc/gtc_type_precision.cpp | 5 +++-- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/glm/core/func_integer.inl b/glm/core/func_integer.inl index 77eac582..a23401b1 100644 --- a/glm/core/func_integer.inl +++ b/glm/core/func_integer.inl @@ -37,7 +37,7 @@ # pragma intrinsic(_BitScanReverse) #endif//(GLM_COMPILER & GLM_COMPILER_VC) #endif//(GLM_ARCH != GLM_ARCH_PURE) -#include +#include namespace glm { diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 511831ad..1c877af3 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -511,6 +511,25 @@ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC46)) || \ __has_feature(cxx_constexpr)) +// OpenMP +#ifdef _OPENMP +# if(GLM_COMPILER & GLM_COMPILER_GCC) +# if(GLM_COMPILER > GLM_COMPILER_GCC47) +# define GLM_HAS_OPENMP 31 +# elif(GLM_COMPILER > GLM_COMPILER_GCC44) +# define GLM_HAS_OPENMP 30 +# elif(GLM_COMPILER > GLM_COMPILER_GCC42) +# define GLM_HAS_OPENMP 25 +# endif +# endif//(GLM_COMPILER & GLM_COMPILER_GCC) + +# if(GLM_COMPILER & GLM_COMPILER_VC) +# if(GLM_COMPILER > GLM_COMPILER_VC2005) +# define GLM_HAS_OPENMP 20 +# endif +# endif//(GLM_COMPILER & GLM_COMPILER_GCC) +#endif + // Not standard #define GLM_HAS_ANONYMOUS_UNION (GLM_LANG & GLM_LANG_CXXMS_FLAG) @@ -603,6 +622,13 @@ #endif//GLM_ARCH #if(GLM_ARCH & GLM_ARCH_SSE2) # include +# if(GLM_COMPILER == GLM_COMPILER_VC8) // VC8 is missing some intrinsics, workaround + inline float _mm_cvtss_f32(__m128 A) { return A.m128_f32[0]; } + inline __m128 _mm_castpd_ps(__m128d PD) { union { __m128 ps; __m128d pd; } c; c.pd = PD; return c.ps; } + inline __m128d _mm_castps_pd(__m128 PS) { union { __m128 ps; __m128d pd; } c; c.ps = PS; return c.pd; } + inline __m128i _mm_castps_si128(__m128 PS) { union { __m128 ps; __m128i pi; } c; c.ps = PS; return c.pi; } + inline __m128 _mm_castsi128_ps(__m128i PI) { union { __m128 ps; __m128i pi; } c; c.pi = PI; return c.ps; } +# endif #endif//GLM_ARCH //#endif//(GLM_ARCH != GLM_ARCH_PURE) @@ -727,5 +753,4 @@ # define GLM_CONSTEXPR #endif - #endif//GLM_SETUP_INCLUDED diff --git a/test/gtc/gtc_type_precision.cpp b/test/gtc/gtc_type_precision.cpp index a1a7abcd..a1969828 100644 --- a/test/gtc/gtc_type_precision.cpp +++ b/test/gtc/gtc_type_precision.cpp @@ -11,6 +11,9 @@ #include #include #include +#if GLM_HAS_OPENMP +# include +#endif static int test_scalar_size() { @@ -855,8 +858,6 @@ static int test_fvec_conversion() return Error; } -#include - static int test_openmp() { std::vector VectorA(1000);