From 093200a449ea38952de52012e324036c106e294b Mon Sep 17 00:00:00 2001 From: Brett Weiland Date: Mon, 27 May 2024 20:56:59 -0500 Subject: boutta switch away from templates --- common.cuh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 common.cuh (limited to 'common.cuh') diff --git a/common.cuh b/common.cuh new file mode 100644 index 0000000..d5a9cdf --- /dev/null +++ b/common.cuh @@ -0,0 +1,43 @@ +#ifndef COMMON_H +#define COMMON_H + +#include "include/helper_math.h" + +/** + +template class vect_t2; +template class vect_t3; +template class vect_t4; + +//this feels so hacky... idk why people are so scared of metaprogramming +template <> class vect_t2 { public: using vect_t = double2; }; +template <> class vect_t3 { public: using vect_t = double3; }; +template <> class vect_t4 { public: using vect_t = double4; }; + +template <> class vect_t2 { public: using vect_t = float2; }; +template <> class vect_t3 { public: using vect_t = float3; }; +template <> class vect_t4 { public: using vect_t = float4; }; + + +template __device__ T vect_create(X x); +template __device__ T vect_create(X x, Y y, Z z); + +//I have no fucking clue if this is right, check me later ig +template __device__ inline float3 vect_create(X x) { return make_float3(x); } + +template __device__ inline float3 vect_create(X x, Y y, Z z) { return make_float3(x, y, z); } +**/ + +/** I'm not sure weather float or double percision is nessesary. I was using +templates, but this changes the structure of my entire project in unwanted +ways, so I'm switching over to typedefs. **/ + +typedef float2 vect_t2; +typedef float3 vect_t3; +typedef float4 vect_t4; +typedef float T; + +#define vect1to3(x) (make_float3(x)) +#define make_vect(x, y, z) (make_float3(x, y, z)) + +#endif -- cgit v1.2.3