diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/kernel/kernel_bvh.h | 20 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bvh_traversal.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_curve.h | 4 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_light.h | 6 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_path.h | 12 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/osl_services.cpp | 2 |
7 files changed, 33 insertions, 25 deletions
diff --git a/intern/cycles/kernel/kernel_bvh.h b/intern/cycles/kernel/kernel_bvh.h index ef5c9100e53..9e0d4847a1f 100644 --- a/intern/cycles/kernel/kernel_bvh.h +++ b/intern/cycles/kernel/kernel_bvh.h @@ -117,7 +117,7 @@ __device_inline void bvh_instance_motion_pop(KernelGlobals *kg, int object, cons __device_inline void bvh_node_intersect(KernelGlobals *kg, bool *traverseChild0, bool *traverseChild1, bool *closestChild1, int *nodeAddr0, int *nodeAddr1, - float3 P, float3 idir, float t, uint visibility, int nodeAddr, float difl = 0.0f, float extmax = 0.0f) + float3 P, float3 idir, float t, uint visibility, int nodeAddr, float difl, float extmax) { float hdiff = 1.0f + difl; float ldiff = 1.0f - difl; @@ -281,7 +281,7 @@ __device_inline void curvebounds(float *lower, float *upper, float *extremta, fl } __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersection *isect, - float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment, uint *lcg_state = NULL, float difl = 0.0f, float extmax = 0.0f) + float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment, uint *lcg_state, float difl, float extmax) { float epsilon = 0.0f; int depth = kernel_data.curve_kernel_data.subdivisions; @@ -305,10 +305,6 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio dir.z / d, 0, -dir.x /d, 0, -dir.x * dir.y /d, d, -dir.y * dir.z /d, 0, dir.x, dir.y, dir.z, 0, - 0, 0, 0, 1) * make_transform( - 1, 0, 0, -P.x, - 0, 1, 0, -P.y, - 0, 0, 1, -P.z, 0, 0, 0, 1); float4 v00 = kernel_tex_fetch(__curves, prim); @@ -324,10 +320,10 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio float4 P2 = kernel_tex_fetch(__curve_keys, k1); float4 P3 = kernel_tex_fetch(__curve_keys, kb); - float3 p0 = transform_point(&htfm, float4_to_float3(P0)); - float3 p1 = transform_point(&htfm, float4_to_float3(P1)); - float3 p2 = transform_point(&htfm, float4_to_float3(P2)); - float3 p3 = transform_point(&htfm, float4_to_float3(P3)); + float3 p0 = transform_point(&htfm, float4_to_float3(P0) - P); + float3 p1 = transform_point(&htfm, float4_to_float3(P1) - P); + float3 p2 = transform_point(&htfm, float4_to_float3(P2) - P); + float3 p3 = transform_point(&htfm, float4_to_float3(P3) - P); float fc = 0.71f; curve_coef[0] = p1; @@ -591,7 +587,7 @@ __device_inline void bvh_cardinal_curve_intersect(KernelGlobals *kg, Intersectio } __device_inline void bvh_curve_intersect(KernelGlobals *kg, Intersection *isect, - float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment, uint *lcg_state = NULL, float difl = 0.0f, float extmax = 0.0f) + float3 P, float3 idir, uint visibility, int object, int curveAddr, int segment, uint *lcg_state, float difl, float extmax) { /* curve Intersection check */ int flags = kernel_data.curve_kernel_data.curveflags; @@ -865,7 +861,7 @@ __device_inline void bvh_triangle_intersect_subsurface(KernelGlobals *kg, Inters #ifdef __HAIR__ -__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect, uint *lcg_state = NULL, float difl = 0.0f, float extmax = 0.0f) +__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect, uint *lcg_state, float difl, float extmax) #else __device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect) #endif diff --git a/intern/cycles/kernel/kernel_bvh_traversal.h b/intern/cycles/kernel/kernel_bvh_traversal.h index aa05f7e2e37..2d75af32abd 100644 --- a/intern/cycles/kernel/kernel_bvh_traversal.h +++ b/intern/cycles/kernel/kernel_bvh_traversal.h @@ -37,7 +37,7 @@ __device bool BVH_FUNCTION_NAME , const uint visibility #endif #if FEATURE(BVH_HAIR_MINIMUM_WIDTH) && !FEATURE(BVH_SUBSURFACE) -, uint *lcg_state = NULL, float difl = 0.0f, float extmax = 0.0f +, uint *lcg_state, float difl, float extmax #endif ) { @@ -87,8 +87,12 @@ __device bool BVH_FUNCTION_NAME #else bvh_node_intersect(kg, &traverseChild0, &traverseChild1, &closestChild1, &nodeAddr, &nodeAddrChild1, +#ifdef __HAIR__ + P, idir, isect->t, visibility, nodeAddr, 0.0f, 0.0f); +#else P, idir, isect->t, visibility, nodeAddr); #endif +#endif if(traverseChild0 != traverseChild1) { /* one child was intersected */ diff --git a/intern/cycles/kernel/kernel_curve.h b/intern/cycles/kernel/kernel_curve.h index e065717888c..dd0c0ac10c2 100644 --- a/intern/cycles/kernel/kernel_curve.h +++ b/intern/cycles/kernel/kernel_curve.h @@ -102,7 +102,7 @@ __device float curve_thickness(KernelGlobals *kg, ShaderData *sd) { float r = 0.0f; - if(sd->segment != ~0) { + if(sd->segment != (int)~0) { float4 curvedata = kernel_tex_fetch(__curves, sd->prim); int k0 = __float_as_int(curvedata.x) + sd->segment; int k1 = k0 + 1; @@ -119,7 +119,7 @@ __device float3 curve_tangent_normal(KernelGlobals *kg, ShaderData *sd) { float3 tgN = make_float3(0.0f,0.0f,0.0f); - if(sd->segment != ~0) { + if(sd->segment != (int)~0) { float normalmix = kernel_data.curve_kernel_data.normalmix; tgN = -(-sd->I - sd->dPdu * (dot(sd->dPdu,-sd->I) * normalmix / len_squared(sd->dPdu))); diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index 2eab293963a..88ee0155f5f 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -486,11 +486,11 @@ __device void curve_segment_light_sample(KernelGlobals *kg, int prim, int object float4 P1 = kernel_tex_fetch(__curve_keys, k0); float4 P2 = kernel_tex_fetch(__curve_keys, k1); - float l = len(P2 - P1); + float l = len(float4_to_float3(P2) - float4_to_float3(P1)); float r1 = P1.w; float r2 = P2.w; - float3 tg = float4_to_float3(P2 - P1) / l; + float3 tg = (float4_to_float3(P2) - float4_to_float3(P1)) / l; float3 xc = make_float3(tg.x * tg.z, tg.y * tg.z, -(tg.x * tg.x + tg.y * tg.y)); if (dot(xc, xc) == 0.0f) xc = make_float3(tg.x * tg.y, -(tg.x * tg.x + tg.z * tg.z), tg.z * tg.y); @@ -561,7 +561,7 @@ __device void light_sample(KernelGlobals *kg, float randt, float randu, float ra #endif #ifdef __HAIR__ - if (segment != ~0) + if (segment != (int)~0) curve_segment_light_sample(kg, prim, object, segment, randu, randv, time, ls); else #endif diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h index faf0ac6035c..b5a179d0b20 100644 --- a/intern/cycles/kernel/kernel_path.h +++ b/intern/cycles/kernel/kernel_path.h @@ -164,7 +164,11 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra return false; Intersection isect; +#ifdef __HAIR__ + bool result = scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, &isect, NULL, 0.0f, 0.0f); +#else bool result = scene_intersect(kg, ray, PATH_RAY_SHADOW_OPAQUE, &isect); +#endif #ifdef __TRANSPARENT_SHADOWS__ if(result && kernel_data.integrator.transparent_shadows) { @@ -198,7 +202,11 @@ __device_inline bool shadow_blocked(KernelGlobals *kg, PathState *state, Ray *ra #endif } +#ifdef __HAIR__ + if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect, NULL, 0.0f, 0.0f)) { +#else if(!scene_intersect(kg, ray, PATH_RAY_SHADOW_TRANSPARENT, &isect)) { +#endif *shadow *= throughput; return false; } @@ -528,7 +536,11 @@ __device void kernel_path_indirect(KernelGlobals *kg, RNG *rng, int sample, Ray /* intersect scene */ Intersection isect; uint visibility = path_state_ray_visibility(kg, &state); +#ifdef __HAIR__ + bool hit = scene_intersect(kg, &ray, visibility, &isect, NULL, 0.0f, 0.0f); +#else bool hit = scene_intersect(kg, &ray, visibility, &isect); +#endif #ifdef __LAMP_MIS__ if(kernel_data.integrator.use_lamp_mis && !(state.flag & PATH_RAY_CAMERA)) { diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index ee221db4267..535b9489985 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -72,12 +72,8 @@ CCL_NAMESPACE_BEGIN #endif #ifdef __KERNEL_OPENCL_APPLE__ -//#define __SVM__ -//#define __EMISSION__ -//#define __IMAGE_TEXTURES__ -//#define __HOLDOUT__ -//#define __PROCEDURAL_TEXTURES__ -//#define __EXTRA_NODES__ +#define __KERNEL_SHADING__ +//#define __KERNEL_ADV_SHADING__ #endif #ifdef __KERNEL_OPENCL_AMD__ diff --git a/intern/cycles/kernel/osl/osl_services.cpp b/intern/cycles/kernel/osl/osl_services.cpp index 7c7248b3b34..7974665900f 100644 --- a/intern/cycles/kernel/osl/osl_services.cpp +++ b/intern/cycles/kernel/osl/osl_services.cpp @@ -861,7 +861,7 @@ bool OSLRenderServices::trace(TraceOpt &options, OSL::ShaderGlobals *sg, tracedata->init = true; /* raytrace */ - return scene_intersect(sd->osl_globals, &ray, ~0, &tracedata->isect); + return scene_intersect(sd->osl_globals, &ray, ~0, &tracedata->isect, NULL, 0.0f, 0.0f); } |