clray

diff rt.cl @ 40:1bcbb53b3505

segfault on exit?
author John Tsiombikas <nuclear@member.fsf.org>
date Fri, 27 Aug 2010 19:00:14 +0100
parents 980bc07be868
children f9eec11e5acc
line diff
     1.1 --- a/rt.cl	Fri Aug 27 18:30:09 2010 +0100
     1.2 +++ b/rt.cl	Fri Aug 27 19:00:14 2010 +0100
     1.3 @@ -132,7 +132,6 @@
     1.4  	coord.y = idx / img_x;
     1.5  
     1.6  	write_imagef(fb, coord, pixel);
     1.7 -	//fb[idx] = pixel;
     1.8  }
     1.9  
    1.10  float4 shade(struct Ray ray, struct Scene *scn, const struct SurfPoint *sp)
    1.11 @@ -187,13 +186,6 @@
    1.12  
    1.13  		global const struct KDNode *node = scn->kdtree + idx;
    1.14  
    1.15 -		/*if(get_global_id(0) == 0) {
    1.16 -			for(int i=0; i<top+1; i++) {
    1.17 -				printf("   ");
    1.18 -			}
    1.19 -			printf("(%d) idx: %d (%p) num_faces: %d\n", top+1, idx, node, node->num_faces);
    1.20 -		}*/
    1.21 -
    1.22  		if(intersect_aabb(ray, node->aabb)) {
    1.23  			if(node->left == -1) {
    1.24  				// leaf node... check each face in turn and update the nearest intersection as needed
    1.25 @@ -207,9 +199,6 @@
    1.26  				}
    1.27  			} else {
    1.28  				// internal node... recurse to the children
    1.29 -				/*if(get_global_id(0) == 0) {
    1.30 -					printf("pushing %d's children %d and %d\n", idx, node->left, node->right);
    1.31 -				}*/
    1.32  				idxstack[top++] = node->left;
    1.33  				idxstack[top++] = node->right;
    1.34  			}
    1.35 @@ -227,29 +216,6 @@
    1.36  	return true;
    1.37  }
    1.38  
    1.39 -/*bool find_intersection(struct Ray ray, const struct Scene *scn, struct SurfPoint *spres)
    1.40 -{
    1.41 -	struct SurfPoint sp, sp0;
    1.42 -	sp0.t = 1.0;
    1.43 -	sp0.obj = 0;
    1.44 -
    1.45 -	for(int i=0; i<scn->num_faces; i++) {
    1.46 -		if(intersect(ray, scn->faces + i, &sp) && sp.t < sp0.t) {
    1.47 -			sp0 = sp;
    1.48 -		}
    1.49 -	}
    1.50 -
    1.51 -	if(!sp0.obj) {
    1.52 -		return false;
    1.53 -	}
    1.54 -
    1.55 -	if(spres) {
    1.56 -		*spres = sp0;
    1.57 -		spres->mat = scn->matlib[sp0.obj->matid];
    1.58 -	}
    1.59 -	return true;
    1.60 -}*/
    1.61 -
    1.62  bool intersect(struct Ray ray, global const struct Face *face, struct SurfPoint *sp)
    1.63  {
    1.64  	float4 origin = ray.origin;