Skip to content

Commit

Permalink
Merge pull request g-truc#1106 from stephen-hqxu/cuda-qualifier
Browse files Browse the repository at this point in the history
Add define macro to select CUDA function qualifier g-truc#1106
  • Loading branch information
christophe-lunarg authored Oct 24, 2022
2 parents 8339c77 + e1b2d3d commit ebf5170
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions glm/detail/setup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,23 @@
///////////////////////////////////////////////////////////////////////////////////
// Qualifiers

// User defines: GLM_CUDA_FORCE_DEVICE_FUNC, GLM_CUDA_FORCE_HOST_FUNC

#if (GLM_COMPILER & GLM_COMPILER_CUDA) || (GLM_COMPILER & GLM_COMPILER_HIP)
# define GLM_CUDA_FUNC_DEF __device__ __host__
# define GLM_CUDA_FUNC_DECL __device__ __host__
# if defined(GLM_CUDA_FORCE_DEVICE_FUNC) && defined(GLM_CUDA_FORCE_HOST_FUNC)
# error "GLM error: GLM_CUDA_FORCE_DEVICE_FUNC and GLM_CUDA_FORCE_HOST_FUNC should not be defined at the same time, GLM by default generates both device and host code for CUDA compiler."
# endif//defined(GLM_CUDA_FORCE_DEVICE_FUNC) && defined(GLM_CUDA_FORCE_HOST_FUNC)

# if defined(GLM_CUDA_FORCE_DEVICE_FUNC)
# define GLM_CUDA_FUNC_DEF __device__
# define GLM_CUDA_FUNC_DECL __device__
# elif defined(GLM_CUDA_FORCE_HOST_FUNC)
# define GLM_CUDA_FUNC_DEF __host__
# define GLM_CUDA_FUNC_DECL __host__
# else
# define GLM_CUDA_FUNC_DEF __device__ __host__
# define GLM_CUDA_FUNC_DECL __device__ __host__
# endif//defined(GLM_CUDA_FORCE_XXXX_FUNC)
#else
# define GLM_CUDA_FUNC_DEF
# define GLM_CUDA_FUNC_DECL
Expand Down

0 comments on commit ebf5170

Please sign in to comment.