[Bf-blender-cvs] [40670b0b14] temp-cycles-denoising: Merge updated shadowcatcher into temp-cycles-denoising

Lukas Stockner noreply at git.blender.org
Fri Mar 24 20:18:26 CET 2017


Commit: 40670b0b14057a45d54bae4b33e853975085ba4e
Author: Lukas Stockner
Date:   Thu Mar 23 15:59:08 2017 +0100
Branches: temp-cycles-denoising
https://developer.blender.org/rB40670b0b14057a45d54bae4b33e853975085ba4e

Merge updated shadowcatcher into temp-cycles-denoising

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



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

diff --cc intern/cycles/kernel/kernel_path.h
index e19dd36ea1,9ff38a99f1..da1b991a61
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@@ -625,7 -621,7 +624,7 @@@ ccl_device_inline float kernel_path_int
  #ifdef __BACKGROUND__
  			/* sample background shader */
  			float3 L_background = indirect_background(kg, &emission_sd, &state, &ray);
- 			path_radiance_accum_background(L, &state, throughput, L_background, state.bounce);
 -			path_radiance_accum_background(&L, &state, throughput, L_background);
++			path_radiance_accum_background(L, &state, throughput, L_background);
  #endif  /* __BACKGROUND__ */
  
  			break;
diff --cc intern/cycles/kernel/kernel_path_branched.h
index 11f92465fb,e675e0db11..54bca56d3f
--- a/intern/cycles/kernel/kernel_path_branched.h
+++ b/intern/cycles/kernel/kernel_path_branched.h
@@@ -481,7 -466,7 +481,7 @@@ ccl_device float kernel_branched_path_i
  #ifdef __BACKGROUND__
  			/* sample background shader */
  			float3 L_background = indirect_background(kg, &emission_sd, &state, &ray);
- 			path_radiance_accum_background(L, &state, throughput, L_background, state.bounce);
 -			path_radiance_accum_background(&L, &state, throughput, L_background);
++			path_radiance_accum_background(L, &state, throughput, L_background);
  #endif  /* __BACKGROUND__ */
  
  			break;
diff --cc intern/cycles/kernel/kernel_path_surface.h
index 059d599e8f,076c82f385..3bc8db909b
--- a/intern/cycles/kernel/kernel_path_surface.h
+++ b/intern/cycles/kernel/kernel_path_surface.h
@@@ -127,11 -133,11 +133,11 @@@ ccl_device_noinline void kernel_branche
  
  				if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
  					/* accumulate */
 -					path_radiance_accum_light(L, throughput*num_samples_adjust, &L_light, shadow, num_samples_adjust, state->bounce, is_lamp);
 +					path_radiance_accum_light(L, state, throughput*num_samples_adjust, &L_light, shadow, num_samples_adjust, is_lamp);
  				}
- 			}
- 			else {
- 				path_radiance_accum_total_light(L, state, throughput*num_samples_adjust, &L_light);
+ 				else {
 -					path_radiance_accum_total_light(L, throughput*num_samples_adjust, &L_light);
++					path_radiance_accum_total_light(L, state, throughput*num_samples_adjust, &L_light);
+ 				}
  			}
  		}
  	}
@@@ -139,9 -145,17 +145,18 @@@
  }
  
  /* branched path tracing: bounce off or through surface to with new direction stored in ray */
- ccl_device bool kernel_branched_path_surface_bounce(KernelGlobals *kg, RNG *rng,
- 	ShaderData *sd, const ShaderClosure *sc, int sample, int num_samples,
- 	float3 *throughput, PathState *state, PathRadiance *L, Ray *ray, float sum_sample_weight)
+ ccl_device bool kernel_branched_path_surface_bounce(
+         KernelGlobals *kg,
+         RNG *rng,
+         ShaderData *sd,
+         const ShaderClosure *sc,
+         int sample,
+         int num_samples,
+         ccl_addr_space float3 *throughput,
+         ccl_addr_space PathState *state,
+         PathRadiance *L,
 -        Ray *ray)
++        Ray *ray,
++	float sum_sample_weight)
  {
  	/* sample BSDF */
  	float bsdf_pdf;
@@@ -247,11 -257,11 +262,11 @@@ ccl_device_inline void kernel_path_surf
  
  			if(!shadow_blocked(kg, emission_sd, state, &light_ray, &shadow)) {
  				/* accumulate */
 -				path_radiance_accum_light(L, throughput, &L_light, shadow, 1.0f, state->bounce, is_lamp);
 +				path_radiance_accum_light(L, state, throughput, &L_light, shadow, 1.0f, is_lamp);
  			}
- 		}
- 		else {
- 			path_radiance_accum_total_light(L, state, throughput, &L_light);
+ 			else {
 -				path_radiance_accum_total_light(L, throughput, &L_light);
++				path_radiance_accum_total_light(L, state, throughput, &L_light);
+ 			}
  		}
  	}
  #endif
diff --cc intern/cycles/kernel/kernel_types.h
index 61e7fa5fc0,1ae624e06c..d84e8938a9
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@@ -162,11 -157,7 +157,8 @@@ CCL_NAMESPACE_BEGI
  #define __INTERSECTION_REFINE__
  #define __CLAMP_SAMPLE__
  #define __PATCH_EVAL__
- 
- #ifndef __SPLIT_KERNEL__
- #  define __SHADOW_TRICKS__
+ #define __SHADOW_TRICKS__
 +#  define __DENOISING_FEATURES__
- #endif
  
  #ifdef __KERNEL_SHADING__
  #  define __SVM__
@@@ -485,14 -462,9 +480,15 @@@ typedef ccl_addr_space struct PathRadia
  	 */
  	float3 path_total_shaded;
  
+ 	/* Color of the background on which shadow is alpha-overed. */
  	float3 shadow_color;
  #endif
 +
 +#ifdef __DENOISING_FEATURES__
 +	float3 denoising_normal;
 +	float3 denoising_albedo;
 +	float denoising_depth;
 +#endif  /* __DENOISING_FEATURES__ */
  } PathRadiance;
  
  typedef struct BsdfEval {
diff --cc intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
index 5b2cec0be2,e220d85738..586d5b42b4
--- a/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
+++ b/intern/cycles/kernel/kernels/cpu/kernel_cpu_impl.h
@@@ -195,28 -167,63 +195,35 @@@ void KERNEL_FUNCTION_FULL_NAME(shader)(
  	{ \
  		kernel_##name(kg); \
  	}
 +#endif /* KERNEL_STUB */
  
+ #define DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(name, type) \
+ 	void KERNEL_FUNCTION_FULL_NAME(name)(KernelGlobals *kg, KernelData* /*data*/) \
+ 	{ \
+ 		ccl_local type locals; \
+ 		kernel_##name(kg, &locals); \
+ 	}
+ 
  DEFINE_SPLIT_KERNEL_FUNCTION(path_init)
  DEFINE_SPLIT_KERNEL_FUNCTION(scene_intersect)
  DEFINE_SPLIT_KERNEL_FUNCTION(lamp_emission)
  DEFINE_SPLIT_KERNEL_FUNCTION(do_volume)
- DEFINE_SPLIT_KERNEL_FUNCTION(queue_enqueue)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(queue_enqueue, QueueEnqueueLocals)
  DEFINE_SPLIT_KERNEL_FUNCTION(indirect_background)
- DEFINE_SPLIT_KERNEL_FUNCTION(shader_eval)
- DEFINE_SPLIT_KERNEL_FUNCTION(holdout_emission_blurring_pathtermination_ao)
- DEFINE_SPLIT_KERNEL_FUNCTION(subsurface_scatter)
- DEFINE_SPLIT_KERNEL_FUNCTION(direct_lighting)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(shader_eval, uint)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(holdout_emission_blurring_pathtermination_ao, BackgroundAOLocals)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(subsurface_scatter, uint)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(direct_lighting, uint)
  DEFINE_SPLIT_KERNEL_FUNCTION(shadow_blocked_ao)
  DEFINE_SPLIT_KERNEL_FUNCTION(shadow_blocked_dl)
- DEFINE_SPLIT_KERNEL_FUNCTION(next_iteration_setup)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(next_iteration_setup, uint)
  DEFINE_SPLIT_KERNEL_FUNCTION(indirect_subsurface)
- DEFINE_SPLIT_KERNEL_FUNCTION(buffer_update)
+ DEFINE_SPLIT_KERNEL_FUNCTION_LOCALS(buffer_update, uint)
  
 -void KERNEL_FUNCTION_FULL_NAME(register_functions)(void(*reg)(const char* name, void* func))
 -{
 -#define REGISTER_NAME_STRING(name) #name
 -#define REGISTER_EVAL_NAME(name) REGISTER_NAME_STRING(name)
 -#define REGISTER(name) reg(REGISTER_EVAL_NAME(KERNEL_FUNCTION_FULL_NAME(name)), (void*)KERNEL_FUNCTION_FULL_NAME(name));
 -
 -	REGISTER(path_trace);
 -	REGISTER(convert_to_byte);
 -	REGISTER(convert_to_half_float);
 -	REGISTER(shader);
 -
 -	REGISTER(data_init);
 -	REGISTER(path_init);
 -	REGISTER(scene_intersect);
 -	REGISTER(lamp_emission);
 -	REGISTER(do_volume);
 -	REGISTER(queue_enqueue);
 -	REGISTER(indirect_background);
 -	REGISTER(shader_eval);
 -	REGISTER(holdout_emission_blurring_pathtermination_ao);
 -	REGISTER(subsurface_scatter);
 -	REGISTER(direct_lighting);
 -	REGISTER(shadow_blocked_ao);
 -	REGISTER(shadow_blocked_dl);
 -	REGISTER(next_iteration_setup);
 -	REGISTER(indirect_subsurface);
 -	REGISTER(buffer_update);
 -
 -#undef REGISTER
 -#undef REGISTER_EVAL_NAME
 -#undef REGISTER_NAME_STRING
 -}
 -
  #endif  /* __SPLIT_KERNEL__ */
  
 +#undef KERNEL_STUB
 +#undef STUB_ASSERT
 +#undef KERNEL_ARCH
 +
  CCL_NAMESPACE_END
diff --cc intern/cycles/kernel/split/kernel_next_iteration_setup.h
index 75f4f9a52a,df5ce92903..21d3d50a45
--- a/intern/cycles/kernel/split/kernel_next_iteration_setup.h
+++ b/intern/cycles/kernel/split/kernel_next_iteration_setup.h
@@@ -130,8 -114,12 +115,11 @@@ ccl_device void kernel_next_iteration_s
  				                       _throughput,
  				                       kernel_split_state.ao_alpha[ray_index],
  				                       kernel_split_state.ao_bsdf[ray_index],
 -				                       shadow,
 -				                       state->bounce);
 +				                       shadow);
  			}
+ 			else {
 -				path_radiance_accum_total_ao(L, _throughput, kernel_split_state.ao_bsdf[ray_index]);
++				path_radiance_accum_total_ao(L, state, _throughput, kernel_split_state.ao_bsdf[ray_index]);
+ 			}
  			REMOVE_RAY_FLAG(ray_state, ray_index, RAY_SHADOW_RAY_CAST_AO);
  		}




More information about the Bf-blender-cvs mailing list