From 9b96b31f0e72dfce0a81ec641cdd9a9acbbb3a37 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 23 Nov 2014 13:20:14 +0100 Subject: [PATCH] Fixed alignment on Visual C++ --- glm/detail/setup.hpp | 13 +++---------- glm/gtc/type_aligned.hpp | 30 +++++++++++++++--------------- test/gtc/gtc_type_aligned.cpp | 4 ---- 3 files changed, 18 insertions(+), 29 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index f102d3c6..cbd306e5 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -735,21 +735,14 @@ /////////////////////////////////////////////////////////////////////////////////// // Qualifiers -#if GLM_COMPILER & GLM_COMPILER_VC +#if (GLM_COMPILER & GLM_COMPILER_VC) || ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_PLATFORM & GLM_PLATFORM_WINDOWS)) # define GLM_DEPRECATED __declspec(deprecated) # define GLM_ALIGN(x) __declspec(align(x)) # define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x)) -# define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name +# define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name # define GLM_RESTRICT __declspec(restrict) # define GLM_RESTRICT_VAR __restrict -#elif GLM_COMPILER & GLM_COMPILER_INTEL -# define GLM_DEPRECATED -# define GLM_ALIGN(x) __declspec(align(x)) -# define GLM_ALIGNED_STRUCT(x) struct __declspec(align(x)) -# define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef __declspec(align(alignment)) type name -# define GLM_RESTRICT -# define GLM_RESTRICT_VAR __restrict -#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_CUDA) +#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL) # define GLM_DEPRECATED __attribute__((__deprecated__)) # define GLM_ALIGN(x) __attribute__((aligned(x))) # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) diff --git a/glm/gtc/type_aligned.hpp b/glm/gtc/type_aligned.hpp index 95c347c3..3e6b6a76 100644 --- a/glm/gtc/type_aligned.hpp +++ b/glm/gtc/type_aligned.hpp @@ -269,7 +269,7 @@ namespace glm /// Default precision 32 bit signed integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(ivec3, aligned_ivec3, 12); + GLM_ALIGNED_TYPEDEF(ivec3, aligned_ivec3, 16); /// Default precision 32 bit signed integer vector of 4 components type. /// @see gtc_type_aligned @@ -286,7 +286,7 @@ namespace glm /// Default precision 8 bit signed integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(i8vec3, aligned_i8vec3, 3); + GLM_ALIGNED_TYPEDEF(i8vec3, aligned_i8vec3, 4); /// Default precision 8 bit signed integer vector of 4 components type. /// @see gtc_type_aligned @@ -303,7 +303,7 @@ namespace glm /// Default precision 16 bit signed integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(i16vec3, aligned_i16vec3, 6); + GLM_ALIGNED_TYPEDEF(i16vec3, aligned_i16vec3, 8); /// Default precision 16 bit signed integer vector of 4 components type. /// @see gtc_type_aligned @@ -320,7 +320,7 @@ namespace glm /// Default precision 32 bit signed integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(i32vec3, aligned_i32vec3, 12); + GLM_ALIGNED_TYPEDEF(i32vec3, aligned_i32vec3, 16); /// Default precision 32 bit signed integer vector of 4 components type. /// @see gtc_type_aligned @@ -337,7 +337,7 @@ namespace glm /// Default precision 64 bit signed integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(i64vec3, aligned_i64vec3, 24); + GLM_ALIGNED_TYPEDEF(i64vec3, aligned_i64vec3, 32); /// Default precision 64 bit signed integer vector of 4 components type. /// @see gtc_type_aligned @@ -561,7 +561,7 @@ namespace glm /// Default precision 32 bit unsigned integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(uvec3, aligned_uvec3, 12); + GLM_ALIGNED_TYPEDEF(uvec3, aligned_uvec3, 16); /// Default precision 32 bit unsigned integer vector of 4 components type. /// @see gtc_type_aligned @@ -578,7 +578,7 @@ namespace glm /// Default precision 8 bit unsigned integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(u8vec3, aligned_u8vec3, 3); + GLM_ALIGNED_TYPEDEF(u8vec3, aligned_u8vec3, 4); /// Default precision 8 bit unsigned integer vector of 4 components type. /// @see gtc_type_aligned @@ -595,7 +595,7 @@ namespace glm /// Default precision 16 bit unsigned integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(u16vec3, aligned_u16vec3, 6); + GLM_ALIGNED_TYPEDEF(u16vec3, aligned_u16vec3, 8); /// Default precision 16 bit unsigned integer vector of 4 components type. /// @see gtc_type_aligned @@ -612,7 +612,7 @@ namespace glm /// Default precision 32 bit unsigned integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(u32vec3, aligned_u32vec3, 12); + GLM_ALIGNED_TYPEDEF(u32vec3, aligned_u32vec3, 16); /// Default precision 32 bit unsigned integer vector of 4 components type. /// @see gtc_type_aligned @@ -629,7 +629,7 @@ namespace glm /// Default precision 64 bit unsigned integer vector of 3 components type. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(u64vec3, aligned_u64vec3, 24); + GLM_ALIGNED_TYPEDEF(u64vec3, aligned_u64vec3, 32); /// Default precision 64 bit unsigned integer vector of 4 components type. /// @see gtc_type_aligned @@ -676,7 +676,7 @@ namespace glm /// Single-precision floating-point vector of 3 components. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(vec3, aligned_vec3, 12); + GLM_ALIGNED_TYPEDEF(vec3, aligned_vec3, 16); /// Single-precision floating-point vector of 4 components. /// @see gtc_type_aligned @@ -693,7 +693,7 @@ namespace glm /// Single-precision floating-point vector of 3 components. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(fvec3, aligned_fvec3, 12); + GLM_ALIGNED_TYPEDEF(fvec3, aligned_fvec3, 16); /// Single-precision floating-point vector of 4 components. /// @see gtc_type_aligned @@ -710,7 +710,7 @@ namespace glm /// Single-precision floating-point vector of 3 components. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(f32vec3, aligned_f32vec3, 12); + GLM_ALIGNED_TYPEDEF(f32vec3, aligned_f32vec3, 16); /// Single-precision floating-point vector of 4 components. /// @see gtc_type_aligned @@ -727,7 +727,7 @@ namespace glm /// Double-precision floating-point vector of 3 components. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(dvec3, aligned_dvec3, 24); + GLM_ALIGNED_TYPEDEF(dvec3, aligned_dvec3, 32); /// Double-precision floating-point vector of 4 components. /// @see gtc_type_aligned @@ -744,7 +744,7 @@ namespace glm /// Double-precision floating-point vector of 3 components. /// @see gtc_type_aligned - GLM_ALIGNED_TYPEDEF(f64vec3, aligned_f64vec3, 24); + GLM_ALIGNED_TYPEDEF(f64vec3, aligned_f64vec3, 32); /// Double-precision floating-point vector of 4 components. /// @see gtc_type_aligned diff --git a/test/gtc/gtc_type_aligned.cpp b/test/gtc/gtc_type_aligned.cpp index d1b2bcf7..7c2b2c03 100644 --- a/test/gtc/gtc_type_aligned.cpp +++ b/test/gtc/gtc_type_aligned.cpp @@ -9,10 +9,6 @@ #include -#define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name - -GLM_ALIGNED_TYPEDEF(glm::lowp_vec4, aligned_lowp_vec4, 16); - int test_decl() {