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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-07-29 15:40:50 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-08-09 17:07:23 +0300
commit1988665c3c310cbfb66b4e499408fa48c522545c (patch)
tree5e5771dd13165d9d7ab67fe8837ac088de522eec /intern/cycles/util/types_int3_impl.h
parent9990792e87238386375c97f431f648c1334bd587 (diff)
Cleanup: make vector types make/print functions consistent between CPU and GPU
Now all the same ones are available on CPU and GPU, which was previously not possible due to lack of operator overloadng in OpenCL. Print functions are no-ops on some GPUs. Ref D15535
Diffstat (limited to 'intern/cycles/util/types_int3_impl.h')
-rw-r--r--intern/cycles/util/types_int3_impl.h41
1 files changed, 19 insertions, 22 deletions
diff --git a/intern/cycles/util/types_int3_impl.h b/intern/cycles/util/types_int3_impl.h
index abc0f4e4309..830dfa3c658 100644
--- a/intern/cycles/util/types_int3_impl.h
+++ b/intern/cycles/util/types_int3_impl.h
@@ -56,38 +56,35 @@ __forceinline int &int3::operator[](int i)
}
# endif
-ccl_device_inline int3 make_int3(int i)
+ccl_device_inline int3 make_int3(int x, int y, int z)
{
-# ifdef __KERNEL_GPU__
- int3 a = {i, i, i};
+# if defined(__KERNEL_GPU__)
+ return {x, y, z};
+# elif defined(__KERNEL_SSE__)
+ return int3(_mm_set_epi32(0, z, y, x));
# else
-# ifdef __KERNEL_SSE__
- int3 a(_mm_set1_epi32(i));
-# else
- int3 a = {i, i, i, i};
-# endif
+ return {x, y, z, 0};
# endif
- return a;
}
-ccl_device_inline int3 make_int3(int x, int y, int z)
+#endif /* __KERNEL_NATIVE_VECTOR_TYPES__ */
+
+ccl_device_inline int3 make_int3(int i)
{
-# ifdef __KERNEL_GPU__
- int3 a = {x, y, z};
-# else
-# ifdef __KERNEL_SSE__
- int3 a(_mm_set_epi32(0, z, y, x));
-# else
- int3 a = {x, y, z, 0};
-# endif
-# endif
- return a;
+#if defined(__KERNEL_GPU__)
+ return make_int3(i, i, i);
+#elif defined(__KERNEL_SSE__)
+ return int3(_mm_set1_epi32(i));
+#else
+ return {i, i, i, i};
+#endif
}
-ccl_device_inline void print_int3(const char *label, const int3 &a)
+ccl_device_inline void print_int3(ccl_private const char *label, const int3 a)
{
+#ifdef __KERNEL_PRINTF__
printf("%s: %d %d %d\n", label, a.x, a.y, a.z);
+#endif
}
-#endif /* __KERNEL_NATIVE_VECTOR_TYPES__ */
CCL_NAMESPACE_END