diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-10 14:49:51 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-01-10 14:49:51 +0300 |
commit | 561419374549201845bdd58e7329f61eef574f7f (patch) | |
tree | cc2f7e759b13ef119480bfc239ae23cd4d3062a6 /source/blender/blenlib | |
parent | 518c65460e8843e425fee2161b407e1f8e9e4281 (diff) |
Task scheduler: Use restrict pointer qualifier
Those pointers are never to be aliased, so let's be explicit about this and hope
compiler does save some CPU ticks.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_task.h | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_kdopbvh.c | 10 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_statistics.c | 6 |
3 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index 52f32c2999f..1285e24e567 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -143,10 +143,11 @@ typedef struct ParallelRangeTLS { void *userdata_chunk; } ParallelRangeTLS; -typedef void (*TaskParallelRangeFunc)(void *userdata, +typedef void (*TaskParallelRangeFunc)(void *__restrict userdata, const int iter, - const ParallelRangeTLS *tls); -typedef void (*TaskParallelRangeFuncFinalize)(void *userdata, void *userdata_chunk); + const ParallelRangeTLS *__restrict tls); +typedef void (*TaskParallelRangeFuncFinalize)(void *__restrict userdata, + void *__restrict userdata_chunk); typedef struct ParallelRangeSettings { /* Whether caller allows to do threading of the particular range. diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index 03784e31eee..55667d19f76 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -798,7 +798,10 @@ typedef struct BVHDivNodesData { int first_of_next_level; } BVHDivNodesData; -static void non_recursive_bvh_div_nodes_task_cb(void *userdata, const int j, const ParallelRangeTLS *UNUSED(tls)) +static void non_recursive_bvh_div_nodes_task_cb( + void *__restrict userdata, + const int j, + const ParallelRangeTLS *__restrict UNUSED(tls)) { BVHDivNodesData *data = userdata; @@ -1282,7 +1285,10 @@ int BLI_bvhtree_overlap_thread_num(const BVHTree *tree) return (int)MIN2(tree->tree_type, tree->nodes[tree->totleaf]->totnode); } -static void bvhtree_overlap_task_cb(void *userdata, const int j, const ParallelRangeTLS *UNUSED(tls)) +static void bvhtree_overlap_task_cb( + void *__restrict userdata, + const int j, + const ParallelRangeTLS *__restrict UNUSED(tls)) { BVHOverlapData_Thread *data = &((BVHOverlapData_Thread *)userdata)[j]; BVHOverlapData_Shared *data_shared = data->shared; diff --git a/source/blender/blenlib/intern/math_statistics.c b/source/blender/blenlib/intern/math_statistics.c index 14e3aaea053..3a19f1d3603 100644 --- a/source/blender/blenlib/intern/math_statistics.c +++ b/source/blender/blenlib/intern/math_statistics.c @@ -46,8 +46,10 @@ typedef struct CovarianceData { int nbr_cos_vn; } CovarianceData; -static void covariance_m_vn_ex_task_cb(void *userdata, const int a, - const ParallelRangeTLS *UNUSED(tls)) +static void covariance_m_vn_ex_task_cb( + void *__restrict userdata, + const int a, + const ParallelRangeTLS *__restrict UNUSED(tls)) { CovarianceData *data = userdata; const float *cos_vn = data->cos_vn; |