Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2016-01-07 01:38:13 +0300
committerThomas Dinges <blender@dingto.org>2016-01-07 01:43:29 +0300
commit83e73a2100688655f0eb2df5cbfac2ca1f051fff (patch)
tree76f1cd502187544777b61fa55f5695b2503993a8 /intern/cycles/kernel/svm/svm_light_path.h
parentbe28706bacfb95e7c3c1b58b183acda0e35977f8 (diff)
Cycles: Refactor how we pass bounce info to light path node.
This commit changes the way how we pass bounce information to the Light Path node. Instead of manualy copying the bounces into ShaderData, we now directly pass PathState. This reduces the arguments that we need to pass around and also makes it easier to extend the feature. This commit also exposes the Transmission Bounce Depth to the Light Path node. It works similar to the Transparent Depth Output: Replace a Transmission lightpath after X bounces with another shader, e.g a Diffuse one. This can be used to avoid black surfaces, due to low amount of max bounces. Reviewed by Sergey and Brecht, thanks for some hlp with this. I tested compilation and usage on CPU (SVM and OSL), CUDA, OpenCL Split and Mega kernel. Hopefully this covers all devices. :)
Diffstat (limited to 'intern/cycles/kernel/svm/svm_light_path.h')
-rw-r--r--intern/cycles/kernel/svm/svm_light_path.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/intern/cycles/kernel/svm/svm_light_path.h b/intern/cycles/kernel/svm/svm_light_path.h
index a235dd35224..94c9fddfab8 100644
--- a/intern/cycles/kernel/svm/svm_light_path.h
+++ b/intern/cycles/kernel/svm/svm_light_path.h
@@ -18,7 +18,7 @@ CCL_NAMESPACE_BEGIN
/* Light Path Node */
-ccl_device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uint out_offset, int path_flag)
+ccl_device void svm_node_light_path(ShaderData *sd, ccl_addr_space PathState *state, float *stack, uint type, uint out_offset, int path_flag)
{
float info = 0.0f;
@@ -33,8 +33,9 @@ ccl_device void svm_node_light_path(ShaderData *sd, float *stack, uint type, uin
case NODE_LP_volume_scatter: info = (path_flag & PATH_RAY_VOLUME_SCATTER)? 1.0f: 0.0f; break;
case NODE_LP_backfacing: info = (ccl_fetch(sd, flag) & SD_BACKFACING)? 1.0f: 0.0f; break;
case NODE_LP_ray_length: info = ccl_fetch(sd, ray_length); break;
- case NODE_LP_ray_depth: info = (float)ccl_fetch(sd, ray_depth); break;
- case NODE_LP_ray_transparent: info = (float)ccl_fetch(sd, transparent_depth); break;
+ case NODE_LP_ray_depth: info = (float)state->bounce; break;
+ case NODE_LP_ray_transparent: info = (float)state->transparent_bounce; break;
+ case NODE_LP_ray_transmission: info = (float)state->transmission_bounce; break;
}
stack_store_float(stack, out_offset, info);