diff options
author | Ethan-Hall <Ethan1080> | 2022-03-23 17:53:10 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-03-23 22:06:12 +0300 |
commit | f5066d43ae572de929fea31cbc9e091e288b2435 (patch) | |
tree | c585a7551aae6b899064e88b570046f606a76f7a /intern/cycles/util | |
parent | 4e56e738a8f35228873d6e84d9e9f8b0e7a74a59 (diff) |
Cleanup: use make_float4(f) zero_float4() to simplify code
Differential Revision: https://developer.blender.org/D14426
Diffstat (limited to 'intern/cycles/util')
-rw-r--r-- | intern/cycles/util/math_float4.h | 14 | ||||
-rw-r--r-- | intern/cycles/util/math_matrix.h | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/intern/cycles/util/math_float4.h b/intern/cycles/util/math_float4.h index 9f4a1a904b5..5d4da7dd30f 100644 --- a/intern/cycles/util/math_float4.h +++ b/intern/cycles/util/math_float4.h @@ -90,13 +90,13 @@ ccl_device_inline float4 zero_float4() #ifdef __KERNEL_SSE__ return float4(_mm_setzero_ps()); #else - return make_float4(0.0f, 0.0f, 0.0f, 0.0f); + return make_float4(0.0f); #endif } ccl_device_inline float4 one_float4() { - return make_float4(1.0f, 1.0f, 1.0f, 1.0f); + return make_float4(1.0f); } #if !defined(__KERNEL_METAL__) @@ -149,7 +149,7 @@ ccl_device_inline float4 operator/(const float4 &a, const float4 &b) ccl_device_inline float4 operator+(const float4 &a, const float f) { - return a + make_float4(f, f, f, f); + return a + make_float4(f); } ccl_device_inline float4 operator+(const float4 &a, const float4 &b) @@ -163,7 +163,7 @@ ccl_device_inline float4 operator+(const float4 &a, const float4 &b) ccl_device_inline float4 operator-(const float4 &a, const float f) { - return a - make_float4(f, f, f, f); + return a - make_float4(f); } ccl_device_inline float4 operator-(const float4 &a, const float4 &b) @@ -297,7 +297,7 @@ ccl_device_inline float4 cross(const float4 &a, const float4 &b) ccl_device_inline bool is_zero(const float4 &a) { # ifdef __KERNEL_SSE__ - return a == make_float4(0.0f); + return a == zero_float4(); # else return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f && a.w == 0.0f); # endif @@ -317,7 +317,7 @@ ccl_device_inline float4 reduce_add(const float4 &a) # endif # else float sum = (a.x + a.y) + (a.z + a.w); - return make_float4(sum, sum, sum, sum); + return make_float4(sum); # endif } @@ -458,7 +458,7 @@ ccl_device_inline float4 select(const int4 &mask, const float4 &a, const float4 ccl_device_inline float4 mask(const int4 &mask, const float4 &a) { /* Replace elements of x with zero where mask isn't set. */ - return select(mask, a, make_float4(0.0f)); + return select(mask, a, zero_float4()); } ccl_device_inline float4 reduce_min(const float4 &a) diff --git a/intern/cycles/util/math_matrix.h b/intern/cycles/util/math_matrix.h index a4318fda6e8..b10d9b3c938 100644 --- a/intern/cycles/util/math_matrix.h +++ b/intern/cycles/util/math_matrix.h @@ -376,7 +376,7 @@ ccl_device void math_matrix_jacobi_eigendecomposition(ccl_private float *A, ccl_device_inline void math_vector_zero_sse(float4 *A, int n) { for (int i = 0; i < n; i++) { - A[i] = make_float4(0.0f); + A[i] = zero_float4(); } } @@ -384,7 +384,7 @@ ccl_device_inline void math_matrix_zero_sse(float4 *A, int n) { for (int row = 0; row < n; row++) { for (int col = 0; col <= row; col++) { - MAT(A, n, row, col) = make_float4(0.0f); + MAT(A, n, row, col) = zero_float4(); } } } |