浏览代码

Fixed Cuda build, no support of __declspec(align(alignment))

Christophe Riccio 9 年之前
父节点
当前提交
09bf19db7e
共有 3 个文件被更改,包括 7 次插入3 次删除
  1. 3 0
      glm/detail/type_vec.hpp
  2. 1 1
      glm/ext.hpp
  3. 3 2
      glm/gtc/type_aligned.hpp

+ 3 - 0
glm/detail/type_vec.hpp

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

+ 1 - 1
glm/ext.hpp

@@ -50,7 +50,7 @@
 #include "./gtc/type_ptr.hpp"
 #include "./gtc/type_ptr.hpp"
 #include "./gtc/ulp.hpp"
 #include "./gtc/ulp.hpp"
 #include "./gtc/vec1.hpp"
 #include "./gtc/vec1.hpp"
-#if GLM_HAS_ALIGNED_TYPE
+#if GLM_HAS_ALIGNED_TYPE && !(GLM_COMPILER & GLM_COMPILER_CUDA)
 #	include "./gtc/type_aligned.hpp"
 #	include "./gtc/type_aligned.hpp"
 #endif
 #endif
 
 

+ 3 - 2
glm/gtc/type_aligned.hpp

@@ -12,6 +12,9 @@
 #if !GLM_HAS_ALIGNED_TYPE
 #if !GLM_HAS_ALIGNED_TYPE
 #	error "GLM: Aligned types are not supported on this platform"
 #	error "GLM: Aligned types are not supported on this platform"
 #endif
 #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))
 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
 # pragma message("GLM: GLM_GTC_type_aligned extension included")
 # pragma message("GLM: GLM_GTC_type_aligned extension included")
@@ -30,8 +33,6 @@ namespace glm
 	template <typename T, precision P> struct tvec2;
 	template <typename T, precision P> struct tvec2;
 	template <typename T, precision P> struct tvec3;
 	template <typename T, precision P> struct tvec3;
 	template <typename T, precision P> struct tvec4;
 	template <typename T, precision P> struct tvec4;
-
-
 	/// @addtogroup gtc_type_aligned
 	/// @addtogroup gtc_type_aligned
 	/// @{
 	/// @{