 
 	real t = AT_MATH_INF;
 
-	for (;;) {
-		if (nodeid < 0) {
-			break;
-		}
-
+	while (nodeid >= 0) {
 		node = tex1Dfetch<float4>(nodes, 4 * nodeid + 0);	// x : hit, y: miss
 		attrib = tex1Dfetch<float4>(nodes, 4 * nodeid + 1);	// x : shapeid, y : primgid, z : exid
 		aabb[0] = tex1Dfetch<float4>(nodes, 4 * nodeid + 2);

				isectTmp.mtrlid = s->mtrl.idx;
			}

			if (isHit) {
				if (isectTmp.t < isect->t) {
					*isect = isectTmp;
					isect->objid = (int)attrib.x;

					if (type == IntersectType::Closer) {
						return true;
					}
				}
			}
		}


	isect->t = t_max;

	while (nodeid >= 0) {
		node = tex1Dfetch<float4>(nodes, 4 * nodeid + 0);	// x : hit, y: miss
		attrib = tex1Dfetch<float4>(nodes, 4 * nodeid + 1);	// x : shapeid, y : primid, z : exid
		_boxmin = tex1Dfetch<float4>(nodes, 4 * nodeid + 2);
		_boxmax = tex1Dfetch<float4>(nodes, 4 * nodeid + 3);

