diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2015-08-01 22:06:58 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2015-08-01 22:06:58 +0300 |
commit | 4ade467fc6adfc13ce9e21d7e50b366fce70ea5f (patch) | |
tree | 968418721b08baacd47bab95877bc08812f3046a /intern/cycles/util | |
parent | 7759782ee7c4e654641c9f7abb51631c86e3f29c (diff) | |
parent | a3c5de3e3ca82d8ad5a28029f3ee9207929318a1 (diff) |
Merge branch 'master' into UI-graphical-redesign
Conflicts:
source/blender/blenkernel/BKE_blender.h
source/blender/blenloader/intern/versioning_270.c
source/blender/editors/interface/resources.c
source/blender/makesdna/DNA_userdef_types.h
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/util_guarded_allocator.h | 4 | ||||
-rw-r--r-- | intern/cycles/util/util_math.h | 12 | ||||
-rw-r--r-- | intern/cycles/util/util_simd.h | 8 | ||||
-rw-r--r-- | intern/cycles/util/util_transform.h | 5 | ||||
-rw-r--r-- | intern/cycles/util/util_types.h | 13 | ||||
-rw-r--r-- | intern/cycles/util/util_vector.h | 25 |
6 files changed, 46 insertions, 21 deletions
diff --git a/intern/cycles/util/util_guarded_allocator.h b/intern/cycles/util/util_guarded_allocator.h index c4edb172eb8..2df717253e3 100644 --- a/intern/cycles/util/util_guarded_allocator.h +++ b/intern/cycles/util/util_guarded_allocator.h @@ -42,7 +42,7 @@ void util_guarded_mem_free(size_t n); /* Guarded allocator for the use with STL. */ template <typename T> -class GuardedAllocator: public std::allocator<T> { +class GuardedAllocator : public std::allocator<T> { public: template<typename _Tp1> struct rebind { @@ -54,7 +54,7 @@ public: util_guarded_mem_alloc(n * sizeof(T)); #ifdef WITH_BLENDER_GUARDEDALLOC (void)hint; - return (T*)MEM_mallocN(n * sizeof(T), "Cycles Alloc"); + return (T*)MEM_mallocN_aligned(n * sizeof(T), 16, "Cycles Alloc"); #else return std::allocator<T>::allocate(n, hint); #endif diff --git a/intern/cycles/util/util_math.h b/intern/cycles/util/util_math.h index 2262f8fdbb7..97c93516496 100644 --- a/intern/cycles/util/util_math.h +++ b/intern/cycles/util/util_math.h @@ -1447,10 +1447,14 @@ ccl_device bool ray_triangle_intersect_uv( return true; } -ccl_device bool ray_quad_intersect( - float3 ray_P, float3 ray_D, float ray_t, - float3 quad_P, float3 quad_u, float3 quad_v, - float3 *isect_P, float *isect_t) +#if defined(__KERNEL_CUDA__) && (defined(i386) || defined(_M_IX86)) && (defined(__KERNEL_EXPERIMENTAL__) || __CUDA_ARCH__ == 500) +ccl_device_noinline +#else +ccl_device +#endif +bool ray_quad_intersect(float3 ray_P, float3 ray_D, float ray_t, + float3 quad_P, float3 quad_u, float3 quad_v, + float3 *isect_P, float *isect_t) { float3 v0 = quad_P - quad_u*0.5f - quad_v*0.5f; float3 v1 = quad_P + quad_u*0.5f - quad_v*0.5f; diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h index 7c15199d4e1..a1c35b7174d 100644 --- a/intern/cycles/util/util_simd.h +++ b/intern/cycles/util/util_simd.h @@ -58,8 +58,12 @@ __forceinline operator int ( ) const { return std::numeric_limits< /* Intrinsics Functions */ #if defined(__BMI__) && defined(__GNUC__) -#define _tzcnt_u32 __tzcnt_u32 -#define _tzcnt_u64 __tzcnt_u64 +# ifndef _tzcnt_u32 +# define _tzcnt_u32 __tzcnt_u32 +# endif +# ifndef _tzcnt_u64 +# define _tzcnt_u64 __tzcnt_u64 +# endif #endif #if defined(__LZCNT__) diff --git a/intern/cycles/util/util_transform.h b/intern/cycles/util/util_transform.h index 0b87db0a379..ba8d04b5c16 100644 --- a/intern/cycles/util/util_transform.h +++ b/intern/cycles/util/util_transform.h @@ -55,6 +55,11 @@ typedef struct DecompMotionTransform { float4 post_x, post_y; } DecompMotionTransform; +typedef struct PerspectiveMotionTransform { + Transform pre; + Transform post; +} PerspectiveMotionTransform; + /* Functions */ ccl_device_inline float3 transform_perspective(const Transform *t, const float3 a) diff --git a/intern/cycles/util/util_types.h b/intern/cycles/util/util_types.h index 187675e74bf..6f474f873a6 100644 --- a/intern/cycles/util/util_types.h +++ b/intern/cycles/util/util_types.h @@ -470,6 +470,19 @@ enum InterpolationType { INTERPOLATION_SMART = 3, }; +/* Extension types for textures. + * + * Defines how the image is extrapolated past its original bounds. + */ +enum ExtensionType { + /* Cause the image to repeat horizontally and vertically. */ + EXTENSION_REPEAT = 0, + /* Extend by repeating edge pixels of the image. */ + EXTENSION_EXTEND = 1, + /* Clip to image size and set exterior pixels as transparent. */ + EXTENSION_CLIP = 2, +}; + /* macros */ /* hints for branch prediction, only use in code that runs a _lot_ */ diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h index 92c3f116c69..15a65be0ef0 100644 --- a/intern/cycles/util/util_vector.h +++ b/intern/cycles/util/util_vector.h @@ -19,7 +19,8 @@ /* Vector */ -#include <string.h> +#include <cassert> +#include <cstring> #include <vector> #include "util_aligned_malloc.h" @@ -40,20 +41,16 @@ CCL_NAMESPACE_BEGIN * * - Have method to ensure capacity is re-set to 0. */ -template<typename value_type> -class vector : public std::vector<value_type +template<typename value_type, #ifdef WITH_CYCLES_DEBUG - , GuardedAllocator<value_type> + typename allocator_type = GuardedAllocator<value_type> +#else + typename allocator_type = std::allocator<value_type> #endif - > + > +class vector : public std::vector<value_type, allocator_type> { public: -#ifdef WITH_CYCLES_DEBUG - typedef GuardedAllocator<value_type> allocator_type; -#else - typedef std::allocator<value_type> allocator_type; -#endif - /* Default constructor. */ explicit vector() : std::vector<value_type, allocator_type>() { } @@ -63,7 +60,7 @@ public: /* Range constructor. */ template <class InputIterator> - vector (InputIterator first, InputIterator last) + vector(InputIterator first, InputIterator last) : std::vector<value_type, allocator_type>(first, last) { } /* Copy constructor. */ @@ -78,7 +75,8 @@ public: #endif } - void free_memory(void) { + void free_memory(void) + { std::vector<value_type, allocator_type>::resize(0); shrink_to_fit(); } @@ -190,6 +188,7 @@ public: T& operator[](size_t i) const { + assert(i < datasize); return data[i]; } |