Cycles: Prepare BVH traversal code to work with multiple curve primitives per node

This commit is contained in:
Sergey Sharybin 2017-01-12 18:20:19 +01:00
parent f12f906dd9
commit b53ce9a1d0
3 changed files with 8 additions and 7 deletions

@ -297,7 +297,8 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
case PRIMITIVE_MOTION_CURVE: { case PRIMITIVE_MOTION_CURVE: {
for(; prim_addr < prim_addr2; prim_addr++) { for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION(); BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert((kernel_tex_fetch(__prim_type, prim_addr) & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL)); const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit; bool hit;
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) { if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
hit = bvh_cardinal_curve_intersect(kg, hit = bvh_cardinal_curve_intersect(kg,
@ -308,7 +309,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
object, object,
prim_addr, prim_addr,
ray->time, ray->time,
type, curve_type,
lcg_state, lcg_state,
difl, difl,
extmax); extmax);
@ -322,7 +323,7 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
object, object,
prim_addr, prim_addr,
ray->time, ray->time,
type, curve_type,
lcg_state, lcg_state,
difl, difl,
extmax); extmax);

@ -372,7 +372,8 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
case PRIMITIVE_MOTION_CURVE: { case PRIMITIVE_MOTION_CURVE: {
for(; prim_addr < prim_addr2; prim_addr++) { for(; prim_addr < prim_addr2; prim_addr++) {
BVH_DEBUG_NEXT_INTERSECTION(); BVH_DEBUG_NEXT_INTERSECTION();
kernel_assert((kernel_tex_fetch(__prim_type, prim_addr) & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL)); const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
bool hit; bool hit;
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) { if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
hit = bvh_cardinal_curve_intersect(kg, hit = bvh_cardinal_curve_intersect(kg,
@ -383,7 +384,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object, object,
prim_addr, prim_addr,
ray->time, ray->time,
type, curve_type,
lcg_state, lcg_state,
difl, difl,
extmax); extmax);
@ -397,7 +398,7 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
object, object,
prim_addr, prim_addr,
ray->time, ray->time,
type, curve_type,
lcg_state, lcg_state,
difl, difl,
extmax); extmax);

@ -295,7 +295,6 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
int object_flag = kernel_tex_fetch(__object_flag, object); int object_flag = kernel_tex_fetch(__object_flag, object);
if(object_flag & SD_OBJECT_HAS_VOLUME) { if(object_flag & SD_OBJECT_HAS_VOLUME) {
# if BVH_FEATURE(BVH_MOTION) # if BVH_FEATURE(BVH_MOTION)
bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm); bvh_instance_motion_push(kg, object, ray, &P, &dir, &idir, &isect->t, &ob_itfm);
# else # else