Browse Source

Fixed Cuda build, using '__align__' for alignments in Cuda #539

Christophe Riccio 9 years ago
parent
commit
37ab3dfd29
4 changed files with 10 additions and 9 deletions
  1. 9 1
      glm/detail/setup.hpp
  2. 0 3
      glm/detail/type_vec.hpp
  3. 1 1
      glm/ext.hpp
  4. 0 4
      glm/gtc/type_aligned.hpp

+ 9 - 1
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

+ 0 - 3
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 <typename T, std::size_t size>
 	struct storage<T, size, true>
 	{
@@ -26,7 +24,6 @@ namespace detail
 			uint8 data[size];
 		} type;
 	};
-#	endif
 
 #	if GLM_ARCH & GLM_ARCH_SSE2_BIT
 		template <>

+ 1 - 1
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
 

+ 0 - 4
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