[Bf-blender-cvs] [bdd5186] cycles_kernel_split: Cycles kernel split: Another attempt to fix error in camera motion

Sergey Sharybin noreply at git.blender.org
Tue May 5 20:52:41 CEST 2015


Commit: bdd5186664020fbae73d2acbeda9fd7258cbc29d
Author: Sergey Sharybin
Date:   Tue May 5 23:52:14 2015 +0500
Branches: cycles_kernel_split
https://developer.blender.org/rBbdd5186664020fbae73d2acbeda9fd7258cbc29d

Cycles kernel split: Another attempt to fix error in camera motion

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

M	intern/cycles/kernel/kernel_camera.h

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

diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index e486198..cbd4c17 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -16,17 +16,6 @@
 
 CCL_NAMESPACE_BEGIN
 
-/* Workaround for explicit conversion from constant to private memory
- * pointer when using OpenCL.
- *
- * TODO(sergey): Find a real solution for this.
- */
-#ifdef __KERNEL_OPENCL__
-#  define __motion_as_decoupled_const_ptr(motion) ((motion))
-#else
-#  define __motion_as_decoupled_const_ptr(motion) ((const DecompMotionTransform*)(motion))
-#endif
-
 /* Perspective Camera */
 
 ccl_device float2 camera_sample_aperture(ccl_addr_space KernelGlobals *kg, float u, float v)
@@ -80,9 +69,16 @@ ccl_device void camera_sample_perspective(ccl_addr_space KernelGlobals *kg, floa
 
 #ifdef __CAMERA_MOTION__
 	if(kernel_data.cam.have_motion) {
+#ifdef __KERNEL_OPENCL__
+		const MotionTransform tfm = kernel_data.cam.motion;
 		transform_motion_interpolate(&cameratoworld,
-		                             __motion_as_decoupled_const_ptr(&kernel_data.cam.motion),
+		                             ((const DecompMotionTransform*)&tfm),
 		                             ray->time);
+#else
+		transform_motion_interpolate(&cameratoworld,
+		                             ((const DecompMotionTransform*)&kernel_data.cam.motion),
+		                             ray->time);
+#endif
 	}
 #endif
 
@@ -143,9 +139,16 @@ ccl_device void camera_sample_orthographic(ccl_addr_space KernelGlobals *kg, flo
 
 #ifdef __CAMERA_MOTION__
 	if(kernel_data.cam.have_motion) {
+#ifdef __KERNEL_OPENCL__
+		const MotionTransform tfm = kernel_data.cam.motion;
+		transform_motion_interpolate(&cameratoworld,
+		                             (const DecompMotionTransform*)&tfm,
+		                             ray->time);
+#else
 		transform_motion_interpolate(&cameratoworld,
-		                             __motion_as_decoupled_const_ptr(&kernel_data.cam.motion),
+		                             (const DecompMotionTransform*)&kernel_data.cam.motion,
 		                             ray->time);
+#endif
 	}
 #endif
 
@@ -219,11 +222,18 @@ ccl_device void camera_sample_panorama(ccl_addr_space KernelGlobals *kg, float r
 	Transform cameratoworld = kernel_data.cam.cameratoworld;
 
 #ifdef __CAMERA_MOTION__
-
-	if(kernel_data.cam.have_motion)
+	if(kernel_data.cam.have_motion) {
+#ifdef __KERNEL_OPENCL__
+		const MotionTransform tfm = kernel_data.cam.motion;
 		transform_motion_interpolate(&cameratoworld,
-		                             __motion_as_decoupled_const_ptr(&kernel_data.cam.motion),
+		                             (const DecompMotionTransform*)&tfm,
 		                             ray->time);
+#else
+		transform_motion_interpolate(&cameratoworld,
+		                             (const DecompMotionTransform*)&kernel_data.cam.motion,
+		                             ray->time);
+#endif
+	}
 #endif
 
 	ray->P = transform_point(&cameratoworld, ray->P);
@@ -329,7 +339,4 @@ ccl_device_inline float3 camera_world_to_ndc(ccl_addr_space KernelGlobals *kg, c
 	}
 }
 
-#undef __motion_as_decoupled_const_ptr
-
 CCL_NAMESPACE_END
-




More information about the Bf-blender-cvs mailing list