Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/geom/geom_bvh_shadow.h
| Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | #if defined(__KERNEL_SSE2__) | ||||
| Psplat[1] = ssef(P.y); | Psplat[1] = ssef(P.y); | ||||
| Psplat[2] = ssef(P.z); | Psplat[2] = ssef(P.z); | ||||
| ssef tsplat(0.0f, 0.0f, -isect_t, -isect_t); | ssef tsplat(0.0f, 0.0f, -isect_t, -isect_t); | ||||
| gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); | gen_idirsplat_swap(pn, shuf_identity, shuf_swap, idir, idirsplat, shufflexyz); | ||||
| #endif | #endif | ||||
| IsectPrecalc isect_precalc; | |||||
| triangle_intersect_precalc(dir, &isect_precalc); | |||||
| /* traversal loop */ | /* traversal loop */ | ||||
| do { | do { | ||||
| do { | do { | ||||
| /* traverse internal nodes */ | /* traverse internal nodes */ | ||||
| while(nodeAddr >= 0 && nodeAddr != ENTRYPOINT_SENTINEL) { | while(nodeAddr >= 0 && nodeAddr != ENTRYPOINT_SENTINEL) { | ||||
| bool traverseChild0, traverseChild1; | bool traverseChild0, traverseChild1; | ||||
| int nodeAddrChild1; | int nodeAddrChild1; | ||||
| ▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | #endif | ||||
| uint type = kernel_tex_fetch(__prim_type, primAddr); | uint type = kernel_tex_fetch(__prim_type, primAddr); | ||||
| /* todo: specialized intersect functions which don't fill in | /* todo: specialized intersect functions which don't fill in | ||||
| * isect unless needed and check SD_HAS_TRANSPARENT_SHADOW? | * isect unless needed and check SD_HAS_TRANSPARENT_SHADOW? | ||||
| * might give a few % performance improvement */ | * might give a few % performance improvement */ | ||||
| switch(type & PRIMITIVE_ALL) { | switch(type & PRIMITIVE_ALL) { | ||||
| case PRIMITIVE_TRIANGLE: { | case PRIMITIVE_TRIANGLE: { | ||||
| hit = triangle_intersect(kg, isect_array, P, dir, PATH_RAY_SHADOW, object, primAddr); | hit = triangle_intersect(kg, &isect_precalc, isect_array, P, dir, PATH_RAY_SHADOW, object, primAddr); | ||||
| break; | break; | ||||
| } | } | ||||
| #if FEATURE(BVH_MOTION) | #if FEATURE(BVH_MOTION) | ||||
| case PRIMITIVE_MOTION_TRIANGLE: { | case PRIMITIVE_MOTION_TRIANGLE: { | ||||
| hit = motion_triangle_intersect(kg, isect_array, P, dir, ray->time, PATH_RAY_SHADOW, object, primAddr); | hit = motion_triangle_intersect(kg, isect_array, P, dir, ray->time, PATH_RAY_SHADOW, object, primAddr); | ||||
| break; | break; | ||||
| } | } | ||||
| #endif | #endif | ||||
| ▲ Show 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | #if FEATURE(BVH_INSTANCING) | ||||
| object = kernel_tex_fetch(__prim_object, -primAddr-1); | object = kernel_tex_fetch(__prim_object, -primAddr-1); | ||||
| #if FEATURE(BVH_MOTION) | #if FEATURE(BVH_MOTION) | ||||
| bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm); | bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect_t, &ob_tfm); | ||||
| #else | #else | ||||
| bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t); | bvh_instance_push(kg, object, ray, &P, &dir, &idir, &isect_t); | ||||
| #endif | #endif | ||||
| triangle_intersect_precalc(dir, &isect_precalc); | |||||
| num_hits_in_instance = 0; | num_hits_in_instance = 0; | ||||
| #if defined(__KERNEL_SSE2__) | #if defined(__KERNEL_SSE2__) | ||||
| Psplat[0] = ssef(P.x); | Psplat[0] = ssef(P.x); | ||||
| Psplat[1] = ssef(P.y); | Psplat[1] = ssef(P.y); | ||||
| Psplat[2] = ssef(P.z); | Psplat[2] = ssef(P.z); | ||||
| isect_array->t = isect_t; | isect_array->t = isect_t; | ||||
| Show All 19 Lines | if(stackPtr >= 0) { | ||||
| float t_fac; | float t_fac; | ||||
| #if FEATURE(BVH_MOTION) | #if FEATURE(BVH_MOTION) | ||||
| bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_tfm); | bvh_instance_motion_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac, &ob_tfm); | ||||
| #else | #else | ||||
| bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac); | bvh_instance_pop_factor(kg, object, ray, &P, &dir, &idir, &t_fac); | ||||
| #endif | #endif | ||||
| triangle_intersect_precalc(dir, &isect_precalc); | |||||
| /* scale isect->t to adjust for instancing */ | /* scale isect->t to adjust for instancing */ | ||||
| for(int i = 0; i < num_hits_in_instance; i++) | for(int i = 0; i < num_hits_in_instance; i++) | ||||
| (isect_array-i-1)->t *= t_fac; | (isect_array-i-1)->t *= t_fac; | ||||
| } | } | ||||
| else { | else { | ||||
| float ignore_t = FLT_MAX; | float ignore_t = FLT_MAX; | ||||
| #if FEATURE(BVH_MOTION) | #if FEATURE(BVH_MOTION) | ||||
| bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_tfm); | bvh_instance_motion_pop(kg, object, ray, &P, &dir, &idir, &ignore_t, &ob_tfm); | ||||
| #else | #else | ||||
| bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); | bvh_instance_pop(kg, object, ray, &P, &dir, &idir, &ignore_t); | ||||
| #endif | #endif | ||||
| triangle_intersect_precalc(dir, &isect_precalc); | |||||
| } | } | ||||
| #if defined(__KERNEL_SSE2__) | #if defined(__KERNEL_SSE2__) | ||||
| Psplat[0] = ssef(P.x); | Psplat[0] = ssef(P.x); | ||||
| Psplat[1] = ssef(P.y); | Psplat[1] = ssef(P.y); | ||||
| Psplat[2] = ssef(P.z); | Psplat[2] = ssef(P.z); | ||||
| isect_t = tmax; | isect_t = tmax; | ||||
| Show All 20 Lines | |||||