Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-02-04 12:49:19 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-02-04 12:49:19 +0300
commitda06dab4e5c9496f32bd01cf4453a3c9f0ffc5c8 (patch)
tree1d1f79fd3b9be8213544cbd6721a25e9465b6db1 /intern/cycles
parentd16ac1e152a3b7ec7807698b3622056e6951ccd5 (diff)
Cycles: Use pre-aligned triangle vertex coordinates for subsurface intersection
This gives small speedup (around 2% in quick tests) for ray scattering.
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/kernel/geom/geom_triangle_intersect.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/intern/cycles/kernel/geom/geom_triangle_intersect.h b/intern/cycles/kernel/geom/geom_triangle_intersect.h
index 1465aa356da..6f8c3e3e76c 100644
--- a/intern/cycles/kernel/geom/geom_triangle_intersect.h
+++ b/intern/cycles/kernel/geom/geom_triangle_intersect.h
@@ -211,8 +211,9 @@ ccl_device_inline void triangle_intersect_subsurface(
/* Calculate vertices relative to ray origin. */
float3 tri[3];
- int prim = kernel_tex_fetch(__prim_index, triAddr);
- triangle_vertices(kg, prim, tri);
+ tri[0] = float4_to_float3(kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+0));
+ tri[1] = float4_to_float3(kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+1));
+ tri[2] = float4_to_float3(kernel_tex_fetch(__tri_woop, triAddr*TRI_NODE_SIZE+2));
const float3 A = tri[0] - P;
const float3 B = tri[1] - P;
@@ -389,8 +390,9 @@ ccl_device_inline float3 triangle_refine_subsurface(KernelGlobals *kg,
P = P + D*t;
float3 tri[3];
- int prim = kernel_tex_fetch(__prim_index, isect->prim);
- triangle_vertices(kg, prim, tri);
+ tri[0] = float4_to_float3(kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+0));
+ tri[1] = float4_to_float3(kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+1));
+ tri[2] = float4_to_float3(kernel_tex_fetch(__tri_woop, isect->prim*TRI_NODE_SIZE+2));
float3 edge1 = tri[0] - tri[2];
float3 edge2 = tri[1] - tri[2];