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-28 20:57:30 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-07-28 22:27:13 +0300
commit79ab76e156d4bde937335be784cdf220294600d5 (patch)
tree1a126a9f4c58934e92a6caca2a482f7fd6e444ce /intern/cycles/util/types_float3_impl.h
parentd094a3722c9c00a3d32a66f1f0fffa12619630a8 (diff)
Cleanup: simplifications and consistency for vector types
* OneAPI: remove separate float3 definition * OneAPI: disable operator[] to match other GPUs * OneAPI: make int3 compact to match other GPUs * Use #pragma once * Add __KERNEL_NATIVE_VECTOR_TYPES__ to simplify checks * Remove unused vector3
Diffstat (limited to 'intern/cycles/util/types_float3_impl.h')
-rw-r--r--intern/cycles/util/types_float3_impl.h31
1 files changed, 17 insertions, 14 deletions
diff --git a/intern/cycles/util/types_float3_impl.h b/intern/cycles/util/types_float3_impl.h
index 2e6e864c8ea..cbd3f76dae4 100644
--- a/intern/cycles/util/types_float3_impl.h
+++ b/intern/cycles/util/types_float3_impl.h
@@ -1,20 +1,15 @@
/* SPDX-License-Identifier: Apache-2.0
* Copyright 2011-2022 Blender Foundation */
-#ifndef __UTIL_TYPES_FLOAT3_IMPL_H__
-#define __UTIL_TYPES_FLOAT3_IMPL_H__
+#pragma once
#ifndef __UTIL_TYPES_H__
# error "Do not include this file directly, include util/types.h instead."
#endif
-#ifndef __KERNEL_GPU__
-# include <cstdio>
-#endif
-
CCL_NAMESPACE_BEGIN
-#if !defined(__KERNEL_GPU__)
+#ifndef __KERNEL_NATIVE_VECTOR_TYPES__
# ifdef __KERNEL_SSE__
__forceinline float3::float3()
{
@@ -45,6 +40,7 @@ __forceinline float3 &float3::operator=(const float3 &a)
}
# endif /* __KERNEL_SSE__ */
+# ifndef __KERNEL_GPU__
__forceinline float float3::operator[](int i) const
{
util_assert(i >= 0);
@@ -58,23 +54,32 @@ __forceinline float &float3::operator[](int i)
util_assert(i < 3);
return *(&x + i);
}
+# endif
ccl_device_inline float3 make_float3(float f)
{
-# ifdef __KERNEL_SSE__
- float3 a(_mm_set1_ps(f));
+# ifdef __KERNEL_GPU__
+ float3 a = {f, f, f};
# else
+# ifdef __KERNEL_SSE__
+ float3 a(_mm_set1_ps(f));
+# else
float3 a = {f, f, f, f};
+# endif
# endif
return a;
}
ccl_device_inline float3 make_float3(float x, float y, float z)
{
-# ifdef __KERNEL_SSE__
- float3 a(_mm_set_ps(0.0f, z, y, x));
+# ifdef __KERNEL_GPU__
+ float3 a = {x, y, z};
# else
+# ifdef __KERNEL_SSE__
+ float3 a(_mm_set_ps(0.0f, z, y, x));
+# else
float3 a = {x, y, z, 0.0f};
+# endif
# endif
return a;
}
@@ -83,8 +88,6 @@ ccl_device_inline void print_float3(const char *label, const float3 &a)
{
printf("%s: %.8f %.8f %.8f\n", label, (double)a.x, (double)a.y, (double)a.z);
}
-#endif /* !defined(__KERNEL_GPU__) */
+#endif /* __KERNEL_NATIVE_VECTOR_TYPES__ */
CCL_NAMESPACE_END
-
-#endif /* __UTIL_TYPES_FLOAT3_IMPL_H__ */