Fix #36526: SSS + hair crash after recent changes.

This commit is contained in:
Brecht Van Lommel
2013-08-21 12:20:38 +00:00
parent 76a4d91dc4
commit 0b42f14079
2 changed files with 9 additions and 5 deletions

View File

@@ -794,7 +794,7 @@ __device_inline void bvh_triangle_intersect_subsurface(KernelGlobals *kg, Inters
#if defined(__SUBSURFACE__) && defined(__HAIR__)
#define BVH_FUNCTION_NAME bvh_intersect_subsurface_hair
#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH
#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR
#include "kernel_bvh_subsurface.h"
#endif
@@ -806,7 +806,7 @@ __device_inline void bvh_triangle_intersect_subsurface(KernelGlobals *kg, Inters
#if defined(__SUBSURFACE__) && defined(__HAIR__) && defined(__OBJECT_MOTION__)
#define BVH_FUNCTION_NAME bvh_intersect_subsurface_hair_motion
#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_HAIR_MINIMUM_WIDTH|BVH_MOTION
#define BVH_FUNCTION_FEATURES BVH_INSTANCING|BVH_HAIR|BVH_MOTION
#include "kernel_bvh_subsurface.h"
#endif

View File

@@ -207,7 +207,13 @@ __device uint BVH_FUNCTION_NAME(KernelGlobals *kg, const Ray *ray, Intersection
--stackPtr;
/* primitive intersection */
while(primAddr < primAddr2) {
for(; primAddr < primAddr2; primAddr++) {
#if FEATURE(BVH_HAIR)
uint segment = kernel_tex_fetch(__prim_segment, primAddr);
if(segment != ~0)
continue;
#endif
/* only primitives from the same object */
uint tri_object = (object == ~0)? kernel_tex_fetch(__prim_object, primAddr): object;
@@ -216,8 +222,6 @@ __device uint BVH_FUNCTION_NAME(KernelGlobals *kg, const Ray *ray, Intersection
/* intersect ray against primitive */
bvh_triangle_intersect_subsurface(kg, isect_array, P, idir, object, primAddr, tmax, &num_hits, lcg_state, max_hits);
}
primAddr++;
}
}
#if FEATURE(BVH_INSTANCING)