[Bf-blender-cvs] [3343962] master: Cycles: Add transformation functions with specified addrspace

Sergey Sharybin noreply at git.blender.org
Thu May 14 16:08:57 CEST 2015


Commit: 33439626f12f84c0f0cc588644d8bf0fce86573a
Author: Sergey Sharybin
Date:   Thu May 14 18:19:21 2015 +0500
Branches: master
https://developer.blender.org/rB33439626f12f84c0f0cc588644d8bf0fce86573a

Cycles: Add transformation functions with specified addrspace

This is required for OpenCL prior to 2.0 and those functions will become
handy when working on camera/motion blur support in split kernel.

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

M	intern/cycles/util/util_transform.h

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

diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h
index 1829ad2..0b87db0 100644
--- a/intern/cycles/util/util_transform.h
+++ b/intern/cycles/util/util_transform.h
@@ -462,6 +462,37 @@ Transform transform_from_viewplane(BoundBox2D& viewplane);
 
 #endif
 
+/* TODO(sergey): This is only for until we've got OpenCL 2.0
+ * on all devices we consider supported. It'll be replaced with
+ * generic address space.
+ */
+
+#ifdef __KERNEL_OPENCL__
+
+#define OPENCL_TRANSFORM_ADDRSPACE_GLUE(a, b) a ## b
+#define OPENCL_TRANSFORM_ADDRSPACE_DECLARE(function) \
+ccl_device_inline float3 OPENCL_TRANSFORM_ADDRSPACE_GLUE(function, _addrspace)( \
+    ccl_addr_space const Transform *t, const float3 a) \
+{ \
+  Transform private_tfm = *t; \
+  return function(&private_tfm, a); \
+}
+
+OPENCL_TRANSFORM_ADDRSPACE_DECLARE(transform_point)
+OPENCL_TRANSFORM_ADDRSPACE_DECLARE(transform_direction)
+OPENCL_TRANSFORM_ADDRSPACE_DECLARE(transform_direction_transposed)
+
+#  undef OPENCL_TRANSFORM_ADDRSPACE_DECLARE
+#  undef OPENCL_TRANSFORM_ADDRSPACE_GLUE
+#  define transform_point_auto transform_point_addrspace
+#  define transform_direction_auto transform_direction_addrspace
+#  define transform_direction_transposed_auto transform_direction_transposed_addrspace
+#else
+#  define transform_point_auto transform_point
+#  define transform_direction_auto transform_direction
+#  define transform_direction_transposed_auto transform_direction_transposed
+#endif
+
 CCL_NAMESPACE_END
 
 #endif /* __UTIL_TRANSFORM_H__ */




More information about the Bf-blender-cvs mailing list