diff options
Diffstat (limited to 'intern/cycles/kernel/geom/triangle_intersect.h')
-rw-r--r-- | intern/cycles/kernel/geom/triangle_intersect.h | 45 |
1 files changed, 4 insertions, 41 deletions
diff --git a/intern/cycles/kernel/geom/triangle_intersect.h b/intern/cycles/kernel/geom/triangle_intersect.h index 720eceec4ed..4a7f38131da 100644 --- a/intern/cycles/kernel/geom/triangle_intersect.h +++ b/intern/cycles/kernel/geom/triangle_intersect.h @@ -37,27 +37,11 @@ ccl_device_inline bool triangle_intersect(KernelGlobals kg, { const int prim = kernel_tex_fetch(__prim_index, prim_addr); const uint tri_vindex = kernel_tex_fetch(__tri_vindex, prim).w; -#if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - const ssef *ssef_verts = (ssef *)&kg->__tri_verts.data[tri_vindex]; -#else const float3 tri_a = kernel_tex_fetch(__tri_verts, tri_vindex + 0), tri_b = kernel_tex_fetch(__tri_verts, tri_vindex + 1), tri_c = kernel_tex_fetch(__tri_verts, tri_vindex + 2); -#endif float t, u, v; - if (ray_triangle_intersect(P, - dir, - tmax, -#if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - ssef_verts, -#else - tri_a, - tri_b, - tri_c, -#endif - &u, - &v, - &t)) { + if (ray_triangle_intersect(P, dir, tmax, tri_a, tri_b, tri_c, &u, &v, &t)) { #ifdef __VISIBILITY_FLAG__ /* Visibility flag test. we do it here under the assumption * that most triangles are culled by node flags. @@ -106,27 +90,11 @@ ccl_device_inline bool triangle_intersect_local(KernelGlobals kg, const int prim = kernel_tex_fetch(__prim_index, prim_addr); const uint tri_vindex = kernel_tex_fetch(__tri_vindex, prim).w; -# if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - const ssef *ssef_verts = (ssef *)&kg->__tri_verts.data[tri_vindex]; -# else const float3 tri_a = kernel_tex_fetch(__tri_verts, tri_vindex + 0), tri_b = kernel_tex_fetch(__tri_verts, tri_vindex + 1), tri_c = kernel_tex_fetch(__tri_verts, tri_vindex + 2); -# endif float t, u, v; - if (!ray_triangle_intersect(P, - dir, - tmax, -# if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - ssef_verts, -# else - tri_a, - tri_b, - tri_c, -# endif - &u, - &v, - &t)) { + if (!ray_triangle_intersect(P, dir, tmax, tri_a, tri_b, tri_c, &u, &v, &t)) { return false; } @@ -178,11 +146,6 @@ ccl_device_inline bool triangle_intersect_local(KernelGlobals kg, isect->t = t; /* Record geometric normal. */ -# if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - const float3 tri_a = kernel_tex_fetch(__tri_verts, tri_vindex + 0), - tri_b = kernel_tex_fetch(__tri_verts, tri_vindex + 1), - tri_c = kernel_tex_fetch(__tri_verts, tri_vindex + 2); -# endif local_isect->Ng[hit] = normalize(cross(tri_b - tri_a, tri_c - tri_a)); return false; @@ -264,8 +227,8 @@ ccl_device_inline float3 triangle_refine_local(KernelGlobals kg, const int isect_object, const int isect_prim) { -#ifdef __KERNEL_OPTIX__ - /* t is always in world space with OptiX. */ +#if defined(__KERNEL_GPU_RAYTRACING__) + /* t is always in world space with OptiX and MetalRT. */ return triangle_refine(kg, sd, P, D, t, isect_object, isect_prim); #else if (!(sd->object_flag & SD_OBJECT_TRANSFORM_APPLIED)) { |