Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-05-19 13:33:28 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-05-19 13:41:03 +0300
commit803337f3f64fed240e9adc6f286d5f9d13a5026a (patch)
treea262b427bd53873be9d18e952f193d66801edac8 /intern/cycles/util/util_math_matrix.h
parent8e655446d1ec667a08a6d351d1e452fc51f1428a (diff)
\0;115;0cCycles: Cleanup, use ccl_restrict instead of ccl_restrict_ptr
There were following issues with ccl_restrict_ptr: - We already had ccl_restrict for all platforms. - It was secretly adding `const` qualifier to the declaration, which is quite weird since non-const pointer can also be declared as restricted. - We never in Blender are using foo_ptr or FooPtr type definitions, so not sure why we should introduce such a thing here. - It is absolutely wrong from semantic point of view to put pointer into the restrict macro -- const is a part of type, not part of hint for compiler that some pointer is never aliased.
Diffstat (limited to 'intern/cycles/util/util_math_matrix.h')
-rw-r--r--intern/cycles/util/util_math_matrix.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/intern/cycles/util/util_math_matrix.h b/intern/cycles/util/util_math_matrix.h
index 2172e94a14f..0c58ae5058c 100644
--- a/intern/cycles/util/util_math_matrix.h
+++ b/intern/cycles/util/util_math_matrix.h
@@ -50,19 +50,19 @@ ccl_device_inline void math_matrix_zero(float *A, int n)
/* Elementary vector operations. */
-ccl_device_inline void math_vector_add(float *a, float ccl_restrict_ptr b, int n)
+ccl_device_inline void math_vector_add(float *a, const float *ccl_restrict b, int n)
{
for(int i = 0; i < n; i++)
a[i] += b[i];
}
-ccl_device_inline void math_vector_mul(float *a, float ccl_restrict_ptr b, int n)
+ccl_device_inline void math_vector_mul(float *a, const float *ccl_restrict b, int n)
{
for(int i = 0; i < n; i++)
a[i] *= b[i];
}
-ccl_device_inline void math_vector_mul_strided(ccl_global float *a, float ccl_restrict_ptr b, int astride, int n)
+ccl_device_inline void math_vector_mul_strided(ccl_global float *a, const float *ccl_restrict b, int astride, int n)
{
for(int i = 0; i < n; i++)
a[i*astride] *= b[i];
@@ -74,7 +74,7 @@ ccl_device_inline void math_vector_scale(float *a, float b, int n)
a[i] *= b;
}
-ccl_device_inline void math_vector_max(float *a, float ccl_restrict_ptr b, int n)
+ccl_device_inline void math_vector_max(float *a, const float *ccl_restrict b, int n)
{
for(int i = 0; i < n; i++)
a[i] = max(a[i], b[i]);
@@ -105,7 +105,7 @@ ccl_device_inline void math_trimatrix_add_diagonal(ccl_global float *A, int n, f
* The Gramian matrix of v is vt*v, so element (i,j) is v[i]*v[j]. */
ccl_device_inline void math_matrix_add_gramian(float *A,
int n,
- float ccl_restrict_ptr v,
+ const float *ccl_restrict v,
float weight)
{
for(int row = 0; row < n; row++)
@@ -117,7 +117,7 @@ ccl_device_inline void math_matrix_add_gramian(float *A,
* The Gramian matrix of v is vt*v, so element (i,j) is v[i]*v[j]. */
ccl_device_inline void math_trimatrix_add_gramian_strided(ccl_global float *A,
int n,
- float ccl_restrict_ptr v,
+ const float *ccl_restrict v,
float weight,
int stride)
{
@@ -342,32 +342,32 @@ ccl_device_inline void math_matrix_zero_sse(__m128 *A, int n)
/* Add Gramian matrix of v to A.
* The Gramian matrix of v is v^T*v, so element (i,j) is v[i]*v[j]. */
-ccl_device_inline void math_matrix_add_gramian_sse(__m128 *A, int n, __m128 ccl_restrict_ptr v, __m128 weight)
+ccl_device_inline void math_matrix_add_gramian_sse(__m128 *A, int n, const __m128 *ccl_restrict v, __m128 weight)
{
for(int row = 0; row < n; row++)
for(int col = 0; col <= row; col++)
MAT(A, n, row, col) = _mm_add_ps(MAT(A, n, row, col), _mm_mul_ps(_mm_mul_ps(v[row], v[col]), weight));
}
-ccl_device_inline void math_vector_add_sse(__m128 *V, int n, __m128 ccl_restrict_ptr a)
+ccl_device_inline void math_vector_add_sse(__m128 *V, int n, const __m128 *ccl_restrict a)
{
for(int i = 0; i < n; i++)
V[i] = _mm_add_ps(V[i], a[i]);
}
-ccl_device_inline void math_vector_mul_sse(__m128 *V, int n, __m128 ccl_restrict_ptr a)
+ccl_device_inline void math_vector_mul_sse(__m128 *V, int n, const __m128 *ccl_restrict a)
{
for(int i = 0; i < n; i++)
V[i] = _mm_mul_ps(V[i], a[i]);
}
-ccl_device_inline void math_vector_max_sse(__m128 *a, __m128 ccl_restrict_ptr b, int n)
+ccl_device_inline void math_vector_max_sse(__m128 *a, const __m128 *ccl_restrict b, int n)
{
for(int i = 0; i < n; i++)
a[i] = _mm_max_ps(a[i], b[i]);
}
-ccl_device_inline void math_matrix_hsum(float *A, int n, __m128 ccl_restrict_ptr B)
+ccl_device_inline void math_matrix_hsum(float *A, int n, const __m128 *ccl_restrict B)
{
for(int row = 0; row < n; row++)
for(int col = 0; col <= row; col++)