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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2015-02-21 10:33:21 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2015-02-21 10:35:06 +0300
commit09893ec7fce6672ccb377bdb046e6c8a9a415a37 (patch)
tree7e91df159423efb01d8b87c846b5d0016b424b66 /intern
parent87572091fb73add461090f64f3b4bbaa42e3a093 (diff)
Cycles: Workaround for NVidia OpenCL compilation
It was complaining about explicit __constant to __private memory conversion, which is now worked around using implicit conversion. It's not a real fix i'm afraid and i'm still failing to build OpenCL kernel with latest Linux drivers, but maybe it'll let someone else to investigate what causes compiler to run out of memory?
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/kernel/kernel_camera.h31
1 files changed, 26 insertions, 5 deletions
diff --git a/intern/cycles/kernel/kernel_camera.h b/intern/cycles/kernel/kernel_camera.h
index e6d5714914c..ded222e20ff 100644
--- a/intern/cycles/kernel/kernel_camera.h
+++ b/intern/cycles/kernel/kernel_camera.h
@@ -16,6 +16,17 @@
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(KernelGlobals *kg, float u, float v)
@@ -68,8 +79,11 @@ ccl_device void camera_sample_perspective(KernelGlobals *kg, float raster_x, flo
Transform cameratoworld = kernel_data.cam.cameratoworld;
#ifdef __CAMERA_MOTION__
- if(kernel_data.cam.have_motion)
- transform_motion_interpolate(&cameratoworld, (const DecompMotionTransform*)&kernel_data.cam.motion, ray->time);
+ if(kernel_data.cam.have_motion) {
+ transform_motion_interpolate(&cameratoworld,
+ __motion_as_decoupled_const_ptr(&kernel_data.cam.motion),
+ ray->time);
+ }
#endif
ray->P = transform_point(&cameratoworld, ray->P);
@@ -129,8 +143,11 @@ ccl_device void camera_sample_orthographic(KernelGlobals *kg, float raster_x, fl
Transform cameratoworld = kernel_data.cam.cameratoworld;
#ifdef __CAMERA_MOTION__
- if(kernel_data.cam.have_motion)
- transform_motion_interpolate(&cameratoworld, (const DecompMotionTransform*)&kernel_data.cam.motion, ray->time);
+ if(kernel_data.cam.have_motion) {
+ transform_motion_interpolate(&cameratoworld,
+ __motion_as_decoupled_const_ptr(&kernel_data.cam.motion),
+ ray->time);
+ }
#endif
ray->P = transform_point(&cameratoworld, ray->P);
@@ -204,7 +221,9 @@ ccl_device void camera_sample_panorama(KernelGlobals *kg, float raster_x, float
#ifdef __CAMERA_MOTION__
if(kernel_data.cam.have_motion)
- transform_motion_interpolate(&cameratoworld, (const DecompMotionTransform*)&kernel_data.cam.motion, ray->time);
+ transform_motion_interpolate(&cameratoworld,
+ __motion_as_decoupled_const_ptr(&kernel_data.cam.motion),
+ ray->time);
#endif
ray->P = transform_point(&cameratoworld, ray->P);
@@ -310,5 +329,7 @@ ccl_device_inline float3 camera_world_to_ndc(KernelGlobals *kg, ShaderData *sd,
}
}
+#undef __motion_as_decoupled_const_ptr
+
CCL_NAMESPACE_END