 
 	isect->t = t_max;
 
-	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
+		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);
 


		bool isHit = false;

		if (attrib.x >= 0 || attrib.y >= 0) {
			// Leaf.
			tmpexid = -1;


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

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

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