The distinction existed for legacy reasons, to easily port of Embree intersection code without affecting the main vector types. However we are now using SIMD for these types as well, so no good reason to keep the distinction. Also more consistently pass these vector types by value in inline functions. Previously it was partially changed for functions used by Metal to avoid having to add address space qualifiers, simple to do it everywhere. Also removes function declarations for vector math headers, serves no real purpose. Differential Revision: https://developer.blender.org/D16146
48 lines
1015 B
C++
48 lines
1015 B
C++
/* SPDX-License-Identifier: Apache-2.0
|
|
* Copyright 2011-2022 Blender Foundation */
|
|
|
|
#ifndef __UTIL_MATH_INT2_H__
|
|
#define __UTIL_MATH_INT2_H__
|
|
|
|
#ifndef __UTIL_MATH_H__
|
|
# error "Do not include this file directly, include util/types.h instead."
|
|
#endif
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
#if !defined(__KERNEL_METAL__)
|
|
ccl_device_inline bool operator==(const int2 a, const int2 b)
|
|
{
|
|
return (a.x == b.x && a.y == b.y);
|
|
}
|
|
|
|
ccl_device_inline int2 operator+(const int2 &a, const int2 &b)
|
|
{
|
|
return make_int2(a.x + b.x, a.y + b.y);
|
|
}
|
|
|
|
ccl_device_inline int2 operator+=(int2 &a, const int2 &b)
|
|
{
|
|
return a = a + b;
|
|
}
|
|
|
|
ccl_device_inline int2 operator-(const int2 &a, const int2 &b)
|
|
{
|
|
return make_int2(a.x - b.x, a.y - b.y);
|
|
}
|
|
|
|
ccl_device_inline int2 operator*(const int2 &a, const int2 &b)
|
|
{
|
|
return make_int2(a.x * b.x, a.y * b.y);
|
|
}
|
|
|
|
ccl_device_inline int2 operator/(const int2 &a, const int2 &b)
|
|
{
|
|
return make_int2(a.x / b.x, a.y / b.y);
|
|
}
|
|
#endif /* !__KERNEL_METAL__ */
|
|
|
|
CCL_NAMESPACE_END
|
|
|
|
#endif /* __UTIL_MATH_INT2_H__ */
|