From b016594ac3a39636ddae30035f99a25f2a8d0f4a Mon Sep 17 00:00:00 2001 From: tszirr Date: Mon, 17 Jun 2013 10:49:02 +0200 Subject: [PATCH] fix: function-local static arrays unsupported in cuda device code --- glm/core/_swizzle.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index c6af9a4e..8edadd70 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -160,12 +160,18 @@ namespace detail GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } protected: @@ -195,7 +201,10 @@ namespace detail GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } };