(GLM) Remove CUDACC ifdefs

This commit is contained in:
twinaphex 2016-11-01 10:23:40 +01:00
parent 68bfbd8020
commit 765c8ee930
4 changed files with 5 additions and 41 deletions

View File

@ -197,22 +197,12 @@ namespace detail
// sqrt
GLM_FUNC_QUALIFIER float sqrt(float x)
{
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<float, highp> tmp(detail::compute_sqrt<detail::tvec1, float, highp>::call(x));
return tmp.x;
# else
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x;
# endif
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x;
}
GLM_FUNC_QUALIFIER double sqrt(double x)
{
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<double, highp> tmp(detail::compute_sqrt<detail::tvec1, double, highp>::call(x));
return tmp.x;
# else
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x;
# endif
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x;
}
template <typename T, precision P, template <typename, precision> class vecType>

View File

@ -43,12 +43,7 @@ namespace detail
{
GLM_FUNC_QUALIFIER static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y)
{
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<T, P> tmp(x * y);
return tmp.x;
# else
return detail::tvec1<T, P>(x * y).x;
# endif
return detail::tvec1<T, P>(x * y).x;
}
};

View File

@ -210,17 +210,6 @@
# define GLM_COMPILER GLM_COMPILER_INTEL
# endif
// CUDA
#elif defined(__CUDACC__)
# if !defined(CUDA_VERSION) && !defined(GLM_FORCE_CUDA)
# include <cuda.h> // make sure version is defined since nvcc does not define it itself!
# endif
# if CUDA_VERSION < 3000
# error "GLM requires CUDA 3.0 or higher"
# else
# define GLM_COMPILER GLM_COMPILER_CUDA
# endif
// Visual C++
#elif defined(_MSC_VER)
# if _MSC_VER < 1400

View File

@ -27,23 +27,13 @@ namespace glm
template <>
GLM_FUNC_QUALIFIER float fastInverseSqrt<float>(float const & x)
{
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<T, P> tmp(detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)));
return tmp.x;
# else
return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x;
# endif
return detail::compute_inversesqrt<detail::tvec1, float, lowp>::call(detail::tvec1<float, lowp>(x)).x;
}
template <>
GLM_FUNC_QUALIFIER double fastInverseSqrt<double>(double const & x)
{
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
detail::tvec1<T, P> tmp(detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x)));
return tmp.x;
# else
return detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x)).x;
# endif
return detail::compute_inversesqrt<detail::tvec1, double, lowp>::call(detail::tvec1<double, lowp>(x)).x;
}
template <template <class, precision> class vecType, typename T, precision P>