Cycles: Split vectorized types into separate files
The final goal to reach is to make vectorized types much easier to maintain and the previous design had following issues: - Having all types and methods implementation made the source file rather bloated and unfun to navigate in. - It was not possible to quickly glance available API for the type you are interested in. - Adding more vectorization types will bloat the file even more, making things even more tricky to follow.
This commit is contained in:
parent
b06cd746ce
commit
51ec9441b7
|
@ -200,6 +200,32 @@ set(SRC_UTIL_HEADERS
|
|||
../util/util_transform.h
|
||||
../util/util_texture.h
|
||||
../util/util_types.h
|
||||
../util/util_types_float2.h
|
||||
../util/util_types_float2_impl.h
|
||||
../util/util_types_float3.h
|
||||
../util/util_types_float3_impl.h
|
||||
../util/util_types_float4.h
|
||||
../util/util_types_float4_impl.h
|
||||
../util/util_types_int2.h
|
||||
../util/util_types_int2_impl.h
|
||||
../util/util_types_int3.h
|
||||
../util/util_types_int3_impl.h
|
||||
../util/util_types_int4.h
|
||||
../util/util_types_int4_impl.h
|
||||
../util/util_types_uchar2.h
|
||||
../util/util_types_uchar2_impl.h
|
||||
../util/util_types_uchar3.h
|
||||
../util/util_types_uchar3_impl.h
|
||||
../util/util_types_uchar4.h
|
||||
../util/util_types_uchar4_impl.h
|
||||
../util/util_types_uint2.h
|
||||
../util/util_types_uint2_impl.h
|
||||
../util/util_types_uint3.h
|
||||
../util/util_types_uint3_impl.h
|
||||
../util/util_types_uint4.h
|
||||
../util/util_types_uint4_impl.h
|
||||
../util/util_types_vector3.h
|
||||
../util/util_types_vector3_impl.h
|
||||
)
|
||||
|
||||
set(SRC_SPLIT_HEADERS
|
||||
|
|
|
@ -80,6 +80,32 @@ set(SRC_HEADERS
|
|||
util_time.h
|
||||
util_transform.h
|
||||
util_types.h
|
||||
util_types_float2.h
|
||||
util_types_float2_impl.h
|
||||
util_types_float3.h
|
||||
util_types_float3_impl.h
|
||||
util_types_float4.h
|
||||
util_types_float4_impl.h
|
||||
util_types_int2.h
|
||||
util_types_int2_impl.h
|
||||
util_types_int3.h
|
||||
util_types_int3_impl.h
|
||||
util_types_int4.h
|
||||
util_types_int4_impl.h
|
||||
util_types_uchar2.h
|
||||
util_types_uchar2_impl.h
|
||||
util_types_uchar3.h
|
||||
util_types_uchar3_impl.h
|
||||
util_types_uchar4.h
|
||||
util_types_uchar4_impl.h
|
||||
util_types_uint2.h
|
||||
util_types_uint2_impl.h
|
||||
util_types_uint3.h
|
||||
util_types_uint3_impl.h
|
||||
util_types_uint4.h
|
||||
util_types_uint4_impl.h
|
||||
util_types_vector3.h
|
||||
util_types_vector3_impl.h
|
||||
util_vector.h
|
||||
util_version.h
|
||||
util_view.h
|
||||
|
|
|
@ -125,339 +125,6 @@ typedef int32_t ssize_t;
|
|||
/* Generic Memory Pointer */
|
||||
|
||||
typedef uint64_t device_ptr;
|
||||
|
||||
/* Vector Types */
|
||||
|
||||
struct uchar2 {
|
||||
uchar x, y;
|
||||
|
||||
__forceinline uchar operator[](int i) const { return *(&x + i); }
|
||||
__forceinline uchar& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct uchar3 {
|
||||
uchar x, y, z;
|
||||
|
||||
__forceinline uchar operator[](int i) const { return *(&x + i); }
|
||||
__forceinline uchar& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct uchar4 {
|
||||
uchar x, y, z, w;
|
||||
|
||||
__forceinline uchar operator[](int i) const { return *(&x + i); }
|
||||
__forceinline uchar& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct int2 {
|
||||
int x, y;
|
||||
|
||||
__forceinline int operator[](int i) const { return *(&x + i); }
|
||||
__forceinline int& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct ccl_try_align(16) int3 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128i m128;
|
||||
struct { int x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline int3() {}
|
||||
__forceinline explicit int3(const __m128i& a) : m128(a) {}
|
||||
__forceinline operator const __m128i&(void) const { return m128; }
|
||||
__forceinline operator __m128i&(void) { return m128; }
|
||||
|
||||
int3(const int3& a) { m128 = a.m128; }
|
||||
int3& operator =(const int3& a) { m128 = a.m128; return *this; }
|
||||
#else
|
||||
int x, y, z, w;
|
||||
#endif
|
||||
|
||||
__forceinline int operator[](int i) const { return *(&x + i); }
|
||||
__forceinline int& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct ccl_try_align(16) int4 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128i m128;
|
||||
struct { int x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline int4() {}
|
||||
__forceinline explicit int4(const __m128i& a) : m128(a) {}
|
||||
__forceinline operator const __m128i&(void) const { return m128; }
|
||||
__forceinline operator __m128i&(void) { return m128; }
|
||||
|
||||
int4(const int4& a) : m128(a.m128) {}
|
||||
int4& operator=(const int4& a) { m128 = a.m128; return *this; }
|
||||
#else
|
||||
int x, y, z, w;
|
||||
#endif
|
||||
|
||||
__forceinline int operator[](int i) const { return *(&x + i); }
|
||||
__forceinline int& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct uint2 {
|
||||
uint x, y;
|
||||
|
||||
__forceinline uint operator[](uint i) const { return *(&x + i); }
|
||||
__forceinline uint& operator[](uint i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct uint3 {
|
||||
uint x, y, z;
|
||||
|
||||
__forceinline uint operator[](uint i) const { return *(&x + i); }
|
||||
__forceinline uint& operator[](uint i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct uint4 {
|
||||
uint x, y, z, w;
|
||||
|
||||
__forceinline uint operator[](uint i) const { return *(&x + i); }
|
||||
__forceinline uint& operator[](uint i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct float2 {
|
||||
float x, y;
|
||||
|
||||
__forceinline float operator[](int i) const { return *(&x + i); }
|
||||
__forceinline float& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct ccl_try_align(16) float3 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128 m128;
|
||||
struct { float x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline float3() {}
|
||||
__forceinline explicit float3(const __m128& a) : m128(a) {}
|
||||
__forceinline operator const __m128&(void) const { return m128; }
|
||||
__forceinline operator __m128&(void) { return m128; }
|
||||
|
||||
__forceinline float3(const float3& a) : m128(a.m128) {}
|
||||
__forceinline float3& operator =(const float3& a) { m128 = a.m128; return *this; }
|
||||
#else
|
||||
float x, y, z, w;
|
||||
#endif
|
||||
|
||||
__forceinline float operator[](int i) const { return *(&x + i); }
|
||||
__forceinline float& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
struct ccl_try_align(16) float4 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128 m128;
|
||||
struct { float x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline float4() {}
|
||||
__forceinline explicit float4(const __m128& a) : m128(a) {}
|
||||
__forceinline operator const __m128&(void) const { return m128; }
|
||||
__forceinline operator __m128&(void) { return m128; }
|
||||
|
||||
__forceinline float4(const float4& a) : m128(a.m128) {}
|
||||
__forceinline float4& operator =(const float4& a) { m128 = a.m128; return *this; }
|
||||
|
||||
#else
|
||||
float x, y, z, w;
|
||||
#endif
|
||||
|
||||
__forceinline float operator[](int i) const { return *(&x + i); }
|
||||
__forceinline float& operator[](int i) { return *(&x + i); }
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class vector3
|
||||
{
|
||||
public:
|
||||
T x, y, z;
|
||||
|
||||
ccl_always_inline vector3() {}
|
||||
ccl_always_inline vector3(const T& a)
|
||||
: x(a), y(a), z(a) {}
|
||||
ccl_always_inline vector3(const T& x, const T& y, const T& z)
|
||||
: x(x), y(y), z(z) {}
|
||||
};
|
||||
|
||||
/* Vector Type Constructors
|
||||
*
|
||||
* OpenCL does not support C++ class, so we use these instead. */
|
||||
|
||||
ccl_device_inline uchar2 make_uchar2(uchar x, uchar y)
|
||||
{
|
||||
uchar2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline uchar3 make_uchar3(uchar x, uchar y, uchar z)
|
||||
{
|
||||
uchar3 a = {x, y, z};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w)
|
||||
{
|
||||
uchar4 a = {x, y, z, w};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int2 make_int2(int x, int y)
|
||||
{
|
||||
int2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int3 make_int3(int x, int y, int z)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int3 a;
|
||||
a.m128 = _mm_set_epi32(0, z, y, x);
|
||||
#else
|
||||
int3 a = {x, y, z, 0};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int4 make_int4(int x, int y, int z, int w)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int4 a;
|
||||
a.m128 = _mm_set_epi32(w, z, y, x);
|
||||
#else
|
||||
int4 a = {x, y, z, w};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline uint2 make_uint2(uint x, uint y)
|
||||
{
|
||||
uint2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline uint3 make_uint3(uint x, uint y, uint z)
|
||||
{
|
||||
uint3 a = {x, y, z};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline uint4 make_uint4(uint x, uint y, uint z, uint w)
|
||||
{
|
||||
uint4 a = {x, y, z, w};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float2 make_float2(float x, float y)
|
||||
{
|
||||
float2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float3 make_float3(float x, float y, float z)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float3 a;
|
||||
a.m128 = _mm_set_ps(0.0f, z, y, x);
|
||||
#else
|
||||
float3 a = {x, y, z, 0.0f};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float4 make_float4(float x, float y, float z, float w)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float4 a;
|
||||
a.m128 = _mm_set_ps(w, z, y, x);
|
||||
#else
|
||||
float4 a = {x, y, z, w};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int3 make_int3(int i)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int3 a;
|
||||
a.m128 = _mm_set1_epi32(i);
|
||||
#else
|
||||
int3 a = {i, i, i, i};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int4 make_int4(int i)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int4 a;
|
||||
a.m128 = _mm_set1_epi32(i);
|
||||
#else
|
||||
int4 a = {i, i, i, i};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float3 make_float3(float f)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float3 a;
|
||||
a.m128 = _mm_set1_ps(f);
|
||||
#else
|
||||
float3 a = {f, f, f, f};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float4 make_float4(float f)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float4 a;
|
||||
a.m128 = _mm_set1_ps(f);
|
||||
#else
|
||||
float4 a = {f, f, f, f};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float4 make_float4(const int4& i)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float4 a;
|
||||
a.m128 = _mm_cvtepi32_ps(i.m128);
|
||||
#else
|
||||
float4 a = {(float)i.x, (float)i.y, (float)i.z, (float)i.w};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int4 make_int4(const float3& f)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int4 a;
|
||||
a.m128 = _mm_cvtps_epi32(f.m128);
|
||||
#else
|
||||
int4 a = {(int)f.x, (int)f.y, (int)f.z, (int)f.w};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
ccl_device_inline size_t align_up(size_t offset, size_t alignment)
|
||||
|
@ -554,5 +221,50 @@ template<typename T> static inline T decltype_helper(T x) { return x; }
|
|||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
# include <cassert>
|
||||
# define util_assert(statement) assert(statement)
|
||||
#else
|
||||
# define util_assert(statement)
|
||||
#endif
|
||||
|
||||
/* Vectorized types declaration. */
|
||||
#include "util/util_types_uchar2.h"
|
||||
#include "util/util_types_uchar3.h"
|
||||
#include "util/util_types_uchar4.h"
|
||||
|
||||
#include "util/util_types_int2.h"
|
||||
#include "util/util_types_int3.h"
|
||||
#include "util/util_types_int4.h"
|
||||
|
||||
#include "util/util_types_uint2.h"
|
||||
#include "util/util_types_uint3.h"
|
||||
#include "util/util_types_uint4.h"
|
||||
|
||||
#include "util/util_types_float2.h"
|
||||
#include "util/util_types_float3.h"
|
||||
#include "util/util_types_float4.h"
|
||||
|
||||
#include "util/util_types_vector3.h"
|
||||
|
||||
/* Vectorized types implementation. */
|
||||
#include "util/util_types_uchar2_impl.h"
|
||||
#include "util/util_types_uchar3_impl.h"
|
||||
#include "util/util_types_uchar4_impl.h"
|
||||
|
||||
#include "util/util_types_int2_impl.h"
|
||||
#include "util/util_types_int3_impl.h"
|
||||
#include "util/util_types_int4_impl.h"
|
||||
|
||||
#include "util/util_types_uint2_impl.h"
|
||||
#include "util/util_types_uint3_impl.h"
|
||||
#include "util/util_types_uint4_impl.h"
|
||||
|
||||
#include "util/util_types_float2_impl.h"
|
||||
#include "util/util_types_float3_impl.h"
|
||||
#include "util/util_types_float4_impl.h"
|
||||
|
||||
#include "util/util_types_vector3_impl.h"
|
||||
|
||||
#endif /* __UTIL_TYPES_H__ */
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_FLOAT2_H__
|
||||
#define __UTIL_TYPES_FLOAT2_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct float2 {
|
||||
float x, y;
|
||||
|
||||
__forceinline float operator[](int i) const;
|
||||
__forceinline float& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline float2 make_float2(float x, float y);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_FLOAT2_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_FLOAT2_IMPL_H__
|
||||
#define __UTIL_TYPES_FLOAT2_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
__forceinline float float2::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline float& float2::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline float2 make_float2(float x, float y)
|
||||
{
|
||||
float2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_FLOAT2_IMPL_H__ */
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_FLOAT3_H__
|
||||
#define __UTIL_TYPES_FLOAT3_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct ccl_try_align(16) float3 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128 m128;
|
||||
struct { float x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline float3();
|
||||
__forceinline float3(const float3& a);
|
||||
__forceinline explicit float3(const __m128& a);
|
||||
|
||||
__forceinline operator const __m128&(void) const;
|
||||
__forceinline operator __m128&(void);
|
||||
|
||||
__forceinline float3& operator =(const float3& a);
|
||||
#else /* __KERNEL_SSE__ */
|
||||
float x, y, z, w;
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline float operator[](int i) const;
|
||||
__forceinline float& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline float3 make_float3(float f);
|
||||
ccl_device_inline float3 make_float3(float x, float y, float z);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_FLOAT3_H__ */
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_FLOAT3_IMPL_H__
|
||||
#define __UTIL_TYPES_FLOAT3_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
#ifdef __KERNEL_SSE__
|
||||
__forceinline float3::float3()
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline float3::float3(const float3& a)
|
||||
: m128(a.m128)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline float3::float3(const __m128& a)
|
||||
: m128(a)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline float3::operator const __m128&(void) const
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline float3::operator __m128&(void)
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline float3& float3::operator =(const float3& a)
|
||||
{
|
||||
m128 = a.m128;
|
||||
return *this;
|
||||
}
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline float float3::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline float& float3::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline float3 make_float3(float f)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float3 a(_mm_set1_ps(f));
|
||||
#else
|
||||
float3 a = {f, f, f, f};
|
||||
#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));
|
||||
#else
|
||||
float3 a = {x, y, z, 0.0f};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_FLOAT3_IMPL_H__ */
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_FLOAT4_H__
|
||||
#define __UTIL_TYPES_FLOAT4_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct int4;
|
||||
|
||||
struct ccl_try_align(16) float4 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128 m128;
|
||||
struct { float x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline float4();
|
||||
__forceinline float4(const float4& a);
|
||||
__forceinline explicit float4(const __m128& a);
|
||||
|
||||
__forceinline operator const __m128&(void) const;
|
||||
__forceinline operator __m128&(void);
|
||||
|
||||
__forceinline float4& operator =(const float4& a);
|
||||
|
||||
#else /* __KERNEL_SSE__ */
|
||||
float x, y, z, w;
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline float operator[](int i) const;
|
||||
__forceinline float& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline float4 make_float4(float f);
|
||||
ccl_device_inline float4 make_float4(float x, float y, float z, float w);
|
||||
ccl_device_inline float4 make_float4(const int4& i);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_FLOAT4_H__ */
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_FLOAT4_IMPL_H__
|
||||
#define __UTIL_TYPES_FLOAT4_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
#ifdef __KERNEL_SSE__
|
||||
__forceinline float4::float4()
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline float4::float4(const float4& a)
|
||||
: m128(a.m128)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline float4::float4(const __m128& a)
|
||||
: m128(a)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline float4::operator const __m128&(void) const
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline float4::operator __m128&(void)
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline float4& float4::operator =(const float4& a)
|
||||
{
|
||||
m128 = a.m128;
|
||||
return *this;
|
||||
}
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline float float4::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 4);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline float& float4::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 4);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline float4 make_float4(float f)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float4 a(_mm_set1_ps(f));
|
||||
#else
|
||||
float4 a = {f, f, f, f};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float4 make_float4(float x, float y, float z, float w)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float4 a(_mm_set_ps(w, z, y, x));
|
||||
#else
|
||||
float4 a = {x, y, z, w};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline float4 make_float4(const int4& i)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
float4 a(_mm_cvtepi32_ps(i.m128));
|
||||
#else
|
||||
float4 a = {(float)i.x, (float)i.y, (float)i.z, (float)i.w};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_FLOAT4_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_INT2_H__
|
||||
#define __UTIL_TYPES_INT2_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct int2 {
|
||||
int x, y;
|
||||
|
||||
__forceinline int operator[](int i) const;
|
||||
__forceinline int& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline int2 make_int2(int x, int y);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_INT2_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_INT2_IMPL_H__
|
||||
#define __UTIL_TYPES_INT2_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
int int2::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
int& int2::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline int2 make_int2(int x, int y)
|
||||
{
|
||||
int2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_INT2_IMPL_H__ */
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_INT3_H__
|
||||
#define __UTIL_TYPES_INT3_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct ccl_try_align(16) int3 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128i m128;
|
||||
struct { int x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline int3();
|
||||
__forceinline int3(const int3& a);
|
||||
__forceinline explicit int3(const __m128i& a);
|
||||
|
||||
__forceinline operator const __m128i&(void) const;
|
||||
__forceinline operator __m128i&(void);
|
||||
|
||||
__forceinline int3& operator =(const int3& a);
|
||||
#else /* __KERNEL_SSE__ */
|
||||
int x, y, z, w;
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline int operator[](int i) const;
|
||||
__forceinline int& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline int3 make_int3(int i);
|
||||
ccl_device_inline int3 make_int3(int x, int y, int z);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_INT3_H__ */
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_INT3_IMPL_H__
|
||||
#define __UTIL_TYPES_INT3_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
#ifdef __KERNEL_SSE__
|
||||
__forceinline int3::int3()
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline int3::int3(const __m128i& a)
|
||||
: m128(a)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline int3::int3(const int3& a)
|
||||
: m128(a.m128)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline int3::operator const __m128i&(void) const
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline int3::operator __m128i&(void)
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline int3& int3::operator =(const int3& a)
|
||||
{
|
||||
m128 = a.m128;
|
||||
return *this;
|
||||
}
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline int int3::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline int& int3::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline int3 make_int3(int i)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int3 a(_mm_set1_epi32(i));
|
||||
#else
|
||||
int3 a = {i, i, i, i};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int3 make_int3(int x, int y, int z)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int3 a(_mm_set_epi32(0, z, y, x));
|
||||
#else
|
||||
int3 a = {x, y, z, 0};
|
||||
#endif
|
||||
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_INT3_IMPL_H__ */
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_INT4_H__
|
||||
#define __UTIL_TYPES_INT4_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
|
||||
struct float3;
|
||||
|
||||
struct ccl_try_align(16) int4 {
|
||||
#ifdef __KERNEL_SSE__
|
||||
union {
|
||||
__m128i m128;
|
||||
struct { int x, y, z, w; };
|
||||
};
|
||||
|
||||
__forceinline int4();
|
||||
__forceinline int4(const int4& a);
|
||||
__forceinline explicit int4(const __m128i& a);
|
||||
|
||||
__forceinline operator const __m128i&(void) const;
|
||||
__forceinline operator __m128i&(void);
|
||||
|
||||
__forceinline int4& operator=(const int4& a);
|
||||
#else /* __KERNEL_SSE__ */
|
||||
int x, y, z, w;
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline int operator[](int i) const;
|
||||
__forceinline int& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline int4 make_int4(int i);
|
||||
ccl_device_inline int4 make_int4(int x, int y, int z, int w);
|
||||
ccl_device_inline int4 make_int4(const float3& f);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_INT4_H__ */
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_INT4_IMPL_H__
|
||||
#define __UTIL_TYPES_INT4_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
#ifdef __KERNEL_SSE__
|
||||
__forceinline int4::int4()
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline int4::int4(const int4& a)
|
||||
: m128(a.m128)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline int4::int4(const __m128i& a)
|
||||
: m128(a)
|
||||
{
|
||||
}
|
||||
|
||||
__forceinline int4::operator const __m128i&(void) const
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline int4::operator __m128i&(void)
|
||||
{
|
||||
return m128;
|
||||
}
|
||||
|
||||
__forceinline int4& int4::operator=(const int4& a)
|
||||
{
|
||||
m128 = a.m128;
|
||||
return *this;
|
||||
}
|
||||
#endif /* __KERNEL_SSE__ */
|
||||
|
||||
__forceinline int int4::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 4);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline int& int4::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 4);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline int4 make_int4(int i)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int4 a(_mm_set1_epi32(i));
|
||||
#else
|
||||
int4 a = {i, i, i, i};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int4 make_int4(int x, int y, int z, int w)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int4 a(_mm_set_epi32(w, z, y, x));
|
||||
#else
|
||||
int4 a = {x, y, z, w};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
|
||||
ccl_device_inline int4 make_int4(const float3& f)
|
||||
{
|
||||
#ifdef __KERNEL_SSE__
|
||||
int4 a(_mm_cvtps_epi32(f.m128));
|
||||
#else
|
||||
int4 a = {(int)f.x, (int)f.y, (int)f.z, (int)f.w};
|
||||
#endif
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_INT4_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UCHAR2_H__
|
||||
#define __UTIL_TYPES_UCHAR2_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct uchar2 {
|
||||
uchar x, y;
|
||||
|
||||
__forceinline uchar operator[](int i) const;
|
||||
__forceinline uchar& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline uchar2 make_uchar2(uchar x, uchar y);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UCHAR2_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UCHAR2_IMPL_H__
|
||||
#define __UTIL_TYPES_UCHAR2_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
uchar uchar2::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
uchar& uchar2::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline uchar2 make_uchar2(uchar x, uchar y)
|
||||
{
|
||||
uchar2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UCHAR2_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UCHAR3_H__
|
||||
#define __UTIL_TYPES_UCHAR3_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct uchar3 {
|
||||
uchar x, y, z;
|
||||
|
||||
__forceinline uchar operator[](int i) const;
|
||||
__forceinline uchar& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline uchar3 make_uchar3(uchar x, uchar y, uchar z);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UCHAR3_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UCHAR3_IMPL_H__
|
||||
#define __UTIL_TYPES_UCHAR3_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
uchar uchar3::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
uchar& uchar3::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline uchar3 make_uchar3(uchar x, uchar y, uchar z)
|
||||
{
|
||||
uchar3 a = {x, y, z};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UCHAR3_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UCHAR4_H__
|
||||
#define __UTIL_TYPES_UCHAR4_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct uchar4 {
|
||||
uchar x, y, z, w;
|
||||
|
||||
__forceinline uchar operator[](int i) const;
|
||||
__forceinline uchar& operator[](int i);
|
||||
};
|
||||
|
||||
ccl_device_inline uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UCHAR4_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UCHAR4_IMPL_H__
|
||||
#define __UTIL_TYPES_UCHAR4_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
uchar uchar4::operator[](int i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 4);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
uchar& uchar4::operator[](int i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 4);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline uchar4 make_uchar4(uchar x, uchar y, uchar z, uchar w)
|
||||
{
|
||||
uchar4 a = {x, y, z, w};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UCHAR4_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UINT2_H__
|
||||
#define __UTIL_TYPES_UINT2_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct uint2 {
|
||||
uint x, y;
|
||||
|
||||
__forceinline uint operator[](uint i) const;
|
||||
__forceinline uint& operator[](uint i);
|
||||
};
|
||||
|
||||
ccl_device_inline uint2 make_uint2(uint x, uint y);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UINT2_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UINT2_IMPL_H__
|
||||
#define __UTIL_TYPES_UINT2_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
__forceinline uint uint2::operator[](uint i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline uint& uint2::operator[](uint i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 2);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline uint2 make_uint2(uint x, uint y)
|
||||
{
|
||||
uint2 a = {x, y};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UINT2_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UINT3_H__
|
||||
#define __UTIL_TYPES_UINT3_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct uint3 {
|
||||
uint x, y, z;
|
||||
|
||||
__forceinline uint operator[](uint i) const;
|
||||
__forceinline uint& operator[](uint i);
|
||||
};
|
||||
|
||||
ccl_device_inline uint3 make_uint3(uint x, uint y, uint z);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UINT3_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UINT3_IMPL_H__
|
||||
#define __UTIL_TYPES_UINT3_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
__forceinline uint uint3::operator[](uint i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline uint& uint3::operator[](uint i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline uint3 make_uint3(uint x, uint y, uint z)
|
||||
{
|
||||
uint3 a = {x, y, z};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UINT3_IMPL_H__ */
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UINT4_H__
|
||||
#define __UTIL_TYPES_UINT4_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
struct uint4 {
|
||||
uint x, y, z, w;
|
||||
|
||||
__forceinline uint operator[](uint i) const;
|
||||
__forceinline uint& operator[](uint i);
|
||||
};
|
||||
|
||||
ccl_device_inline uint4 make_uint4(uint x, uint y, uint z, uint w);
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UINT4_H__ */
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_UINT4_IMPL_H__
|
||||
#define __UTIL_TYPES_UINT4_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
__forceinline uint uint4::operator[](uint i) const
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
__forceinline uint& uint4::operator[](uint i)
|
||||
{
|
||||
util_assert(i >= 0);
|
||||
util_assert(i < 3);
|
||||
return *(&x + i);
|
||||
}
|
||||
|
||||
ccl_device_inline uint4 make_uint4(uint x, uint y, uint z, uint w)
|
||||
{
|
||||
uint4 a = {x, y, z, w};
|
||||
return a;
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_UINT4_IMPL_H__ */
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_VECTOR3_H__
|
||||
#define __UTIL_TYPES_VECTOR3_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
template<typename T>
|
||||
class vector3
|
||||
{
|
||||
public:
|
||||
T x, y, z;
|
||||
|
||||
__forceinline vector3();
|
||||
__forceinline vector3(const T& a);
|
||||
__forceinline vector3(const T& x, const T& y, const T& z);
|
||||
};
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_VECTOR3_H__ */
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright 2011-2017 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_TYPES_VECTOR3_IMPL_H__
|
||||
#define __UTIL_TYPES_VECTOR3_IMPL_H__
|
||||
|
||||
#ifndef __UTIL_TYPES_H__
|
||||
# error "Do not include this file directly, include util_types.h instead."
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
#ifndef __KERNEL_GPU__
|
||||
template<typename T>
|
||||
ccl_always_inline vector3<T>::vector3()
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ccl_always_inline vector3<T>::vector3(const T& a)
|
||||
: x(a), y(a), z(a)
|
||||
{
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
ccl_always_inline vector3<T>::vector3(const T& x, const T& y, const T& z)
|
||||
: x(x), y(y), z(z)
|
||||
{
|
||||
}
|
||||
#endif /* __KERNEL_GPU__ */
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __UTIL_TYPES_VECTOR3_IMPL_H__ */
|
Loading…
Reference in New Issue