diff options
author | jon denning <gfxcoder@gmail.com> | 2022-07-29 20:51:49 +0300 |
---|---|---|
committer | jon denning <gfxcoder@gmail.com> | 2022-07-29 20:51:49 +0300 |
commit | 6485941d7a8158381288ce044b657e2c147ff73a (patch) | |
tree | 8fc98916154dfc7d7f57a95732fddb620272d9ac /intern/cycles/util/types_float3_impl.h | |
parent | eee25a175ad3c0736878918bacd4995e67195ec0 (diff) | |
parent | 9b9417b66150fd070619006dbd233369709edf1b (diff) |
Merge branch 'master' into retopo_transformretopo_transform
Diffstat (limited to 'intern/cycles/util/types_float3_impl.h')
-rw-r--r-- | intern/cycles/util/types_float3_impl.h | 31 |
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__ */ |