Cycles: Cleanup, remove bvh prefix from curve functions
Those are nothing to do with BVH, and can be used separately.
This commit is contained in:
@@ -221,30 +221,30 @@ bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||||||
case PRIMITIVE_MOTION_CURVE: {
|
case PRIMITIVE_MOTION_CURVE: {
|
||||||
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
|
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
|
||||||
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
|
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
|
||||||
hit = bvh_cardinal_curve_intersect(kg,
|
hit = cardinal_curve_intersect(kg,
|
||||||
isect_array,
|
isect_array,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
NULL,
|
NULL,
|
||||||
0, 0);
|
0, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hit = bvh_curve_intersect(kg,
|
hit = curve_intersect(kg,
|
||||||
isect_array,
|
isect_array,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
NULL,
|
NULL,
|
||||||
0, 0);
|
0, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -298,32 +298,32 @@ ccl_device_noinline bool BVH_FUNCTION_FULL_NAME(BVH)(KernelGlobals *kg,
|
|||||||
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
|
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 = cardinal_curve_intersect(kg,
|
||||||
isect,
|
isect,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
lcg_state,
|
lcg_state,
|
||||||
difl,
|
difl,
|
||||||
extmax);
|
extmax);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hit = bvh_curve_intersect(kg,
|
hit = curve_intersect(kg,
|
||||||
isect,
|
isect,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
lcg_state,
|
lcg_state,
|
||||||
difl,
|
difl,
|
||||||
extmax);
|
extmax);
|
||||||
}
|
}
|
||||||
if(hit) {
|
if(hit) {
|
||||||
/* shadow ray early termination */
|
/* shadow ray early termination */
|
||||||
|
@@ -303,30 +303,30 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||||||
case PRIMITIVE_MOTION_CURVE: {
|
case PRIMITIVE_MOTION_CURVE: {
|
||||||
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
|
const uint curve_type = kernel_tex_fetch(__prim_type, prim_addr);
|
||||||
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
|
if(kernel_data.curve.curveflags & CURVE_KN_INTERPOLATE) {
|
||||||
hit = bvh_cardinal_curve_intersect(kg,
|
hit = cardinal_curve_intersect(kg,
|
||||||
isect_array,
|
isect_array,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
NULL,
|
NULL,
|
||||||
0, 0);
|
0, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hit = bvh_curve_intersect(kg,
|
hit = curve_intersect(kg,
|
||||||
isect_array,
|
isect_array,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
NULL,
|
NULL,
|
||||||
0, 0);
|
0, 0);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -379,32 +379,32 @@ ccl_device bool BVH_FUNCTION_FULL_NAME(QBVH)(KernelGlobals *kg,
|
|||||||
kernel_assert((curve_type & PRIMITIVE_ALL) == (type & PRIMITIVE_ALL));
|
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 = cardinal_curve_intersect(kg,
|
||||||
isect,
|
isect,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
lcg_state,
|
lcg_state,
|
||||||
difl,
|
difl,
|
||||||
extmax);
|
extmax);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
hit = bvh_curve_intersect(kg,
|
hit = curve_intersect(kg,
|
||||||
isect,
|
isect,
|
||||||
P,
|
P,
|
||||||
dir,
|
dir,
|
||||||
visibility,
|
visibility,
|
||||||
object,
|
object,
|
||||||
prim_addr,
|
prim_addr,
|
||||||
ray->time,
|
ray->time,
|
||||||
curve_type,
|
curve_type,
|
||||||
lcg_state,
|
lcg_state,
|
||||||
difl,
|
difl,
|
||||||
extmax);
|
extmax);
|
||||||
}
|
}
|
||||||
if(hit) {
|
if(hit) {
|
||||||
tfar = ssef(isect->t);
|
tfar = ssef(isect->t);
|
||||||
|
@@ -228,11 +228,31 @@ ccl_device_inline ssef transform_point_T3(const ssef t[3], const ssef &a)
|
|||||||
|
|
||||||
#ifdef __KERNEL_SSE2__
|
#ifdef __KERNEL_SSE2__
|
||||||
/* Pass P and dir by reference to aligned vector */
|
/* Pass P and dir by reference to aligned vector */
|
||||||
ccl_device_curveintersect bool bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersection *isect,
|
ccl_device_curveintersect bool cardinal_curve_intersect(KernelGlobals *kg,
|
||||||
const float3 &P, const float3 &dir, uint visibility, int object, int curveAddr, float time, int type, uint *lcg_state, float difl, float extmax)
|
Intersection *isect,
|
||||||
|
const float3 &P,
|
||||||
|
const float3 &dir,
|
||||||
|
uint visibility,
|
||||||
|
int object,
|
||||||
|
int curveAddr,
|
||||||
|
float time,
|
||||||
|
int type,
|
||||||
|
uint *lcg_state,
|
||||||
|
float difl,
|
||||||
|
float extmax)
|
||||||
#else
|
#else
|
||||||
ccl_device_curveintersect bool bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersection *isect,
|
ccl_device_curveintersect bool cardinal_curve_intersect(KernelGlobals *kg,
|
||||||
float3 P, float3 dir, uint visibility, int object, int curveAddr, float time,int type, uint *lcg_state, float difl, float extmax)
|
Intersection *isect,
|
||||||
|
float3 P,
|
||||||
|
float3 dir,
|
||||||
|
uint visibility,
|
||||||
|
int object,
|
||||||
|
int curveAddr,
|
||||||
|
float time,
|
||||||
|
int type,
|
||||||
|
uint *lcg_state,
|
||||||
|
float difl,
|
||||||
|
float extmax)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
const bool is_curve_primitive = (type & PRIMITIVE_CURVE);
|
const bool is_curve_primitive = (type & PRIMITIVE_CURVE);
|
||||||
@@ -694,8 +714,18 @@ ccl_device_curveintersect bool bvh_cardinal_curve_intersect(KernelGlobals *kg, I
|
|||||||
return hit;
|
return hit;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_curveintersect bool bvh_curve_intersect(KernelGlobals *kg, Intersection *isect,
|
ccl_device_curveintersect bool curve_intersect(KernelGlobals *kg,
|
||||||
float3 P, float3 direction, uint visibility, int object, int curveAddr, float time, int type, uint *lcg_state, float difl, float extmax)
|
Intersection *isect,
|
||||||
|
float3 P,
|
||||||
|
float3 direction,
|
||||||
|
uint visibility,
|
||||||
|
int object,
|
||||||
|
int curveAddr,
|
||||||
|
float time,
|
||||||
|
int type,
|
||||||
|
uint *lcg_state,
|
||||||
|
float difl,
|
||||||
|
float extmax)
|
||||||
{
|
{
|
||||||
/* define few macros to minimize code duplication for SSE */
|
/* define few macros to minimize code duplication for SSE */
|
||||||
#ifndef __KERNEL_SSE2__
|
#ifndef __KERNEL_SSE2__
|
||||||
@@ -963,7 +993,10 @@ ccl_device_inline float3 curvepoint(float t, float3 p0, float3 p1, float3 p2, fl
|
|||||||
return data[0] * p0 + data[1] * p1 + data[2] * p2 + data[3] * p3;
|
return data[0] * p0 + data[1] * p1 + data[2] * p2 + data[3] * p3;
|
||||||
}
|
}
|
||||||
|
|
||||||
ccl_device_inline float3 bvh_curve_refine(KernelGlobals *kg, ShaderData *sd, const Intersection *isect, const Ray *ray)
|
ccl_device_inline float3 curve_refine(KernelGlobals *kg,
|
||||||
|
ShaderData *sd,
|
||||||
|
const Intersection *isect,
|
||||||
|
const Ray *ray)
|
||||||
{
|
{
|
||||||
int flag = kernel_data.curve.curveflags;
|
int flag = kernel_data.curve.curveflags;
|
||||||
float t = isect->t;
|
float t = isect->t;
|
||||||
|
@@ -83,7 +83,7 @@ ccl_device_noinline void shader_setup_from_ray(KernelGlobals *kg,
|
|||||||
float4 curvedata = kernel_tex_fetch(__curves, sd->prim);
|
float4 curvedata = kernel_tex_fetch(__curves, sd->prim);
|
||||||
|
|
||||||
sd->shader = __float_as_int(curvedata.z);
|
sd->shader = __float_as_int(curvedata.z);
|
||||||
sd->P = bvh_curve_refine(kg, sd, isect, ray);
|
sd->P = curve_refine(kg, sd, isect, ray);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user