diff options
author | Hristo Gueorguiev <prem.nirved@gmail.com> | 2017-03-08 17:42:26 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-03-09 19:09:37 +0300 |
commit | 57e26627c485baab63e108821b2712d5e234ae7c (patch) | |
tree | e3ee5aa4bf759121559c69504b77d600552bf527 /intern/cycles/kernel/kernel_shadow.h | |
parent | 6c942db30dee14eb37229879656fa049a9ac6df6 (diff) |
Cycles: SSS and Volume rendering in split kernel
Decoupled ray marching is not supported yet.
Transparent shadows are always enabled for volume rendering.
Changes in kernel/bvh and kernel/geom are from Sergey.
This simiplifies code significantly, and prepares it for
record-all transparent shadow function in split kernel.
Diffstat (limited to 'intern/cycles/kernel/kernel_shadow.h')
-rw-r--r-- | intern/cycles/kernel/kernel_shadow.h | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/intern/cycles/kernel/kernel_shadow.h b/intern/cycles/kernel/kernel_shadow.h index 2483c5f9ae1..68a7ccfd903 100644 --- a/intern/cycles/kernel/kernel_shadow.h +++ b/intern/cycles/kernel/kernel_shadow.h @@ -24,7 +24,7 @@ ccl_device_forceinline bool shadow_handle_transparent_isect( ShaderData *shadow_sd, ccl_addr_space PathState *state, # ifdef __VOLUME__ - struct PathState *volume_state, + ccl_addr_space struct PathState *volume_state, # endif Intersection *isect, Ray *ray, @@ -276,7 +276,13 @@ ccl_device bool shadow_blocked_transparent_stepped_loop( float3 Pend = ray->P + ray->D*ray->t; int bounce = state->transparent_bounce; # ifdef __VOLUME__ - PathState ps = *state; +# ifdef __SPLIT_KERNEL__ + ccl_addr_space PathState *ps = &kernel_split_state.state_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)]; +# else + PathState ps_object; + PathState *ps = &ps_object; +# endif + *ps = *state; # endif for(;;) { if(bounce >= kernel_data.integrator.transparent_max_bounce) { @@ -299,7 +305,7 @@ ccl_device bool shadow_blocked_transparent_stepped_loop( shadow_sd, state, #ifdef __VOLUME__ - &ps, + ps, #endif isect, ray, @@ -316,8 +322,8 @@ ccl_device bool shadow_blocked_transparent_stepped_loop( } # ifdef __VOLUME__ /* Attenuation for last line segment towards light. */ - if(ps.volume_stack[0].shader != SHADER_NONE) { - kernel_volume_shadow(kg, shadow_sd, &ps, ray, &throughput); + if(ps->volume_stack[0].shader != SHADER_NONE) { + kernel_volume_shadow(kg, shadow_sd, ps, ray, &throughput); } # endif *shadow *= throughput; @@ -365,21 +371,11 @@ ccl_device bool shadow_blocked_transparent_stepped( ccl_device_inline bool shadow_blocked(KernelGlobals *kg, ShaderData *shadow_sd, ccl_addr_space PathState *state, - ccl_addr_space Ray *ray_input, + Ray *ray_input, float3 *shadow) { - /* Special trickery for split kernel: some data is coming from the - * global memory. - */ -#ifdef __SPLIT_KERNEL__ - Ray private_ray = *ray_input; - Ray *ray = &private_ray; - Intersection *isect = &kernel_split_state.isect_shadow[ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0)]; -#else /* __SPLIT_KERNEL__ */ Ray *ray = ray_input; - Intersection isect_object; - Intersection *isect = &isect_object; -#endif /* __SPLIT_KERNEL__ */ + Intersection isect; /* Some common early checks. */ *shadow = make_float3(1.0f, 1.0f, 1.0f); if(ray->t == 0.0f) { @@ -397,7 +393,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, shadow_sd, state, ray, - isect, + &isect, shadow); } #ifdef __TRANSPARENT_SHADOWS__ @@ -423,11 +419,11 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, const bool blocked = scene_intersect(kg, *ray, PATH_RAY_SHADOW_OPAQUE, - isect, + &isect, NULL, 0.0f, 0.0f); const bool is_transparent_isect = blocked - ? shader_transparent_shadow(kg, isect) + ? shader_transparent_shadow(kg, &isect) : false; if(!blocked || !is_transparent_isect || max_hits + 1 >= SHADOW_STACK_MAX_HITS) @@ -436,7 +432,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, shadow_sd, state, ray, - isect, + &isect, blocked, is_transparent_isect, shadow); @@ -454,7 +450,7 @@ ccl_device_inline bool shadow_blocked(KernelGlobals *kg, shadow_sd, state, ray, - isect, + &isect, shadow); # endif /* __SHADOW_RECORD_ALL__ */ #endif /* __TRANSPARENT_SHADOWS__ */ |