[Bf-blender-cvs] [56141937454] master: Task scheduler: Use restrict pointer qualifier

Sergey Sharybin noreply at git.blender.org
Wed Jan 10 13:21:00 CET 2018


Commit: 561419374549201845bdd58e7329f61eef574f7f
Author: Sergey Sharybin
Date:   Wed Jan 10 12:49:51 2018 +0100
Branches: master
https://developer.blender.org/rB561419374549201845bdd58e7329f61eef574f7f

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.

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

M	source/blender/blenkernel/intern/CCGSubSurf_legacy.c
M	source/blender/blenkernel/intern/colortools.c
M	source/blender/blenkernel/intern/dynamicpaint.c
M	source/blender/blenkernel/intern/mask_rasterize.c
M	source/blender/blenkernel/intern/mesh_evaluate.c
M	source/blender/blenkernel/intern/ocean.c
M	source/blender/blenkernel/intern/particle_system.c
M	source/blender/blenkernel/intern/pbvh.c
M	source/blender/blenkernel/intern/shrinkwrap.c
M	source/blender/blenkernel/intern/smoke.c
M	source/blender/blenkernel/intern/tracking_auto.c
M	source/blender/blenkernel/intern/tracking_stabilize.c
M	source/blender/blenlib/BLI_task.h
M	source/blender/blenlib/intern/BLI_kdopbvh.c
M	source/blender/blenlib/intern/math_statistics.c
M	source/blender/bmesh/intern/bmesh_interp.c
M	source/blender/depsgraph/intern/eval/deg_eval.cc
M	source/blender/depsgraph/intern/eval/deg_eval_flush.cc
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/paint_image_2d.c
M	source/blender/editors/sculpt_paint/paint_mask.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/space_sequencer/sequencer_scopes.c
M	source/blender/modifiers/intern/MOD_displace.c
M	source/blender/modifiers/intern/MOD_meshdeform.c
M	source/blender/modifiers/intern/MOD_ocean.c
M	source/blender/modifiers/intern/MOD_surfacedeform.c
M	source/blender/modifiers/intern/MOD_uvwarp.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c
M	source/blender/render/intern/source/pointdensity.c

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

diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
index 363b7cff453..d289f63dac1 100644
--- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
+++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c
@@ -136,8 +136,10 @@ typedef struct CCGSubSurfCalcSubdivData {
 	int curLvl;
 } CCGSubSurfCalcSubdivData;
 
-static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, int ptrIdx,
-                                                            const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(
+        void *__restrict userdata,
+        int ptrIdx,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -228,8 +230,10 @@ static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, int
 	}
 }
 
-static void ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int ptrIdx,
-                                                          const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcVertNormals_faces_finalize_cb(
+        void *__restrict userdata,
+        int ptrIdx,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -267,8 +271,10 @@ static void ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int pt
 	}
 }
 
-static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(void *userdata, int ptrIdx,
-                                                            const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(
+        void *__restrict userdata,
+        int ptrIdx,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -414,8 +420,10 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss,
 }
 
 
-static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void *userdata, int ptrIdx,
-                                                                          const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(
+        void *__restrict userdata,
+        int ptrIdx,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -502,8 +510,10 @@ static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void *
 	}
 }
 
-static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb(void *userdata, int ptrIdx,
-                                                                                   const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb(
+        void *__restrict userdata,
+        int ptrIdx,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	CCGSubSurfCalcSubdivData *data = userdata;
 
@@ -608,8 +618,10 @@ static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_
 	}
 }
 
-static void ccgSubSurf__calcSubdivLevel_verts_copydata_cb(void *userdata, int ptrIdx,
-                                                          const ParallelRangeTLS *UNUSED(tls))
+static void ccgSubSurf__calcSubdivLevel_verts_copydata_cb(
+        void *__restrict userdata,
+        int ptrIdx,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	CCGSubSurfCalcSubdivData *data = userdata;
 
diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c
index 46d06a3ac78..0fe429312db 100644
--- a/source/blender/blenkernel/intern/colortools.c
+++ b/source/blender/blenkernel/intern/colortools.c
@@ -1165,7 +1165,9 @@ typedef struct ScopesUpdateDataChunk {
 	float min[3], max[3];
 } ScopesUpdateDataChunk;
 
-static void scopes_update_cb(void *userdata, const int y, const ParallelRangeTLS *tls)
+static void scopes_update_cb(void *__restrict userdata, 
+                             const int y,
+                             const ParallelRangeTLS *__restrict tls)
 {
 	const ScopesUpdateData *data = userdata;
 
@@ -1259,7 +1261,8 @@ static void scopes_update_cb(void *userdata, const int y, const ParallelRangeTLS
 	}
 }
 
-static void scopes_update_finalize(void *userdata, void *userdata_chunk)
+static void scopes_update_finalize(void *__restrict userdata,
+                                   void *__restrict userdata_chunk)
 {
 	const ScopesUpdateData *data = userdata;
 	const ScopesUpdateDataChunk *data_chunk = userdata_chunk;
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 4b7193adc21..de96d7e3176 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -611,7 +611,9 @@ static void freeGrid(PaintSurfaceData *data)
 	bData->grid = NULL;
 }
 
-static void grid_bound_insert_cb_ex(void *userdata, const int i, const ParallelRangeTLS *tls)
+static void grid_bound_insert_cb_ex(void *__restrict userdata,
+                                    const int i,
+                                    const ParallelRangeTLS *__restrict tls)
 {
 	PaintBakeData *bData = userdata;
 
@@ -620,7 +622,8 @@ static void grid_bound_insert_cb_ex(void *userdata, const int i, const ParallelR
 	boundInsert(grid_bound, bData->realCoord[bData->s_pos[i]].v);
 }
 
-static void grid_bound_insert_finalize(void *userdata, void *userdata_chunk)
+static void grid_bound_insert_finalize(void *__restrict userdata,
+                                       void *__restrict userdata_chunk)
 {
 	PaintBakeData *bData = userdata;
 	VolumeGrid *grid = bData->grid;
@@ -631,7 +634,9 @@ static void grid_bound_insert_finalize(void *userdata, void *userdata_chunk)
 	boundInsert(&grid->grid_bounds, grid_bound->max);
 }
 
-static void grid_cell_points_cb_ex(void *userdata, const int i, const ParallelRangeTLS *tls)
+static void grid_cell_points_cb_ex(void *__restrict userdata,
+                                   const int i,
+                                   const ParallelRangeTLS *__restrict tls)
 {
 	PaintBakeData *bData = userdata;
 	VolumeGrid *grid = bData->grid;
@@ -650,7 +655,8 @@ static void grid_cell_points_cb_ex(void *userdata, const int i, const ParallelRa
 	s_num[temp_t_index[i]]++;
 }
 
-static void grid_cell_points_finalize(void *userdata, void *userdata_chunk)
+static void grid_cell_points_finalize(void *__restrict userdata,
+                                      void *__restrict userdata_chunk)
 {
 	PaintBakeData *bData = userdata;
 	VolumeGrid *grid = bData->grid;
@@ -664,7 +670,9 @@ static void grid_cell_points_finalize(void *userdata, void *userdata_chunk)
 	}
 }
 
-static void grid_cell_bounds_cb(void *userdata, const int x, const ParallelRangeTLS *UNUSED(tls))
+static void grid_cell_bounds_cb(void *__restrict userdata,
+                                const int x,
+                                const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	PaintBakeData *bData = userdata;
 	VolumeGrid *grid = bData->grid;
@@ -1424,8 +1432,10 @@ typedef struct DynamicPaintSetInitColorData {
 	const bool scene_color_manage;
 } DynamicPaintSetInitColorData;
 
-static void dynamic_paint_set_init_color_tex_to_vcol_cb(void *userdata, const int i,
-                                                       const ParallelRangeTLS *UNUSED(tls))
+static void dynamic_paint_set_init_color_tex_to_vcol_cb(
+        void *__restrict userdata,
+        const int i,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	const DynamicPaintSetInitColorData *data = userdata;
 
@@ -1459,8 +1469,10 @@ static void dynamic_paint_set_init_color_tex_to_vcol_cb(void *userdata, const in
 	}
 }
 
-static void dynamic_paint_set_init_color_tex_to_imseq_cb(void *userdata, const int i,
-                                                         const ParallelRangeTLS *UNUSED(tls))
+static void dynamic_paint_set_init_color_tex_to_imseq_cb(
+        void *__restrict userdata,
+        const int i,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	const DynamicPaintSetInitColorData *data = userdata;
 
@@ -1498,8 +1510,10 @@ static void dynamic_paint_set_init_color_tex_to_imseq_cb(void *userdata, const i
 	pPoint[i].color[3] = texres.tin;
 }
 
-static void dynamic_paint_set_init_color_vcol_to_imseq_cb(void *userdata, const int i,
-                                                          const ParallelRangeTLS *UNUSED(tls))
+static void dynamic_paint_set_init_color_vcol_to_imseq_cb(
+        void *__restrict userdata,
+        const int i,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	const DynamicPaintSetInitColorData *data = userdata;
 
@@ -1719,8 +1733,10 @@ typedef struct DynamicPaintModifierApplyData {
 	MLoopCol *mloopcol_preview;
 } DynamicPaintModifierApplyData;
 
-static void dynamic_paint_apply_surface_displace_cb(void *userdata, const int i,
-                                                    const ParallelRangeTLS *UNUSED(tls))
+static void dynamic_paint_apply_surface_displace_cb(
+        void *__restrict userdata,
+        const int i,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	const DynamicPaintModifierApplyData *data = userdata;
 
@@ -1760,8 +1776,10 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Deri
 	}
 }
 
-static void dynamic_paint_apply_surface_vpaint_blend_cb(void *userdata, const int i,
-                                                        const ParallelRangeTLS *UNUSED(tls))
+static void dynamic_paint_apply_surface_vpaint_blend_cb(
+        void *__restrict userdata,
+        const int i,
+        const ParallelRangeTLS *__restrict UNUSED(tls))
 {
 	const DynamicPaintModifierApplyData *data = userdata;
 
@@ -1772,8 +1790,10 @@ static void dynamic_paint_apply_surface_vpaint_blend_cb(void *userdata, const in
 	blendColors(pPoint[i].color, pPoint[i].color[3], pPoint[i].e_color, pPoint[i].e_color[3], fcolor[i]);
 }
 
-static void dynamic_paint_apply_surface_vpaint_cb(void *userdata, const int p_index,
-                                                  const ParallelRangeTLS *UNUSED(tls))
+static void dynamic_paint_apply_surfa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list