Commit: aebade59a9dadbebb81e5af4fc01a970f7d75c2e
Author: Mai Lavelle
Date:   Thu Nov 10 09:10:36 2016 -0500
Branches: cycles_split_kernel
https://developer.blender.org/rBaebade59a9dadbebb81e5af4fc01a970f7d75c2e

Merge branch 'master' into cycles_split_kernel

===================================================================



===================================================================

diff --cc intern/cycles/kernel/kernel_path.h
index 3d7ab66,4237fdb..6d89a89
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@@ -53,6 -53,47 +53,47 @@@
  
  CCL_NAMESPACE_BEGIN
  
+ ccl_device_noinline void kernel_path_ao(KernelGlobals *kg,
+                                         ShaderData *sd,
+                                         ShaderData *emission_sd,
+                                         PathRadiance *L,
+                                         PathState *state,
+                                         RNG *rng,
+                                         float3 throughput,
+                                         float3 ao_alpha)
+ {
+       /* todo: solve correlation */
+       float bsdf_u, bsdf_v;
+ 
+       path_state_rng_2D(kg, rng, state, PRNG_BSDF_U, &bsdf_u, &bsdf_v);
+ 
+       float ao_factor = kernel_data.background.ao_factor;
+       float3 ao_N;
+       float3 ao_bsdf = shader_bsdf_ao(kg, sd, ao_factor, &ao_N);
+       float3 ao_D;
+       float ao_pdf;
+ 
+       sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, &ao_pdf);
+ 
+       if(dot(ccl_fetch(sd, Ng), ao_D) > 0.0f && ao_pdf != 0.0f) {
+               Ray light_ray;
+               float3 ao_shadow;
+ 
+               light_ray.P = ray_offset(ccl_fetch(sd, P), ccl_fetch(sd, Ng));
+               light_ray.D = ao_D;
+               light_ray.t = kernel_data.background.ao_distance;
+ #ifdef __OBJECT_MOTION__
+               light_ray.time = ccl_fetch(sd, time);
 -#endif
++#endif  /* __OBJECT_MOTION__ */
+               light_ray.dP = ccl_fetch(sd, dP);
+               light_ray.dD = differential3_zero();
+ 
+               if(!shadow_blocked(kg, emission_sd, state, &light_ray, 
&ao_shadow)) {
+                       path_radiance_accum_ao(L, throughput, ao_alpha, 
ao_bsdf, ao_shadow, state->bounce);
+               }
+       }
+ }
+ 
  ccl_device void kernel_path_indirect(KernelGlobals *kg,
                                       ShaderData *sd,
                                       ShaderData *emission_sd,
@@@ -305,42 -346,9 +346,9 @@@
  #ifdef __AO__
                /* ambient occlusion */
                if(kernel_data.integrator.use_ambient_occlusion || (sd->flag & 
SD_AO)) {
-                       float bsdf_u, bsdf_v;
-                       path_state_rng_2D(kg, rng, state, PRNG_BSDF_U, &bsdf_u, 
&bsdf_v);
- 
-                       float ao_factor = kernel_data.background.ao_factor;
-                       float3 ao_N;
-                       float3 ao_bsdf = shader_bsdf_ao(kg, sd, ao_factor, 
&ao_N);
-                       float3 ao_D;
-                       float ao_pdf;
-                       float3 ao_alpha = make_float3(0.0f, 0.0f, 0.0f);
- 
-                       sample_cos_hemisphere(ao_N, bsdf_u, bsdf_v, &ao_D, 
&ao_pdf);
- 
-                       if(dot(sd->Ng, ao_D) > 0.0f && ao_pdf != 0.0f) {
-                               Ray light_ray;
-                               float3 ao_shadow;
- 
-                               light_ray.P = ray_offset(sd->P, sd->Ng);
-                               light_ray.D = ao_D;
-                               light_ray.t = 
kernel_data.background.ao_distance;
- #  ifdef __OBJECT_MOTION__
-                               light_ray.time = sd->time;
- #  endif  /* __OBJECT_MOTION__ */
-                               light_ray.dP = sd->dP;
-                               light_ray.dD = differential3_zero();
- 
-                               if(!shadow_blocked(kg, emission_sd, state, 
&light_ray, &ao_shadow)) {
-                                       path_radiance_accum_ao(L,
-                                                              throughput,
-                                                              ao_alpha,
-                                                              ao_bsdf,
-                                                              ao_shadow,
-                                                              state->bounce);
-                               }
-                       }
+                       kernel_path_ao(kg, sd, emission_sd, L, state, rng, 
throughput, make_float3(0.0f, 0.0f, 0.0f));
                }
 -#endif
 +#endif  /* __AO__ */
  
  #ifdef __SUBSURFACE__
                /* bssrdf scatter to a different location on the same object, 
replacing
@@@ -861,9 -828,9 +828,9 @@@ ccl_device_inline float4 kernel_path_in
  #ifdef __AO__
                /* ambient occlusion */
                if(kernel_data.integrator.use_ambient_occlusion || (sd.flag & 
SD_AO)) {
-                       kernel_path_ao(kg, &sd, &emission_sd, &L, &state, rng, 
throughput);
+                       kernel_path_ao(kg, &sd, &emission_sd, &L, &state, rng, 
throughput, shader_bsdf_alpha(kg, &sd));
                }
 -#endif
 +#endif  /* __AO__ */
  
  #ifdef __SUBSURFACE__
                /* bssrdf scatter to a different location on the same object, 
replacing

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to