diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-16 18:27:44 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-25 00:50:49 +0300 |
commit | ab8d9c4b8853755faa62307750d961dc2ec43708 (patch) | |
tree | 707d52530016e210d46375e2c1c0db432ae230b1 /intern/cycles/util/util_types.h | |
parent | f770bc4757a2b471d5aaee048359096c1c79a6b2 (diff) |
Cycles: Add some utility functions and structures
Most of them are not currently used but are essential for the further work.
- CPU kernels with SSE2 support will now have sse3b, sse3f and sse3i
- Added templatedversions of min4, max4 which are handy to use with register
variables.
- Added util_swap function which gets arguments by pointers.
So hopefully it'll be a portable version of std::swap.
Diffstat (limited to 'intern/cycles/util/util_types.h')
-rw-r--r-- | intern/cycles/util/util_types.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index ce84200d0b6..8c0f6d180b0 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -264,6 +264,19 @@ struct ccl_try_align(16) float4 { __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) {} +}; + #endif #ifndef __KERNEL_GPU__ |