[Bf-blender-cvs] [04d3288a439] split-kernel-faster-building: Cycles: Split kernel_path_background

Mai Lavelle noreply at git.blender.org
Tue Nov 14 07:54:17 CET 2017


Commit: 04d3288a439eec6cd7d9513431c39e8e1784b79f
Author: Mai Lavelle
Date:   Tue Nov 14 00:12:41 2017 -0500
Branches: split-kernel-faster-building
https://developer.blender.org/rB04d3288a439eec6cd7d9513431c39e8e1784b79f

Cycles: Split kernel_path_background

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

M	intern/cycles/kernel/kernel_path.h

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

diff --git a/intern/cycles/kernel/kernel_path.h b/intern/cycles/kernel/kernel_path.h
index 207ba741e6f..741fdb81252 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -127,13 +127,14 @@ ccl_device_forceinline void kernel_path_lamp_emission(
 #endif  /* __LAMP_MIS__ */
 }
 
-ccl_device_forceinline void kernel_path_background(
+ccl_device_forceinline bool kernel_path_background_setup(
 	KernelGlobals *kg,
 	ccl_addr_space PathState *state,
 	ccl_addr_space Ray *ray,
 	float3 throughput,
 	ShaderData *sd,
-	PathRadiance *L)
+	PathRadiance *L,
+	ShaderEvalTask *eval_task)
 {
 	/* eval background shader if nothing hit */
 	if(kernel_data.background.transparent && (state->flag & PATH_RAY_CAMERA)) {
@@ -142,7 +143,7 @@ ccl_device_forceinline void kernel_path_background(
 #ifdef __PASSES__
 		if(!(kernel_data.film.pass_flag & PASS_BACKGROUND))
 #endif  /* __PASSES__ */
-			return;
+			return false;
 	}
 
 	/* When using the ao bounces approximation, adjust background
@@ -153,11 +154,47 @@ ccl_device_forceinline void kernel_path_background(
 
 #ifdef __BACKGROUND__
 	/* sample background shader */
-	float3 L_background = indirect_background(kg, sd, state, ray);
+	return indirect_background_setup(kg, sd, state, ray, eval_task);
+#else
+	return false;
+#endif  /* __BACKGROUND__ */
+}
+
+ccl_device_forceinline void kernel_path_background_finish(
+	KernelGlobals *kg,
+	ccl_addr_space PathState *state,
+	ccl_addr_space Ray *ray,
+	float3 throughput,
+	ShaderData *sd,
+	PathRadiance *L,
+	ShaderEvalTask *eval_task)
+{
+#ifdef __BACKGROUND__
+	/* sample background shader */
+	float3 L_background = indirect_background_finish(kg, sd, state, ray, eval_task);
 	path_radiance_accum_background(L, state, throughput, L_background);
 #endif  /* __BACKGROUND__ */
 }
 
+ccl_device_forceinline void kernel_path_background(
+	KernelGlobals *kg,
+	ccl_addr_space PathState *state,
+	ccl_addr_space Ray *ray,
+	float3 throughput,
+	ShaderData *sd,
+	PathRadiance *L)
+{
+#ifdef __BACKGROUND__
+	MAKE_POINTER_TO_LOCAL_OBJ(ShaderEvalTask, shader_eval_task);
+	if(kernel_path_background_setup(kg, state, ray, throughput, sd, L, shader_eval_task)) {
+		shader_eval(kg, sd, state, shader_eval_task);
+		kernel_path_background_finish(kg, state, ray, throughput, sd, L, shader_eval_task);
+	}
+#else
+	kernel_path_background_setup(kg, state, ray, throughput, sd, L, NULL);
+#endif  /* __BACKGROUND__ */
+}
+
 #ifndef __SPLIT_KERNEL__
 
 #ifdef __VOLUME__



More information about the Bf-blender-cvs mailing list