+checkpoint: fix .ispc kernels for compilation with llc->ptx

This commit is contained in:
Evghenii
2014-01-06 08:52:41 +01:00
parent 6c93793750
commit 6500a98747
3 changed files with 26 additions and 2 deletions

View File

@@ -81,6 +81,9 @@ static inline void vnormalize(vec &v) {
}
#if 1
inline
#endif
static void
ray_plane_intersect(Isect &isect, Ray &ray, const uniform Plane &plane) {
float d = -dot(plane.p, plane.n);
@@ -123,6 +126,9 @@ ray_sphere_intersect(Isect &isect, Ray &ray, const uniform Sphere &sphere) {
}
#if 1
inline
#endif
static void
orthoBasis(vec basis[3], vec n) {
basis[2] = n;
@@ -146,6 +152,9 @@ orthoBasis(vec basis[3], vec n) {
}
#if 1
inline
#endif
static float
ambient_occlusion(Isect &isect, const uniform Plane &plane, const uniform Sphere spheres[3],
RNGState &rngstate) {

View File

@@ -108,8 +108,8 @@ objs_gpu/%_ispc.h objs_gpu/%_ispc.bc: %.ispc
objs_gpu/%_llvm_ispc.ptx: objs_gpu/%_ispc.bc
$(LLC) $(LLC_FLAGS) -o $@ $<
objs_gpu/%_nvvm_ispc.ptx: objs_gpu/%_ispc.bc
$(LLVM32DIS) $< -o objs/$*_ispc-ll32.ll
$(PTXGEN) objs/$*_ispc-ll32.ll > $@
$(LLVM32DIS) $< -o objs_gpu/$*_ispc-ll32.ll
$(PTXGEN) objs_gpu/$*_ispc-ll32.ll > $@
# generate an object file from PTX
objs_gpu/%_ispc.o: objs_gpu/%_ispc.ptx

View File

@@ -80,6 +80,9 @@ static inline float Dot(const float3 a, const float3 b) {
}
#if 1
inline
#endif
static void generateRay(uniform const float raster2camera[4][4],
uniform const float camera2world[4][4],
float x, float y, Ray &ray) {
@@ -116,6 +119,9 @@ static void generateRay(uniform const float raster2camera[4][4],
}
#if 1
inline
#endif
static bool_t BBoxIntersect(const uniform float bounds[2][3],
const Ray &ray) {
uniform float3 bounds0 = { bounds[0][0], bounds[0][1], bounds[0][2] };
@@ -155,6 +161,9 @@ static bool_t BBoxIntersect(const uniform float bounds[2][3],
#if 1
inline
#endif
static bool_t TriIntersect(const uniform Triangle &tri, Ray &ray) {
uniform float3 p0 = { tri.p[0][0], tri.p[0][1], tri.p[0][2] };
uniform float3 p1 = { tri.p[1][0], tri.p[1][1], tri.p[1][2] };
@@ -195,6 +204,9 @@ static bool_t TriIntersect(const uniform Triangle &tri, Ray &ray) {
}
#if 1
inline
#endif
bool_t
BVHIntersect(const uniform LinearBVHNode nodes[],
const uniform Triangle tris[], Ray &r) {
@@ -253,6 +265,9 @@ BVHIntersect(const uniform LinearBVHNode nodes[],
}
#if 1
inline
#endif
static void raytrace_tile(uniform int x0, uniform int x1,
uniform int y0, uniform int y1,
uniform int width, uniform int height,