From 37ab3dfd291b404f9fe8af897de4c9ad6b735e3c Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 9 Aug 2016 20:48:34 +0200 Subject: [PATCH] Fixed Cuda build, using '__align__' for alignments in Cuda #539 --- glm/detail/setup.hpp | 10 +++++++++- glm/detail/type_vec.hpp | 3 --- glm/ext.hpp | 2 +- glm/gtc/type_aligned.hpp | 4 ---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index de68dd19..4fe783a4 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -583,7 +583,7 @@ # else # define GLM_VECTOR_CALL # endif -#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_CUDA | GLM_COMPILER_INTEL) +#elif GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG | GLM_COMPILER_INTEL) # define GLM_DEPRECATED __attribute__((__deprecated__)) # define GLM_ALIGN(x) __attribute__((aligned(x))) # define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) @@ -599,6 +599,14 @@ # else # define GLM_VECTOR_CALL # endif +#elif GLM_COMPILER & GLM_COMPILER_CUDA +# define GLM_DEPRECATED +# define GLM_ALIGN(x) __align__(x) +# define GLM_ALIGNED_STRUCT(x) struct __align__(x) +# define GLM_ALIGNED_TYPEDEF(type, name, alignment) typedef type name __align__(x) +# define GLM_RESTRICT_FUNC __restrict__ +# define GLM_RESTRICT __restrict__ +# define GLM_VECTOR_CALL #else # define GLM_DEPRECATED # define GLM_ALIGN diff --git a/glm/detail/type_vec.hpp b/glm/detail/type_vec.hpp index 62f8bc30..82e4ba01 100644 --- a/glm/detail/type_vec.hpp +++ b/glm/detail/type_vec.hpp @@ -17,8 +17,6 @@ namespace detail } type; }; -// Cuda doesn't support __declspec(align(x)), no aligned types for Cuda -# if GLM_COMPILER & GLM_COMPILER_CUDA template struct storage { @@ -26,7 +24,6 @@ namespace detail uint8 data[size]; } type; }; -# endif # if GLM_ARCH & GLM_ARCH_SSE2_BIT template <> diff --git a/glm/ext.hpp b/glm/ext.hpp index f99dec44..dee032e3 100644 --- a/glm/ext.hpp +++ b/glm/ext.hpp @@ -50,7 +50,7 @@ #include "./gtc/type_ptr.hpp" #include "./gtc/ulp.hpp" #include "./gtc/vec1.hpp" -#if GLM_HAS_ALIGNED_TYPE && !(GLM_COMPILER & GLM_COMPILER_CUDA) +#if GLM_HAS_ALIGNED_TYPE # include "./gtc/type_aligned.hpp" #endif diff --git a/glm/gtc/type_aligned.hpp b/glm/gtc/type_aligned.hpp index e7624eab..0a75dd04 100644 --- a/glm/gtc/type_aligned.hpp +++ b/glm/gtc/type_aligned.hpp @@ -12,10 +12,6 @@ #if !GLM_HAS_ALIGNED_TYPE # error "GLM: Aligned types are not supported on this platform" #endif -#if GLM_COMPILER & GLM_COMPILER_CUDA -# error "GLM: GTC_type_aligned is not supported on Cuda due to lack of __declspec(align(alignment)) support, issue #539" -#endif - #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTC_type_aligned extension included") #endif