[Bf-blender-cvs] [ea109fa4a68] temp-cycles-denoising: Merge remote-tracking branch 'origin/master' into temp-cycles-denoising

Lukas Stockner noreply at git.blender.org
Tue May 2 13:43:38 CEST 2017


Commit: ea109fa4a683da973052b778b440cf9d671cf1b1
Author: Lukas Stockner
Date:   Tue May 2 13:19:09 2017 +0200
Branches: temp-cycles-denoising
https://developer.blender.org/rBea109fa4a683da973052b778b440cf9d671cf1b1

Merge remote-tracking branch 'origin/master' into temp-cycles-denoising

===================================================================



===================================================================

diff --cc intern/cycles/kernel/CMakeLists.txt
index 9783c0a1978,3750225571d..36f32799be7
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@@ -231,7 -196,12 +231,13 @@@ set(SRC_UTIL_HEADER
  	../util/util_math.h
  	../util/util_math_fast.h
  	../util/util_math_intersect.h
+ 	../util/util_math_float2.h
+ 	../util/util_math_float3.h
+ 	../util/util_math_float4.h
+ 	../util/util_math_int2.h
+ 	../util/util_math_int3.h
+ 	../util/util_math_int4.h
 +	../util/util_math_matrix.h
  	../util/util_static_assert.h
  	../util/util_transform.h
  	../util/util_texture.h
diff --cc intern/cycles/util/CMakeLists.txt
index 922dad67e2e,388aba65460..43f9a57d099
--- a/intern/cycles/util/CMakeLists.txt
+++ b/intern/cycles/util/CMakeLists.txt
@@@ -53,7 -53,12 +53,13 @@@ set(SRC_HEADER
  	util_math_cdf.h
  	util_math_fast.h
  	util_math_intersect.h
+ 	util_math_float2.h
+ 	util_math_float3.h
+ 	util_math_float4.h
+ 	util_math_int2.h
+ 	util_math_int3.h
+ 	util_math_int4.h
 +	util_math_matrix.h
  	util_md5.h
  	util_opengl.h
  	util_optimization.h
diff --cc intern/cycles/util/util_math.h
index ecb3122e926,52b4fa859b7..12abd8e201e
--- a/intern/cycles/util/util_math.h
+++ b/intern/cycles/util/util_math.h
@@@ -43,1249 -41,266 +41,287 @@@ CCL_NAMESPACE_BEGI
  
  /* Division */
  #ifndef M_PI_F
- #define M_PI_F    (3.1415926535897932f)  /* pi */
+ #  define M_PI_F    (3.1415926535897932f)  /* pi */
  #endif
  #ifndef M_PI_2_F
- #define M_PI_2_F  (1.5707963267948966f)  /* pi/2 */
+ #  define M_PI_2_F  (1.5707963267948966f)  /* pi/2 */
  #endif
  #ifndef M_PI_4_F
- #define M_PI_4_F  (0.7853981633974830f)  /* pi/4 */
+ #  define M_PI_4_F  (0.7853981633974830f)  /* pi/4 */
  #endif
  #ifndef M_1_PI_F
- #define M_1_PI_F  (0.3183098861837067f)  /* 1/pi */
+ #  define M_1_PI_F  (0.3183098861837067f)  /* 1/pi */
  #endif
  #ifndef M_2_PI_F
- #define M_2_PI_F  (0.6366197723675813f)  /* 2/pi */
- #endif
- 
- /* Multiplication */
- #ifndef M_2PI_F
- #define M_2PI_F   (6.2831853071795864f)  /* 2*pi */
- #endif
- #ifndef M_4PI_F
- #define M_4PI_F   (12.566370614359172f)  /* 4*pi */
- #endif
- 
- /* Float sqrt variations */
- 
- #ifndef M_SQRT2_F
- #define M_SQRT2_F (1.4142135623730950f)  /* sqrt(2) */
- #endif
- 
- #ifndef M_LN2_F
- #define M_LN2_F   (0.6931471805599453f)  /* ln(2) */
- #endif
- 
- #ifndef M_LN10_F
- #define M_LN10_F  (2.3025850929940457f)  /* ln(10) */
- #endif
- 
- /* Scalar */
- 
- #ifdef _WIN32
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline float fmaxf(float a, float b)
- {
- 	return (a > b)? a: b;
- }
- 
- ccl_device_inline float fminf(float a, float b)
- {
- 	return (a < b)? a: b;
- }
- 
- #endif
- 
- #endif
- 
- #ifndef __KERNEL_GPU__
- 
- using std::isfinite;
- using std::isnan;
- 
- ccl_device_inline int abs(int x)
- {
- 	return (x > 0)? x: -x;
- }
- 
- ccl_device_inline int max(int a, int b)
- {
- 	return (a > b)? a: b;
- }
- 
- ccl_device_inline int min(int a, int b)
- {
- 	return (a < b)? a: b;
- }
- 
- ccl_device_inline float max(float a, float b)
- {
- 	return (a > b)? a: b;
- }
- 
- ccl_device_inline float min(float a, float b)
- {
- 	return (a < b)? a: b;
- }
- 
- ccl_device_inline double max(double a, double b)
- {
- 	return (a > b)? a: b;
- }
- 
- ccl_device_inline double min(double a, double b)
- {
- 	return (a < b)? a: b;
- }
- 
- /* These 2 guys are templated for usage with registers data.
-  *
-  * NOTE: Since this is CPU-only functions it is ok to use references here.
-  * But for other devices we'll need to be careful about this.
-  */
- 
- template<typename T>
- ccl_device_inline T min4(const T& a, const T& b, const T& c, const T& d)
- {
- 	return min(min(a,b),min(c,d));
- }
- 
- template<typename T>
- ccl_device_inline T max4(const T& a, const T& b, const T& c, const T& d)
- {
- 	return max(max(a,b),max(c,d));
- }
- 
- #endif
- 
- ccl_device_inline float min4(float a, float b, float c, float d)
- {
- 	return min(min(a, b), min(c, d));
- }
- 
- ccl_device_inline float max4(float a, float b, float c, float d)
- {
- 	return max(max(a, b), max(c, d));
- }
- 
- ccl_device_inline float max3(float3 a)
- {
- 	return max(max(a.x, a.y), a.z);
- }
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline int clamp(int a, int mn, int mx)
- {
- 	return min(max(a, mn), mx);
- }
- 
- ccl_device_inline float clamp(float a, float mn, float mx)
- {
- 	return min(max(a, mn), mx);
- }
- 
- ccl_device_inline float mix(float a, float b, float t)
- {
-     return a + t*(b - a);
- }
- 
- #endif
- 
- #ifndef __KERNEL_CUDA__
- 
- ccl_device_inline float saturate(float a)
- {
- 	return clamp(a, 0.0f, 1.0f);
- }
- 
- #endif
- 
- ccl_device_inline int float_to_int(float f)
- {
- 	return (int)f;
- }
- 
- ccl_device_inline int floor_to_int(float f)
- {
- 	return float_to_int(floorf(f));
- }
- 
- ccl_device_inline int ceil_to_int(float f)
- {
- 	return float_to_int(ceilf(f));
- }
- 
- ccl_device_inline float signf(float f)
- {
- 	return (f < 0.0f)? -1.0f: 1.0f;
- }
- 
- ccl_device_inline float nonzerof(float f, float eps)
- {
- 	if(fabsf(f) < eps)
- 		return signf(f)*eps;
- 	else
- 		return f;
- }
- 
- ccl_device_inline float smoothstepf(float f)
- {
- 	float ff = f*f;
- 	return (3.0f*ff - 2.0f*ff*f);
- }
- 
- ccl_device_inline int mod(int x, int m)
- {
- 	return (x % m + m) % m;
- }
- 
- /* Float2 Vector */
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline bool is_zero(const float2& a)
- {
- 	return (a.x == 0.0f && a.y == 0.0f);
- }
- 
- #endif
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline float average(const float2& a)
- {
- 	return (a.x + a.y)*(1.0f/2.0f);
- }
- 
- #endif
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline float2 operator-(const float2& a)
- {
- 	return make_float2(-a.x, -a.y);
- }
- 
- ccl_device_inline float2 operator*(const float2& a, const float2& b)
- {
- 	return make_float2(a.x*b.x, a.y*b.y);
- }
- 
- ccl_device_inline float2 operator*(const float2& a, float f)
- {
- 	return make_float2(a.x*f, a.y*f);
- }
- 
- ccl_device_inline float2 operator*(float f, const float2& a)
- {
- 	return make_float2(a.x*f, a.y*f);
- }
- 
- ccl_device_inline float2 operator/(float f, const float2& a)
- {
- 	return make_float2(f/a.x, f/a.y);
- }
- 
- ccl_device_inline float2 operator/(const float2& a, float f)
- {
- 	float invf = 1.0f/f;
- 	return make_float2(a.x*invf, a.y*invf);
- }
- 
- ccl_device_inline float2 operator/(const float2& a, const float2& b)
- {
- 	return make_float2(a.x/b.x, a.y/b.y);
- }
- 
- ccl_device_inline float2 operator+(const float2& a, const float2& b)
- {
- 	return make_float2(a.x+b.x, a.y+b.y);
- }
- 
- ccl_device_inline float2 operator-(const float2& a, const float2& b)
- {
- 	return make_float2(a.x-b.x, a.y-b.y);
- }
- 
- ccl_device_inline float2 operator+=(float2& a, const float2& b)
- {
- 	return a = a + b;
- }
- 
- ccl_device_inline float2 operator*=(float2& a, const float2& b)
- {
- 	return a = a * b;
- }
- 
- ccl_device_inline float2 operator*=(float2& a, float f)
- {
- 	return a = a * f;
- }
- 
- ccl_device_inline float2 operator/=(float2& a, const float2& b)
- {
- 	return a = a / b;
- }
- 
- ccl_device_inline float2 operator/=(float2& a, float f)
- {
- 	float invf = 1.0f/f;
- 	return a = a * invf;
- }
- 
- 
- ccl_device_inline float dot(const float2& a, const float2& b)
- {
- 	return a.x*b.x + a.y*b.y;
- }
- 
- ccl_device_inline float cross(const float2& a, const float2& b)
- {
- 	return (a.x*b.y - a.y*b.x);
- }
- 
- #endif
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline bool operator==(const int2 a, const int2 b)
- {
- 	return (a.x == b.x && a.y == b.y);
- }
- 
- ccl_device_inline float len(const float2& a)
- {
- 	return sqrtf(dot(a, a));
- }
- 
- ccl_device_inline float2 normalize(const float2& a)
- {
- 	return a/len(a);
- }
- 
- ccl_device_inline float2 normalize_len(const float2& a, float *t)
- {
- 	*t = len(a);
- 	return a/(*t);
- }
- 
- ccl_device_inline float2 safe_normalize(const float2& a)
- {
- 	float t = len(a);
- 	return (t != 0.0f)? a/t: a;
- }
- 
- ccl_device_inline bool operator==(const float2& a, const float2& b)
- {
- 	return (a.x == b.x && a.y == b.y);
- }
- 
- ccl_device_inline bool operator!=(const float2& a, const float2& b)
- {
- 	return !(a == b);
- }
- 
- ccl_device_inline float2 min(const float2& a, const float2& b)
- {
- 	return make_float2(min(a.x, b.x), min(a.y, b.y));
- }
- 
- ccl_device_inline float2 max(const float2& a, const float2& b)
- {
- 	return make_float2(max(a.x, b.x), max(a.y, b.y));
- }
- 
- ccl_device_inline float2 clamp(const float2& a, const float2& mn, const float2& mx)
- {
- 	return min(max(a, mn), mx);
- }
- 
- ccl_device_inline float2 fabs(const float2& a)
- {
- 	return make_float2(fabsf(a.x), fabsf(a.y));
- }
- 
- ccl_device_inline float2 as_float2(const float4& a)
- {
- 	return make_float2(a.x, a.y);
- }
- 
- #endif
- 
- #ifndef __KERNEL_GPU__
- 
- ccl_device_inline void print_float2(const char *label, const float2& a)
- {
- 	printf("%s: %.8f %.8f\n", label, (double)a.x, (double)a.y);
- }
- 
- #endif
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline float2 interp(const float2& a, const float2& b, float t)
- {
- 	return a + t*(b - a);
- }
- 
- #endif
- 
- /* Float3 Vector */
- 
- #ifndef __KERNEL_OPENCL__
- 
- ccl_device_inline float3 operator-(const float3& a)
- {
- #ifdef __KERNEL_SSE__
- 	return float3(_mm_xor_ps(a.m128, _mm_castsi128_ps(_mm_set1_epi32(0x80000000))));
- #else
- 	return make_float3(-a.x, -a.y, -a.z);
- #endif
- }
- 
- ccl_device_inline float3 operator*(const float3& a, const float3& b)
- {
- #ifdef __KERNEL_SSE__
- 	return float3(_mm_mul_ps(a.m128,b.m128));
- #else
- 	return make_float3(a.x*b.x, a.y*b.y, a.z*b.z);
- #endif
- }
- 
- ccl_device_inline float3 operator*(const float3& a, const float f)
- {
- #ifdef __KERNEL_SSE__
- 	return float3(_mm_mul_ps(a.m128,_mm_set1_ps(f)));
- #else
- 	return make_float3(a.x*f, a.y*f, a.z*f);
- #endif
- }
- 
- ccl_device_inline float3 operator*(const float f, const float3& a)
- {
- 	/* TODO(sergey): Currently disabled, gives speedup but causes precision issues. */
- #if defined(__KERNEL_SSE__) && 0
- 	return float3(_mm_mul_ps(_mm_set1_ps(f), a.m128));
- #else
- 	return make_float3(a.x*f, a.y*f, a.z*f);
- #endif
- }
- 
- ccl_device_inline float3 operator/(const float f, const

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list