tRaytracer included as cuh header file, compiles without warnings - sphere - GP… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 513ff2b8bafb8119bce86cf56b4d80d6b1e0519b | |
parent 6c15212f6bc2ff22a3331b26bc6c1ab842132944 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Sun, 4 Nov 2012 16:52:30 +0100 | |
Raytracer included as cuh header file, compiles without warnings | |
Diffstat: | |
M src/Makefile | 5 +---- | |
M src/device.cu | 5 ++++- | |
M src/sphere.cpp | 11 ++++++++++- | |
M src/sphere.h | 16 ++++++++-------- | |
M src/vector_arithmetic.h | 580 -----------------------------… | |
5 files changed, 23 insertions(+), 594 deletions(-) | |
--- | |
diff --git a/src/Makefile b/src/Makefile | |
t@@ -34,7 +34,7 @@ DATE=`date +'%Y.%m.%d-%H:%M:%S'` | |
BACKUPNAME=sphere.$(DATE).tar.gz | |
CCFILES=main.cpp file_io.cpp sphere.cpp | |
-CUFILES=device.cu utility.cu raytracer.cu | |
+CUFILES=device.cu utility.cu | |
CCOBJECTS=$(CCFILES:.cpp=.o) | |
CUOBJECTS=$(CUFILES:.cu=.o) | |
OBJECTS=$(CCOBJECTS) $(CUOBJECTS) | |
t@@ -91,9 +91,6 @@ main.o: main.cpp $(DEPS) | |
sphere.o: sphere.cpp $(DEPS) | |
$(CC) $(CCFLAGS) $(INCLUDES) -c $< -o $@ | |
-raytracer.o: raytracer.cu $(DEPS) | |
- $(NVCC) $(NVCCFLAGS) $(INCLUDES) -c $< -o $@ | |
- | |
../sphere_status: sphere_status.cpp | |
$(CC) $(CCFLAGS) sphere_status.cpp -o ../sphere_status | |
diff --git a/src/device.cu b/src/device.cu | |
t@@ -3,8 +3,10 @@ | |
#include <string> | |
#include <cstdio> | |
#include <cuda.h> | |
+#include <cutil_math.h> | |
-#include "vector_arithmetic.h" | |
+#include "vector_arithmetic.h" // for arbitrary prec. vectors | |
+//#include <vector_functions.h> // for single prec. vectors | |
#include "thrust/device_ptr.h" | |
#include "thrust/sort.h" | |
t@@ -19,6 +21,7 @@ | |
#include "cohesion.cuh" | |
#include "contactsearch.cuh" | |
#include "integration.cuh" | |
+#include "raytracer.cuh" | |
//#include "cuPrintf.cu" | |
diff --git a/src/sphere.cpp b/src/sphere.cpp | |
t@@ -13,7 +13,7 @@ | |
DEM::DEM(const std::string inputbin, | |
const int verbosity, | |
const int checkVals, | |
- const int render) | |
+ const int render_img) | |
: verbose(verbosity) | |
{ | |
using std::cout; | |
t@@ -45,6 +45,15 @@ DEM::DEM(const std::string inputbin, | |
// Initialize CUDA | |
initializeGPU(); | |
+ // Render image using raytracer if requested | |
+ if (render_img == 1) { | |
+ float3 eye = make_float3(0.6f * grid.L[0], | |
+ -2.5f * grid.L[1], | |
+ 0.52f * grid.L[2]); | |
+ //float focalLength = 0.8f*grid.L[0]; | |
+ render(eye); | |
+ } | |
+ | |
} | |
// Destructor: Liberates dynamically allocated host memory | |
diff --git a/src/sphere.h b/src/sphere.h | |
t@@ -96,9 +96,10 @@ class DEM { | |
void checkConstantMemory(void); | |
// Initialize camera values and transfer to constant device memory | |
- void cameraInit(float3 eye, float3 lookat, | |
- float imgw, float hw_ratio, | |
- float focalLength); | |
+ void cameraInit(const float3 eye, | |
+ const float3 lookat, | |
+ const float imgw, | |
+ const float focalLength); | |
// Allocate global device memory to hold data | |
void allocateGlobalDeviceMemory(void); | |
t@@ -146,12 +147,11 @@ class DEM { | |
void startTime(void); | |
// Render particles using raytracing | |
- void render(const char *target, | |
- const Float3 lookat, | |
- const Float3 eye, | |
- const Float focalLength = 1.0, | |
+ void render(//const char *target, | |
+ const float3 eye, | |
+ const float focalLength = 1.0, | |
const int method = 1, | |
- const Float maxval = 1.0e3, | |
+ const float maxval = 1.0e3, | |
const unsigned int img_width = 800, | |
const unsigned int img_height = 800); | |
diff --git a/src/vector_arithmetic.h b/src/vector_arithmetic.h | |
t@@ -24,16 +24,6 @@ inline Float fmaxf(Float a, Float b) | |
return a > b ? a : b; | |
} | |
-inline int max(int a, int b) | |
-{ | |
- return a > b ? a : b; | |
-} | |
- | |
-inline int min(int a, int b) | |
-{ | |
- return a < b ? a : b; | |
-} | |
- | |
inline Float rsqrtf(Float x) | |
{ | |
return 1.0f / sqrtf(x); | |
t@@ -41,48 +31,6 @@ inline Float rsqrtf(Float x) | |
#endif | |
//////////////////////////////////////////////////////////////////////////////… | |
-// constructors | |
-//////////////////////////////////////////////////////////////////////////////… | |
-/*inline __host__ __device__ Float3 MAKE_FLOAT3(Float s) | |
-{ | |
- return MAKE_FLOAT3(s, s, s); | |
-} | |
-inline __host__ __device__ Float3 MAKE_FLOAT3(Float4 a) | |
-{ | |
- return MAKE_FLOAT3(a.x, a.y, a.z); | |
-} | |
-inline __host__ __device__ Float3 MAKE_FLOAT3(int3 a) | |
-{ | |
- return MAKE_FLOAT3(Float(a.x), Float(a.y), Float(a.z)); | |
-} | |
-inline __host__ __device__ Float3 MAKE_FLOAT3(uint3 a) | |
-{ | |
- return MAKE_FLOAT3(Float(a.x), Float(a.y), Float(a.z)); | |
-} | |
- | |
-inline __host__ __device__ Float4 MAKE_FLOAT4(Float s) | |
-{ | |
- return MAKE_FLOAT4(s, s, s, s); | |
-} | |
-inline __host__ __device__ Float4 MAKE_FLOAT4(Float3 a) | |
-{ | |
- return MAKE_FLOAT4(a.x, a.y, a.z, 0.0f); | |
-} | |
-inline __host__ __device__ Float4 MAKE_FLOAT4(Float3 a, Float w) | |
-{ | |
- return MAKE_FLOAT4(a.x, a.y, a.z, w); | |
-} | |
-inline __host__ __device__ Float4 MAKE_FLOAT4(int4 a) | |
-{ | |
- return MAKE_FLOAT4(Float(a.x), Float(a.y), Float(a.z), Float(a.w)); | |
-} | |
-inline __host__ __device__ Float4 MAKE_FLOAT4(uint4 a) | |
-{ | |
- return MAKE_FLOAT4(Float(a.x), Float(a.y), Float(a.z), Float(a.w)); | |
-} | |
-*/ | |
- | |
-//////////////////////////////////////////////////////////////////////////////… | |
// negate | |
//////////////////////////////////////////////////////////////////////////////… | |
inline __host__ __device__ Float3 operator-(Float3 &a) | |
t@@ -98,48 +46,6 @@ inline __host__ __device__ Float4 operator-(Float4 &a) | |
// addition | |
//////////////////////////////////////////////////////////////////////////////… | |
-inline __host__ __device__ int2 operator+(int2 a, int2 b) | |
-{ | |
- return make_int2(a.x + b.x, a.y + b.y); | |
-} | |
-inline __host__ __device__ void operator+=(int2 &a, int2 b) | |
-{ | |
- a.x += b.x; a.y += b.y; | |
-} | |
-inline __host__ __device__ int2 operator+(int2 a, int b) | |
-{ | |
- return make_int2(a.x + b, a.y + b); | |
-} | |
-inline __host__ __device__ int2 operator+(int b, int2 a) | |
-{ | |
- return make_int2(a.x + b, a.y + b); | |
-} | |
-inline __host__ __device__ void operator+=(int2 &a, int b) | |
-{ | |
- a.x += b; a.y += b; | |
-} | |
- | |
-inline __host__ __device__ uint2 operator+(uint2 a, uint2 b) | |
-{ | |
- return make_uint2(a.x + b.x, a.y + b.y); | |
-} | |
-inline __host__ __device__ void operator+=(uint2 &a, uint2 b) | |
-{ | |
- a.x += b.x; a.y += b.y; | |
-} | |
-inline __host__ __device__ uint2 operator+(uint2 a, uint b) | |
-{ | |
- return make_uint2(a.x + b, a.y + b); | |
-} | |
-inline __host__ __device__ uint2 operator+(uint b, uint2 a) | |
-{ | |
- return make_uint2(a.x + b, a.y + b); | |
-} | |
-inline __host__ __device__ void operator+=(uint2 &a, uint b) | |
-{ | |
- a.x += b; a.y += b; | |
-} | |
- | |
inline __host__ __device__ void operator+=(Float2 &a, Float2 b) | |
{ | |
a.x += b.x; a.y += b.y; | |
t@@ -161,48 +67,6 @@ inline __host__ __device__ void operator+=(Float3 &a, Floa… | |
a.x += b; a.y += b; a.z += b; | |
} | |
-inline __host__ __device__ int3 operator+(int3 a, int3 b) | |
-{ | |
- return make_int3(a.x + b.x, a.y + b.y, a.z + b.z); | |
-} | |
-inline __host__ __device__ void operator+=(int3 &a, int3 b) | |
-{ | |
- a.x += b.x; a.y += b.y; a.z += b.z; | |
-} | |
-inline __host__ __device__ int3 operator+(int3 a, int b) | |
-{ | |
- return make_int3(a.x + b, a.y + b, a.z + b); | |
-} | |
-inline __host__ __device__ void operator+=(int3 &a, int b) | |
-{ | |
- a.x += b; a.y += b; a.z += b; | |
-} | |
- | |
-inline __host__ __device__ uint3 operator+(uint3 a, uint3 b) | |
-{ | |
- return make_uint3(a.x + b.x, a.y + b.y, a.z + b.z); | |
-} | |
-inline __host__ __device__ void operator+=(uint3 &a, uint3 b) | |
-{ | |
- a.x += b.x; a.y += b.y; a.z += b.z; | |
-} | |
-inline __host__ __device__ uint3 operator+(uint3 a, uint b) | |
-{ | |
- return make_uint3(a.x + b, a.y + b, a.z + b); | |
-} | |
-inline __host__ __device__ void operator+=(uint3 &a, uint b) | |
-{ | |
- a.x += b; a.y += b; a.z += b; | |
-} | |
- | |
-inline __host__ __device__ int3 operator+(int b, int3 a) | |
-{ | |
- return make_int3(a.x + b, a.y + b, a.z + b); | |
-} | |
-inline __host__ __device__ uint3 operator+(uint b, uint3 a) | |
-{ | |
- return make_uint3(a.x + b, a.y + b, a.z + b); | |
-} | |
inline __host__ __device__ Float3 operator+(Float b, Float3 a) | |
{ | |
return MAKE_FLOAT3(a.x + b, a.y + b, a.z + b); | |
t@@ -229,95 +93,10 @@ inline __host__ __device__ void operator+=(Float4 &a, Flo… | |
a.x += b; a.y += b; a.z += b; a.w += b; | |
} | |
-inline __host__ __device__ int4 operator+(int4 a, int4 b) | |
-{ | |
- return make_int4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); | |
-} | |
-inline __host__ __device__ void operator+=(int4 &a, int4 b) | |
-{ | |
- a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w; | |
-} | |
-inline __host__ __device__ int4 operator+(int4 a, int b) | |
-{ | |
- return make_int4(a.x + b, a.y + b, a.z + b, a.w + b); | |
-} | |
-inline __host__ __device__ int4 operator+(int b, int4 a) | |
-{ | |
- return make_int4(a.x + b, a.y + b, a.z + b, a.w + b); | |
-} | |
-inline __host__ __device__ void operator+=(int4 &a, int b) | |
-{ | |
- a.x += b; a.y += b; a.z += b; a.w += b; | |
-} | |
- | |
-inline __host__ __device__ uint4 operator+(uint4 a, uint4 b) | |
-{ | |
- return make_uint4(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); | |
-} | |
-inline __host__ __device__ void operator+=(uint4 &a, uint4 b) | |
-{ | |
- a.x += b.x; a.y += b.y; a.z += b.z; a.w += b.w; | |
-} | |
-inline __host__ __device__ uint4 operator+(uint4 a, uint b) | |
-{ | |
- return make_uint4(a.x + b, a.y + b, a.z + b, a.w + b); | |
-} | |
-inline __host__ __device__ uint4 operator+(uint b, uint4 a) | |
-{ | |
- return make_uint4(a.x + b, a.y + b, a.z + b, a.w + b); | |
-} | |
-inline __host__ __device__ void operator+=(uint4 &a, uint b) | |
-{ | |
- a.x += b; a.y += b; a.z += b; a.w += b; | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// subtract | |
//////////////////////////////////////////////////////////////////////////////… | |
- | |
-inline __host__ __device__ int2 operator-(int2 a, int2 b) | |
-{ | |
- return make_int2(a.x - b.x, a.y - b.y); | |
-} | |
-inline __host__ __device__ void operator-=(int2 &a, int2 b) | |
-{ | |
- a.x -= b.x; a.y -= b.y; | |
-} | |
-inline __host__ __device__ int2 operator-(int2 a, int b) | |
-{ | |
- return make_int2(a.x - b, a.y - b); | |
-} | |
-inline __host__ __device__ int2 operator-(int b, int2 a) | |
-{ | |
- return make_int2(b - a.x, b - a.y); | |
-} | |
-inline __host__ __device__ void operator-=(int2 &a, int b) | |
-{ | |
- a.x -= b; a.y -= b; | |
-} | |
- | |
-inline __host__ __device__ uint2 operator-(uint2 a, uint2 b) | |
-{ | |
- return make_uint2(a.x - b.x, a.y - b.y); | |
-} | |
-inline __host__ __device__ void operator-=(uint2 &a, uint2 b) | |
-{ | |
- a.x -= b.x; a.y -= b.y; | |
-} | |
-inline __host__ __device__ uint2 operator-(uint2 a, uint b) | |
-{ | |
- return make_uint2(a.x - b, a.y - b); | |
-} | |
-inline __host__ __device__ uint2 operator-(uint b, uint2 a) | |
-{ | |
- return make_uint2(b - a.x, b - a.y); | |
-} | |
-inline __host__ __device__ void operator-=(uint2 &a, uint b) | |
-{ | |
- a.x -= b; a.y -= b; | |
-} | |
- | |
inline __host__ __device__ Float3 operator-(Float3 a, Float3 b) | |
{ | |
return MAKE_FLOAT3(a.x - b.x, a.y - b.y, a.z - b.z); | |
t@@ -339,48 +118,6 @@ inline __host__ __device__ void operator-=(Float3 &a, Flo… | |
a.x -= b; a.y -= b; a.z -= b; | |
} | |
-inline __host__ __device__ int3 operator-(int3 a, int3 b) | |
-{ | |
- return make_int3(a.x - b.x, a.y - b.y, a.z - b.z); | |
-} | |
-inline __host__ __device__ void operator-=(int3 &a, int3 b) | |
-{ | |
- a.x -= b.x; a.y -= b.y; a.z -= b.z; | |
-} | |
-inline __host__ __device__ int3 operator-(int3 a, int b) | |
-{ | |
- return make_int3(a.x - b, a.y - b, a.z - b); | |
-} | |
-inline __host__ __device__ int3 operator-(int b, int3 a) | |
-{ | |
- return make_int3(b - a.x, b - a.y, b - a.z); | |
-} | |
-inline __host__ __device__ void operator-=(int3 &a, int b) | |
-{ | |
- a.x -= b; a.y -= b; a.z -= b; | |
-} | |
- | |
-inline __host__ __device__ uint3 operator-(uint3 a, uint3 b) | |
-{ | |
- return make_uint3(a.x - b.x, a.y - b.y, a.z - b.z); | |
-} | |
-inline __host__ __device__ void operator-=(uint3 &a, uint3 b) | |
-{ | |
- a.x -= b.x; a.y -= b.y; a.z -= b.z; | |
-} | |
-inline __host__ __device__ uint3 operator-(uint3 a, uint b) | |
-{ | |
- return make_uint3(a.x - b, a.y - b, a.z - b); | |
-} | |
-inline __host__ __device__ uint3 operator-(uint b, uint3 a) | |
-{ | |
- return make_uint3(b - a.x, b - a.y, b - a.z); | |
-} | |
-inline __host__ __device__ void operator-=(uint3 &a, uint b) | |
-{ | |
- a.x -= b; a.y -= b; a.z -= b; | |
-} | |
- | |
inline __host__ __device__ Float4 operator-(Float4 a, Float4 b) | |
{ | |
return MAKE_FLOAT4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); | |
t@@ -398,94 +135,10 @@ inline __host__ __device__ void operator-=(Float4 &a, Fl… | |
a.x -= b; a.y -= b; a.z -= b; a.w -= b; | |
} | |
-inline __host__ __device__ int4 operator-(int4 a, int4 b) | |
-{ | |
- return make_int4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); | |
-} | |
-inline __host__ __device__ void operator-=(int4 &a, int4 b) | |
-{ | |
- a.x -= b.x; a.y -= b.y; a.z -= b.z; a.w -= b.w; | |
-} | |
-inline __host__ __device__ int4 operator-(int4 a, int b) | |
-{ | |
- return make_int4(a.x - b, a.y - b, a.z - b, a.w - b); | |
-} | |
-inline __host__ __device__ int4 operator-(int b, int4 a) | |
-{ | |
- return make_int4(b - a.x, b - a.y, b - a.z, b - a.w); | |
-} | |
-inline __host__ __device__ void operator-=(int4 &a, int b) | |
-{ | |
- a.x -= b; a.y -= b; a.z -= b; a.w -= b; | |
-} | |
- | |
-inline __host__ __device__ uint4 operator-(uint4 a, uint4 b) | |
-{ | |
- return make_uint4(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); | |
-} | |
-inline __host__ __device__ void operator-=(uint4 &a, uint4 b) | |
-{ | |
- a.x -= b.x; a.y -= b.y; a.z -= b.z; a.w -= b.w; | |
-} | |
-inline __host__ __device__ uint4 operator-(uint4 a, uint b) | |
-{ | |
- return make_uint4(a.x - b, a.y - b, a.z - b, a.w - b); | |
-} | |
-inline __host__ __device__ uint4 operator-(uint b, uint4 a) | |
-{ | |
- return make_uint4(b - a.x, b - a.y, b - a.z, b - a.w); | |
-} | |
-inline __host__ __device__ void operator-=(uint4 &a, uint b) | |
-{ | |
- a.x -= b; a.y -= b; a.z -= b; a.w -= b; | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// multiply | |
//////////////////////////////////////////////////////////////////////////////… | |
-inline __host__ __device__ int2 operator*(int2 a, int2 b) | |
-{ | |
- return make_int2(a.x * b.x, a.y * b.y); | |
-} | |
-inline __host__ __device__ void operator*=(int2 &a, int2 b) | |
-{ | |
- a.x *= b.x; a.y *= b.y; | |
-} | |
-inline __host__ __device__ int2 operator*(int2 a, int b) | |
-{ | |
- return make_int2(a.x * b, a.y * b); | |
-} | |
-inline __host__ __device__ int2 operator*(int b, int2 a) | |
-{ | |
- return make_int2(b * a.x, b * a.y); | |
-} | |
-inline __host__ __device__ void operator*=(int2 &a, int b) | |
-{ | |
- a.x *= b; a.y *= b; | |
-} | |
- | |
-inline __host__ __device__ uint2 operator*(uint2 a, uint2 b) | |
-{ | |
- return make_uint2(a.x * b.x, a.y * b.y); | |
-} | |
-inline __host__ __device__ void operator*=(uint2 &a, uint2 b) | |
-{ | |
- a.x *= b.x; a.y *= b.y; | |
-} | |
-inline __host__ __device__ uint2 operator*(uint2 a, uint b) | |
-{ | |
- return make_uint2(a.x * b, a.y * b); | |
-} | |
-inline __host__ __device__ uint2 operator*(uint b, uint2 a) | |
-{ | |
- return make_uint2(b * a.x, b * a.y); | |
-} | |
-inline __host__ __device__ void operator*=(uint2 &a, uint b) | |
-{ | |
- a.x *= b; a.y *= b; | |
-} | |
- | |
inline __host__ __device__ Float3 operator*(Float3 a, Float3 b) | |
{ | |
return MAKE_FLOAT3(a.x * b.x, a.y * b.y, a.z * b.z); | |
t@@ -507,48 +160,6 @@ inline __host__ __device__ void operator*=(Float3 &a, Flo… | |
a.x *= b; a.y *= b; a.z *= b; | |
} | |
-inline __host__ __device__ int3 operator*(int3 a, int3 b) | |
-{ | |
- return make_int3(a.x * b.x, a.y * b.y, a.z * b.z); | |
-} | |
-inline __host__ __device__ void operator*=(int3 &a, int3 b) | |
-{ | |
- a.x *= b.x; a.y *= b.y; a.z *= b.z; | |
-} | |
-inline __host__ __device__ int3 operator*(int3 a, int b) | |
-{ | |
- return make_int3(a.x * b, a.y * b, a.z * b); | |
-} | |
-inline __host__ __device__ int3 operator*(int b, int3 a) | |
-{ | |
- return make_int3(b * a.x, b * a.y, b * a.z); | |
-} | |
-inline __host__ __device__ void operator*=(int3 &a, int b) | |
-{ | |
- a.x *= b; a.y *= b; a.z *= b; | |
-} | |
- | |
-inline __host__ __device__ uint3 operator*(uint3 a, uint3 b) | |
-{ | |
- return make_uint3(a.x * b.x, a.y * b.y, a.z * b.z); | |
-} | |
-inline __host__ __device__ void operator*=(uint3 &a, uint3 b) | |
-{ | |
- a.x *= b.x; a.y *= b.y; a.z *= b.z; | |
-} | |
-inline __host__ __device__ uint3 operator*(uint3 a, uint b) | |
-{ | |
- return make_uint3(a.x * b, a.y * b, a.z * b); | |
-} | |
-inline __host__ __device__ uint3 operator*(uint b, uint3 a) | |
-{ | |
- return make_uint3(b * a.x, b * a.y, b * a.z); | |
-} | |
-inline __host__ __device__ void operator*=(uint3 &a, uint b) | |
-{ | |
- a.x *= b; a.y *= b; a.z *= b; | |
-} | |
- | |
inline __host__ __device__ Float4 operator*(Float4 a, Float4 b) | |
{ | |
return MAKE_FLOAT4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); | |
t@@ -570,48 +181,6 @@ inline __host__ __device__ void operator*=(Float4 &a, Flo… | |
a.x *= b; a.y *= b; a.z *= b; a.w *= b; | |
} | |
-inline __host__ __device__ int4 operator*(int4 a, int4 b) | |
-{ | |
- return make_int4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); | |
-} | |
-inline __host__ __device__ void operator*=(int4 &a, int4 b) | |
-{ | |
- a.x *= b.x; a.y *= b.y; a.z *= b.z; a.w *= b.w; | |
-} | |
-inline __host__ __device__ int4 operator*(int4 a, int b) | |
-{ | |
- return make_int4(a.x * b, a.y * b, a.z * b, a.w * b); | |
-} | |
-inline __host__ __device__ int4 operator*(int b, int4 a) | |
-{ | |
- return make_int4(b * a.x, b * a.y, b * a.z, b * a.w); | |
-} | |
-inline __host__ __device__ void operator*=(int4 &a, int b) | |
-{ | |
- a.x *= b; a.y *= b; a.z *= b; a.w *= b; | |
-} | |
- | |
-inline __host__ __device__ uint4 operator*(uint4 a, uint4 b) | |
-{ | |
- return make_uint4(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); | |
-} | |
-inline __host__ __device__ void operator*=(uint4 &a, uint4 b) | |
-{ | |
- a.x *= b.x; a.y *= b.y; a.z *= b.z; a.w *= b.w; | |
-} | |
-inline __host__ __device__ uint4 operator*(uint4 a, uint b) | |
-{ | |
- return make_uint4(a.x * b, a.y * b, a.z * b, a.w * b); | |
-} | |
-inline __host__ __device__ uint4 operator*(uint b, uint4 a) | |
-{ | |
- return make_uint4(b * a.x, b * a.y, b * a.z, b * a.w); | |
-} | |
-inline __host__ __device__ void operator*=(uint4 &a, uint b) | |
-{ | |
- a.x *= b; a.y *= b; a.z *= b; a.w *= b; | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// divide | |
//////////////////////////////////////////////////////////////////////////////… | |
t@@ -670,32 +239,6 @@ inline __host__ __device__ Float4 fminf(Float4 a, Float4… | |
return MAKE_FLOAT4(fminf(a.x,b.x), fminf(a.y,b.y), fminf(a.z,b.z), fmi… | |
} | |
-inline __host__ __device__ int2 min(int2 a, int2 b) | |
-{ | |
- return make_int2(min(a.x,b.x), min(a.y,b.y)); | |
-} | |
-inline __host__ __device__ int3 min(int3 a, int3 b) | |
-{ | |
- return make_int3(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z)); | |
-} | |
-inline __host__ __device__ int4 min(int4 a, int4 b) | |
-{ | |
- return make_int4(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z), min(a.w,b.w)); | |
-} | |
- | |
-inline __host__ __device__ uint2 min(uint2 a, uint2 b) | |
-{ | |
- return make_uint2(min(a.x,b.x), min(a.y,b.y)); | |
-} | |
-inline __host__ __device__ uint3 min(uint3 a, uint3 b) | |
-{ | |
- return make_uint3(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z)); | |
-} | |
-inline __host__ __device__ uint4 min(uint4 a, uint4 b) | |
-{ | |
- return make_uint4(min(a.x,b.x), min(a.y,b.y), min(a.z,b.z), min(a.w,b.w)); | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// max | |
//////////////////////////////////////////////////////////////////////////////… | |
t@@ -709,32 +252,6 @@ inline __host__ __device__ Float4 fmaxf(Float4 a, Float4 … | |
return MAKE_FLOAT4(fmaxf(a.x,b.x), fmaxf(a.y,b.y), fmaxf(a.z,b.z), fma… | |
} | |
-inline __host__ __device__ int2 max(int2 a, int2 b) | |
-{ | |
- return make_int2(max(a.x,b.x), max(a.y,b.y)); | |
-} | |
-inline __host__ __device__ int3 max(int3 a, int3 b) | |
-{ | |
- return make_int3(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z)); | |
-} | |
-inline __host__ __device__ int4 max(int4 a, int4 b) | |
-{ | |
- return make_int4(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z), max(a.w,b.w)); | |
-} | |
- | |
-inline __host__ __device__ uint2 max(uint2 a, uint2 b) | |
-{ | |
- return make_uint2(max(a.x,b.x), max(a.y,b.y)); | |
-} | |
-inline __host__ __device__ uint3 max(uint3 a, uint3 b) | |
-{ | |
- return make_uint3(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z)); | |
-} | |
-inline __host__ __device__ uint4 max(uint4 a, uint4 b) | |
-{ | |
- return make_uint4(max(a.x,b.x), max(a.y,b.y), max(a.z,b.z), max(a.w,b.w)); | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// lerp | |
// - linear interpolation between a and b, based on value t in [0, 1] range | |
t@@ -762,14 +279,6 @@ inline __device__ __host__ Float clamp(Float f, Float a, … | |
{ | |
return fmaxf(a, fminf(f, b)); | |
} | |
-inline __device__ __host__ int clamp(int f, int a, int b) | |
-{ | |
- return max(a, min(f, b)); | |
-} | |
-inline __device__ __host__ uint clamp(uint f, uint a, uint b) | |
-{ | |
- return max(a, min(f, b)); | |
-} | |
inline __device__ __host__ Float3 clamp(Float3 v, Float a, Float b) | |
{ | |
t@@ -788,56 +297,6 @@ inline __device__ __host__ Float4 clamp(Float4 v, Float4 … | |
return MAKE_FLOAT4(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, … | |
} | |
-inline __device__ __host__ int2 clamp(int2 v, int a, int b) | |
-{ | |
- return make_int2(clamp(v.x, a, b), clamp(v.y, a, b)); | |
-} | |
-inline __device__ __host__ int2 clamp(int2 v, int2 a, int2 b) | |
-{ | |
- return make_int2(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y)); | |
-} | |
-inline __device__ __host__ int3 clamp(int3 v, int a, int b) | |
-{ | |
- return make_int3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b)); | |
-} | |
-inline __device__ __host__ int3 clamp(int3 v, int3 a, int3 b) | |
-{ | |
- return make_int3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.… | |
-} | |
-inline __device__ __host__ int4 clamp(int4 v, int a, int b) | |
-{ | |
- return make_int4(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b), cla… | |
-} | |
-inline __device__ __host__ int4 clamp(int4 v, int4 a, int4 b) | |
-{ | |
- return make_int4(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a.… | |
-} | |
- | |
-inline __device__ __host__ uint2 clamp(uint2 v, uint a, uint b) | |
-{ | |
- return make_uint2(clamp(v.x, a, b), clamp(v.y, a, b)); | |
-} | |
-inline __device__ __host__ uint2 clamp(uint2 v, uint2 a, uint2 b) | |
-{ | |
- return make_uint2(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y)); | |
-} | |
-inline __device__ __host__ uint3 clamp(uint3 v, uint a, uint b) | |
-{ | |
- return make_uint3(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b)); | |
-} | |
-inline __device__ __host__ uint3 clamp(uint3 v, uint3 a, uint3 b) | |
-{ | |
- return make_uint3(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a… | |
-} | |
-inline __device__ __host__ uint4 clamp(uint4 v, uint a, uint b) | |
-{ | |
- return make_uint4(clamp(v.x, a, b), clamp(v.y, a, b), clamp(v.z, a, b), cl… | |
-} | |
-inline __device__ __host__ uint4 clamp(uint4 v, uint4 a, uint4 b) | |
-{ | |
- return make_uint4(clamp(v.x, a.x, b.x), clamp(v.y, a.y, b.y), clamp(v.z, a… | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// dot product | |
//////////////////////////////////////////////////////////////////////////////… | |
t@@ -851,32 +310,6 @@ inline __host__ __device__ Float dot(Float4 a, Float4 b) | |
return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; | |
} | |
-inline __host__ __device__ int dot(int2 a, int2 b) | |
-{ | |
- return a.x * b.x + a.y * b.y; | |
-} | |
-inline __host__ __device__ int dot(int3 a, int3 b) | |
-{ | |
- return a.x * b.x + a.y * b.y + a.z * b.z; | |
-} | |
-inline __host__ __device__ int dot(int4 a, int4 b) | |
-{ | |
- return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; | |
-} | |
- | |
-inline __host__ __device__ uint dot(uint2 a, uint2 b) | |
-{ | |
- return a.x * b.x + a.y * b.y; | |
-} | |
-inline __host__ __device__ uint dot(uint3 a, uint3 b) | |
-{ | |
- return a.x * b.x + a.y * b.y + a.z * b.z; | |
-} | |
-inline __host__ __device__ uint dot(uint4 a, uint4 b) | |
-{ | |
- return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w; | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// length | |
//////////////////////////////////////////////////////////////////////////////… | |
t@@ -961,19 +394,6 @@ inline __host__ __device__ Float4 fabs(Float4 v) | |
return MAKE_FLOAT4(fabs(v.x), fabs(v.y), fabs(v.z), fabs(v.w)); | |
} | |
-inline __host__ __device__ int2 abs(int2 v) | |
-{ | |
- return make_int2(abs(v.x), abs(v.y)); | |
-} | |
-inline __host__ __device__ int3 abs(int3 v) | |
-{ | |
- return make_int3(abs(v.x), abs(v.y), abs(v.z)); | |
-} | |
-inline __host__ __device__ int4 abs(int4 v) | |
-{ | |
- return make_int4(abs(v.x), abs(v.y), abs(v.z), abs(v.w)); | |
-} | |
- | |
//////////////////////////////////////////////////////////////////////////////… | |
// reflect | |
// - returns reflection of incident ray I around surface normal N |