Blender V4.3
types_int3_impl.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2011-2022 Blender Foundation
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#pragma once
6
7#ifndef __UTIL_TYPES_H__
8# error "Do not include this file directly, include util/types.h instead."
9#endif
10
12
13#ifndef __KERNEL_NATIVE_VECTOR_TYPES__
14# ifdef __KERNEL_SSE__
16
17__forceinline int3::int3(const __m128i &a) : m128(a) {}
18
19__forceinline int3::int3(const int3 &a) : m128(a.m128) {}
20
21__forceinline int3::operator const __m128i &() const
22{
23 return m128;
24}
25
26__forceinline int3::operator __m128i &()
27{
28 return m128;
29}
30
31__forceinline int3 &int3::operator=(const int3 &a)
32{
33 m128 = a.m128;
34 return *this;
35}
36# endif /* __KERNEL_SSE__ */
37
38# ifndef __KERNEL_GPU__
39__forceinline int int3::operator[](int i) const
40{
41 util_assert(i >= 0);
42 util_assert(i < 3);
43 return *(&x + i);
44}
45
47{
48 util_assert(i >= 0);
49 util_assert(i < 3);
50 return *(&x + i);
51}
52
54{
55 util_assert(i < 3);
56 return *(&x + i);
57}
58
60{
61 util_assert(i < 3);
62 return *(&x + i);
63}
64# endif
65
67{
68# if defined(__KERNEL_GPU__)
69 return {x, y, z};
70# elif defined(__KERNEL_SSE__)
71 return int3(_mm_set_epi32(0, z, y, x));
72# else
73 return {x, y, z, 0};
74# endif
75}
76
77#endif /* __KERNEL_NATIVE_VECTOR_TYPES__ */
78
80{
81#if defined(__KERNEL_GPU__)
82 return make_int3(i, i, i);
83#elif defined(__KERNEL_SSE__)
84 return int3(_mm_set1_epi32(i));
85#else
86 return {i, i, i, i};
87#endif
88}
89
91{
92 packed_int3 a = {x, y, z};
93 return a;
94}
95
97{
98#ifdef __KERNEL_PRINTF__
99 printf("%s: %d %d %d\n", label, a.x, a.y, a.z);
100#endif
101}
102
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
Definition btQuadWord.h:117
const int & operator[](int i) const
#define printf
#define util_assert(statement)
Definition defines.h:98
const char * label
#define ccl_private
#define ccl_device_inline
#define CCL_NAMESPACE_END
#define __forceinline
const int32_t & operator[](int index) const
ccl_device_inline void print_int3(ccl_private const char *label, const int3 a)
ccl_device_inline int3 make_int3(int x, int y, int z)
ccl_device_inline packed_int3 make_packed_int3(int x, int y, int z)