Fix: Cycles linear curves on Metal-RT
Metal-RT implementation for curve intersect has an additional self intersection check happening in curve_ribbon_accept(). It is done for all curve types that has PRIMITIVE_CURVE_RIBBON bit set on them, including Thick Linear curves. However, the logic in the function is hardcoded to handle flat ribbon curves with the Catmull Rom basis. This change makes it so curve_ribbon_accept() is only called for the ribbon curve type, not when type has ribbon bit set. Additionally, other places where curve type was checked as a bitmask were fixed. Ref #146072 Pull Request: https://projects.blender.org/blender/blender/pulls/146140
This commit is contained in:
committed by
Sergey Sharybin
parent
e19e9e57ee
commit
15fd8ad7a1
@@ -231,7 +231,7 @@ ccl_device_intersect bool scene_intersect(KernelGlobals kg,
|
||||
isect->type = segment.type;
|
||||
isect->u = intersection.curve_parameter;
|
||||
|
||||
if (segment.type & PRIMITIVE_CURVE_RIBBON) {
|
||||
if ((segment.type & PRIMITIVE_CURVE) == PRIMITIVE_CURVE_RIBBON) {
|
||||
isect->v = curve_ribbon_v(kg,
|
||||
intersection.curve_parameter,
|
||||
intersection.distance,
|
||||
|
||||
@@ -215,7 +215,7 @@ bool metalrt_shadow_all_hit(
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type & PRIMITIVE_CURVE_RIBBON) {
|
||||
if ((type & PRIMITIVE_CURVE) == PRIMITIVE_CURVE_RIBBON) {
|
||||
MetalKernelContext context(launch_params_metal);
|
||||
if (!context.curve_ribbon_accept(nullptr, u, t, ray, object, prim, type)) {
|
||||
/* continue search */
|
||||
@@ -421,7 +421,7 @@ inline TReturnType metalrt_visibility_test(
|
||||
return result;
|
||||
}
|
||||
|
||||
if (type & PRIMITIVE_CURVE_RIBBON) {
|
||||
if ((type & PRIMITIVE_CURVE) == PRIMITIVE_CURVE_RIBBON) {
|
||||
MetalKernelContext context(launch_params_metal);
|
||||
if (!context.curve_ribbon_accept(nullptr, u, t, ray, object, prim, type)) {
|
||||
result.accept = false;
|
||||
@@ -472,7 +472,7 @@ inline TReturnType metalrt_visibility_test_shadow(
|
||||
return result;
|
||||
}
|
||||
|
||||
if (type & PRIMITIVE_CURVE_RIBBON) {
|
||||
if ((type & PRIMITIVE_CURVE) == PRIMITIVE_CURVE_RIBBON) {
|
||||
MetalKernelContext context(launch_params_metal);
|
||||
if (!context.curve_ribbon_accept(nullptr, u, t, ray, object, prim, type)) {
|
||||
result.accept = false;
|
||||
|
||||
@@ -421,7 +421,7 @@ extern "C" __global__ void __intersection__curve_ribbon()
|
||||
const KernelCurveSegment segment = kernel_data_fetch(curve_segments, optixGetPrimitiveIndex());
|
||||
const int prim = segment.prim;
|
||||
const int type = segment.type;
|
||||
if (type & PRIMITIVE_CURVE_RIBBON) {
|
||||
if ((type & PRIMITIVE_CURVE) == PRIMITIVE_CURVE_RIBBON) {
|
||||
optix_intersection_curve(prim, type);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user