Metal 着色语言是否支持递归?我有代码:
Intersection traceScene(Ray ray, int step) {
Intersection retIntersection = Intersection();
Intersection i1 = trianglePrism.intersect(ray);
Intersection i2 = image.intersect(ray);
if (i1.intersect) {
Ray newRay = Ray(i1.position, Refract(ray.direction, trianglePrism.normal, 0.71));
return traceScene(newRay, step + 1);
} else {
if (i2.intersect) {
return i2;
} else {
return Intersection();
}
}
return retIntersection;
}
但是当我构建使用它的内核函数时,它会发生错误。有任何想法吗?