diff options
Diffstat (limited to 'source/blender')
33 files changed, 268 insertions, 200 deletions
diff --git a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c index f68d1a2697c..8b3ea249396 100644 --- a/source/blender/blenkernel/intern/CCGSubSurf_legacy.c +++ b/source/blender/blenkernel/intern/CCGSubSurf_legacy.c @@ -136,7 +136,8 @@ typedef struct CCGSubSurfCalcSubdivData { int curLvl; } CCGSubSurfCalcSubdivData; -static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, int ptrIdx) +static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, int ptrIdx, + const ParallelRangeTLS *UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -227,7 +228,8 @@ static void ccgSubSurf__calcVertNormals_faces_accumulate_cb(void *userdata, int } } -static void ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int ptrIdx) +static void ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int ptrIdx, + const ParallelRangeTLS *UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -265,7 +267,8 @@ static void ccgSubSurf__calcVertNormals_faces_finalize_cb(void *userdata, int pt } } -static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(void *userdata, int ptrIdx) +static void ccgSubSurf__calcVertNormals_edges_accumulate_cb(void *userdata, int ptrIdx, + const ParallelRangeTLS *UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -396,7 +399,8 @@ static void ccgSubSurf__calcVertNormals(CCGSubSurf *ss, } -static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void *userdata, int ptrIdx) +static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void *userdata, int ptrIdx, + const ParallelRangeTLS *UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -483,7 +487,8 @@ static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_midpoints_cb(void * } } -static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb(void *userdata, int ptrIdx) +static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_cb(void *userdata, int ptrIdx, + const ParallelRangeTLS *UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; @@ -588,7 +593,8 @@ static void ccgSubSurf__calcSubdivLevel_interior_faces_edges_centerpoints_shift_ } } -static void ccgSubSurf__calcSubdivLevel_verts_copydata_cb(void *userdata, int ptrIdx) +static void ccgSubSurf__calcSubdivLevel_verts_copydata_cb(void *userdata, int ptrIdx, + const ParallelRangeTLS *UNUSED(tls)) { CCGSubSurfCalcSubdivData *data = userdata; diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index 310255a15c1..67153564a0f 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1165,7 +1165,7 @@ typedef struct ScopesUpdateDataChunk { float min[3], max[3]; } ScopesUpdateDataChunk; -static void scopes_update_cb(void *userdata, void *userdata_chunk, const int y, const int UNUSED(threadid)) +static void scopes_update_cb(void *userdata, const int y, const ParallelRangeTLS *tls) { const ScopesUpdateData *data = userdata; @@ -1175,7 +1175,7 @@ static void scopes_update_cb(void *userdata, void *userdata_chunk, const int y, const unsigned char *display_buffer = data->display_buffer; const int ycc_mode = data->ycc_mode; - ScopesUpdateDataChunk *data_chunk = userdata_chunk; + ScopesUpdateDataChunk *data_chunk = tls->userdata_chunk; unsigned int *bin_lum = data_chunk->bin_lum; unsigned int *bin_r = data_chunk->bin_r; unsigned int *bin_g = data_chunk->bin_g; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index b44ee21432c..81a721e77b9 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -611,11 +611,11 @@ static void freeGrid(PaintSurfaceData *data) bData->grid = NULL; } -static void grid_bound_insert_cb_ex(void *userdata, void *userdata_chunk, const int i, const int UNUSED(thread_id)) +static void grid_bound_insert_cb_ex(void *userdata, const int i, const ParallelRangeTLS *tls) { PaintBakeData *bData = userdata; - Bounds3D *grid_bound = userdata_chunk; + Bounds3D *grid_bound = tls->userdata_chunk; boundInsert(grid_bound, bData->realCoord[bData->s_pos[i]].v); } @@ -631,12 +631,12 @@ 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, void *userdata_chunk, const int i, const int UNUSED(thread_id)) +static void grid_cell_points_cb_ex(void *userdata, const int i, const ParallelRangeTLS *tls) { PaintBakeData *bData = userdata; VolumeGrid *grid = bData->grid; int *temp_t_index = grid->temp_t_index; - int *s_num = userdata_chunk; + int *s_num = tls->userdata_chunk; int co[3]; @@ -664,7 +664,7 @@ static void grid_cell_points_finalize(void *userdata, void *userdata_chunk) } } -static void grid_cell_bounds_cb(void *userdata, const int x) +static void grid_cell_bounds_cb(void *userdata, const int x, const ParallelRangeTLS *UNUSED(tls)) { PaintBakeData *bData = userdata; VolumeGrid *grid = bData->grid; @@ -1397,7 +1397,8 @@ 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) +static void dynamic_paint_set_init_color_tex_to_vcol_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintSetInitColorData *data = userdata; @@ -1431,7 +1432,8 @@ 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) +static void dynamic_paint_set_init_color_tex_to_imseq_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintSetInitColorData *data = userdata; @@ -1469,7 +1471,8 @@ 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) +static void dynamic_paint_set_init_color_vcol_to_imseq_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintSetInitColorData *data = userdata; @@ -1673,7 +1676,8 @@ typedef struct DynamicPaintModifierApplyData { MLoopCol *mloopcol_preview; } DynamicPaintModifierApplyData; -static void dynamic_paint_apply_surface_displace_cb(void *userdata, const int i) +static void dynamic_paint_apply_surface_displace_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintModifierApplyData *data = userdata; @@ -1708,7 +1712,8 @@ static void dynamicPaint_applySurfaceDisplace(DynamicPaintSurface *surface, Deri } } -static void dynamic_paint_apply_surface_vpaint_blend_cb(void *userdata, const int i) +static void dynamic_paint_apply_surface_vpaint_blend_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintModifierApplyData *data = userdata; @@ -1719,7 +1724,8 @@ 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) +static void dynamic_paint_apply_surface_vpaint_cb(void *userdata, const int p_index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintModifierApplyData *data = userdata; Object *ob = data->ob; @@ -1789,7 +1795,8 @@ static void dynamic_paint_apply_surface_vpaint_cb(void *userdata, const int p_in } } -static void dynamic_paint_apply_surface_wave_cb(void *userdata, const int i) +static void dynamic_paint_apply_surface_wave_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintModifierApplyData *data = userdata; @@ -2106,7 +2113,8 @@ typedef struct DynamicPaintCreateUVSurfaceData { uint32_t *active_points; } DynamicPaintCreateUVSurfaceData; -static void dynamic_paint_create_uv_surface_direct_cb(void *userdata, const int ty) +static void dynamic_paint_create_uv_surface_direct_cb(void *userdata, const int ty, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintCreateUVSurfaceData *data = userdata; @@ -2203,7 +2211,8 @@ static void dynamic_paint_create_uv_surface_direct_cb(void *userdata, const int } } -static void dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const int ty) +static void dynamic_paint_create_uv_surface_neighbor_cb(void *userdata, const int ty, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintCreateUVSurfaceData *data = userdata; @@ -2995,7 +3004,8 @@ typedef struct DynamicPaintOutputSurfaceImageData { ImBuf *ibuf; } DynamicPaintOutputSurfaceImageData; -static void dynamic_paint_output_surface_image_paint_cb(void *userdata, const int index) +static void dynamic_paint_output_surface_image_paint_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintOutputSurfaceImageData *data = userdata; @@ -3015,7 +3025,8 @@ static void dynamic_paint_output_surface_image_paint_cb(void *userdata, const in } } -static void dynamic_paint_output_surface_image_displace_cb(void *userdata, const int index) +static void dynamic_paint_output_surface_image_displace_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintOutputSurfaceImageData *data = userdata; @@ -3039,7 +3050,8 @@ static void dynamic_paint_output_surface_image_displace_cb(void *userdata, const ibuf->rect_float[pos + 3] = 1.0f; } -static void dynamic_paint_output_surface_image_wave_cb(void *userdata, const int index) +static void dynamic_paint_output_surface_image_wave_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintOutputSurfaceImageData *data = userdata; @@ -3061,7 +3073,8 @@ static void dynamic_paint_output_surface_image_wave_cb(void *userdata, const int ibuf->rect_float[pos + 3] = 1.0f; } -static void dynamic_paint_output_surface_image_wetmap_cb(void *userdata, const int index) +static void dynamic_paint_output_surface_image_wetmap_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintOutputSurfaceImageData *data = userdata; @@ -3549,7 +3562,8 @@ typedef struct DynamicPaintBrushVelocityData { const float timescale; } DynamicPaintBrushVelocityData; -static void dynamic_paint_brush_velocity_compute_cb(void *userdata, const int i) +static void dynamic_paint_brush_velocity_compute_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintBrushVelocityData *data = userdata; @@ -3699,7 +3713,7 @@ typedef struct DynamicPaintPaintData { * Paint a brush object mesh to the surface */ static void dynamic_paint_paint_mesh_cell_point_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int id, const int UNUSED(threadid)) + void *userdata, const int id, const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintPaintData *data = userdata; @@ -4140,7 +4154,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface, * Paint a particle system to the surface */ static void dynamic_paint_paint_particle_cell_point_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int id, const int UNUSED(threadid)) + void *userdata, const int id, const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintPaintData *data = userdata; @@ -4415,7 +4429,7 @@ static int dynamicPaint_paintParticles(DynamicPaintSurface *surface, /* paint a single point of defined proximity radius to the surface */ static void dynamic_paint_paint_single_point_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int index, const int UNUSED(threadid)) + void *userdata, const int index, const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintPaintData *data = userdata; @@ -4561,7 +4575,8 @@ static int dynamicPaint_paintSinglePoint( * Calculate current frame distances and directions for adjacency data */ -static void dynamic_paint_prepare_adjacency_cb(void *userdata, const int index) +static void dynamic_paint_prepare_adjacency_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { PaintSurfaceData *sData = userdata; PaintBakeData *bData = sData->bData; @@ -4788,7 +4803,8 @@ typedef struct DynamicPaintEffectData { * Prepare data required by effects for current frame. * Returns number of steps required */ -static void dynamic_paint_prepare_effect_cb(void *userdata, const int index) +static void dynamic_paint_prepare_effect_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintEffectData *data = userdata; @@ -4893,7 +4909,8 @@ static int dynamicPaint_prepareEffectStep( /** * Processes active effect step. */ -static void dynamic_paint_effect_spread_cb(void *userdata, const int index) +static void dynamic_paint_effect_spread_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintEffectData *data = userdata; @@ -4938,7 +4955,8 @@ static void dynamic_paint_effect_spread_cb(void *userdata, const int index) } } -static void dynamic_paint_effect_shrink_cb(void *userdata, const int index) +static void dynamic_paint_effect_shrink_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintEffectData *data = userdata; @@ -4988,7 +5006,8 @@ static void dynamic_paint_effect_shrink_cb(void *userdata, const int index) } } -static void dynamic_paint_effect_drip_cb(void *userdata, const int index) +static void dynamic_paint_effect_drip_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintEffectData *data = userdata; @@ -5166,7 +5185,8 @@ static void dynamicPaint_doEffectStep( } } -static void dynamic_paint_border_cb(void *userdata, const int b_index) +static void dynamic_paint_border_cb(void *userdata, const int b_index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintEffectData *data = userdata; @@ -5240,7 +5260,8 @@ static void dynamicPaint_doBorderStep(DynamicPaintSurface *surface) 0, sData->adj_data->total_border, &data, dynamic_paint_border_cb, sData->adj_data->total_border > 1000); } -static void dynamic_paint_wave_step_cb(void *userdata, const int index) +static void dynamic_paint_wave_step_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintEffectData *data = userdata; @@ -5403,7 +5424,8 @@ typedef struct DynamicPaintDissolveDryData { const float timescale; } DynamicPaintDissolveDryData; -static void dynamic_paint_surface_pre_step_cb(void *userdata, const int index) +static void dynamic_paint_surface_pre_step_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintDissolveDryData *data = userdata; @@ -5526,7 +5548,8 @@ typedef struct DynamicPaintGenerateBakeData { const bool new_bdata; } DynamicPaintGenerateBakeData; -static void dynamic_paint_generate_bake_data_cb(void *userdata, const int index) +static void dynamic_paint_generate_bake_data_cb(void *userdata, const int index, + const ParallelRangeTLS *UNUSED(tls)) { const DynamicPaintGenerateBakeData *data = userdata; diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index 104bb0c07a6..489f1965884 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -1434,7 +1434,8 @@ typedef struct MaskRasterizeBufferData { float *buffer; } MaskRasterizeBufferData; -static void maskrasterize_buffer_cb(void *userdata, int y) +static void maskrasterize_buffer_cb(void *userdata, int y, + const ParallelRangeTLS *UNUSED(tls)) { MaskRasterizeBufferData *data = userdata; diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 35757557f76..b58bea941e5 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -177,7 +177,8 @@ typedef struct MeshCalcNormalsData { float (*vnors)[3]; } MeshCalcNormalsData; -static void mesh_calc_normals_poly_cb(void *userdata, const int pidx) +static void mesh_calc_normals_poly_cb(void *userdata, const int pidx, + const ParallelRangeTLS *UNUSED(tls)) { MeshCalcNormalsData *data = userdata; const MPoly *mp = &data->mpolys[pidx]; @@ -185,7 +186,8 @@ static void mesh_calc_normals_poly_cb(void *userdata, const int pidx) BKE_mesh_calc_poly_normal(mp, data->mloop + mp->loopstart, data->mverts, data->pnors[pidx]); } -static void mesh_calc_normals_poly_prepare_cb(void *userdata, const int pidx) +static void mesh_calc_normals_poly_prepare_cb(void *userdata, const int pidx, + const ParallelRangeTLS *UNUSED(tls)) { MeshCalcNormalsData *data = userdata; const MPoly *mp = &data->mpolys[pidx]; @@ -247,14 +249,16 @@ static void mesh_calc_normals_poly_prepare_cb(void *userdata, const int pidx) } } -static void mesh_calc_normals_poly_accum_cb(void *userdata, const int lidx) +static void mesh_calc_normals_poly_accum_cb(void *userdata, const int lidx, + const ParallelRangeTLS *UNUSED(tls)) { MeshCalcNormalsData *data = userdata; add_v3_v3(data->vnors[data->mloop[lidx].v], data->lnors_weighted[lidx]); } -static void mesh_calc_normals_poly_finalize_cb(void *userdata, const int vidx) +static void mesh_calc_normals_poly_finalize_cb(void *userdata, const int vidx, + const ParallelRangeTLS *UNUSED(tls)) { MeshCalcNormalsData *data = userdata; diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 537c8926a5b..53e4119987f 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -502,7 +502,8 @@ typedef struct OceanSimulateData { float chop_amount; } OceanSimulateData; -static void ocean_compute_htilda(void *userdata, const int i) +static void ocean_compute_htilda(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { OceanSimulateData *osd = userdata; const Ocean *o = osd->o; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 38eb861599a..505f6c63baf 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -3371,14 +3371,14 @@ typedef struct DynamicStepSolverTaskData { } DynamicStepSolverTaskData; static void dynamics_step_sph_ddr_task_cb_ex( - void *userdata, void *userdata_chunk, const int p, const int UNUSED(thread_id)) + void *userdata, const int p, const ParallelRangeTLS *tls) { DynamicStepSolverTaskData *data = userdata; ParticleSimulationData *sim = data->sim; ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; - SPHData *sphdata = userdata_chunk; + SPHData *sphdata = tls->userdata_chunk; ParticleData *pa; @@ -3405,7 +3405,7 @@ static void dynamics_step_sph_ddr_task_cb_ex( } static void dynamics_step_sph_classical_basic_integrate_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int p, const int UNUSED(thread_id)) + void *userdata, const int p, const ParallelRangeTLS *UNUSED(tls)) { DynamicStepSolverTaskData *data = userdata; ParticleSimulationData *sim = data->sim; @@ -3421,13 +3421,13 @@ static void dynamics_step_sph_classical_basic_integrate_task_cb_ex( } static void dynamics_step_sph_classical_calc_density_task_cb_ex( - void *userdata, void *userdata_chunk, const int p, const int UNUSED(thread_id)) + void *userdata, const int p, const ParallelRangeTLS *tls) { DynamicStepSolverTaskData *data = userdata; ParticleSimulationData *sim = data->sim; ParticleSystem *psys = sim->psys; - SPHData *sphdata = userdata_chunk; + SPHData *sphdata = tls->userdata_chunk; ParticleData *pa; @@ -3439,14 +3439,14 @@ static void dynamics_step_sph_classical_calc_density_task_cb_ex( } static void dynamics_step_sph_classical_integrate_task_cb_ex( - void *userdata, void *userdata_chunk, const int p, const int UNUSED(thread_id)) + void *userdata, const int p, const ParallelRangeTLS *tls) { DynamicStepSolverTaskData *data = userdata; ParticleSimulationData *sim = data->sim; ParticleSystem *psys = sim->psys; ParticleSettings *part = psys->part; - SPHData *sphdata = userdata_chunk; + SPHData *sphdata = tls->userdata_chunk; ParticleData *pa; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 39d1d8e8510..e476ccbc48b 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -938,7 +938,8 @@ typedef struct PBVHUpdateData { int flag; } PBVHUpdateData; -static void pbvh_update_normals_accum_task_cb(void *userdata, const int n) +static void pbvh_update_normals_accum_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { PBVHUpdateData *data = userdata; @@ -991,7 +992,8 @@ static void pbvh_update_normals_accum_task_cb(void *userdata, const int n) } } -static void pbvh_update_normals_store_task_cb(void *userdata, const int n) +static void pbvh_update_normals_store_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { PBVHUpdateData *data = userdata; PBVH *bvh = data->bvh; @@ -1057,7 +1059,8 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes, MEM_freeN(vnors); } -static void pbvh_update_BB_redraw_task_cb(void *userdata, const int n) +static void pbvh_update_BB_redraw_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { PBVHUpdateData *data = userdata; PBVH *bvh = data->bvh; diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index f9d1793d7cb..09b0dc569cb 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -88,13 +88,13 @@ typedef struct ShrinkwrapCalcCBData { * for each vertex performs a nearest vertex search on the tree */ static void shrinkwrap_calc_nearest_vertex_cb_ex( - void *userdata, void *userdata_chunk, const int i, const int UNUSED(threadid)) + void *userdata, const int i, const ParallelRangeTLS *tls) { ShrinkwrapCalcCBData *data = userdata; ShrinkwrapCalcData *calc = data->calc; BVHTreeFromMesh *treeData = data->treeData; - BVHTreeNearest *nearest = userdata_chunk; + BVHTreeNearest *nearest = tls->userdata_chunk; float *co = calc->vertexCos[i]; float tmp_co[3]; @@ -257,7 +257,7 @@ bool BKE_shrinkwrap_project_normal( } static void shrinkwrap_calc_normal_projection_cb_ex( - void *userdata, void *userdata_chunk, const int i, const int UNUSED(threadid)) + void *userdata, const int i, const ParallelRangeTLS *tls) { ShrinkwrapCalcCBData *data = userdata; @@ -272,7 +272,7 @@ static void shrinkwrap_calc_normal_projection_cb_ex( float *proj_axis = data->proj_axis; SpaceTransform *local2aux = data->local2aux; - BVHTreeRayHit *hit = userdata_chunk; + BVHTreeRayHit *hit = tls->userdata_chunk; const float proj_limit_squared = calc->smd->projLimit * calc->smd->projLimit; float *co = calc->vertexCos[i]; @@ -495,13 +495,13 @@ static void shrinkwrap_calc_normal_projection(ShrinkwrapCalcData *calc, bool for * NN matches for each vertex */ static void shrinkwrap_calc_nearest_surface_point_cb_ex( - void *userdata, void *userdata_chunk, const int i, const int UNUSED(threadid)) + void *userdata, const int i, const ParallelRangeTLS *tls) { ShrinkwrapCalcCBData *data = userdata; ShrinkwrapCalcData *calc = data->calc; BVHTreeFromMesh *treeData = data->treeData; - BVHTreeNearest *nearest = userdata_chunk; + BVHTreeNearest *nearest = tls->userdata_chunk; float *co = calc->vertexCos[i]; float tmp_co[3]; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index fcf4724bd1c..37b9466645d 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -738,7 +738,7 @@ typedef struct ObstaclesFromDMData { int *num_obstacles; } ObstaclesFromDMData; -static void obstacles_from_derivedmesh_task_cb(void *userdata, const int z) +static void obstacles_from_derivedmesh_task_cb(void *userdata, const int z, const ParallelRangeTLS *UNUSED(tls)) { ObstaclesFromDMData *data = userdata; SmokeDomainSettings *sds = data->sds; @@ -1184,7 +1184,7 @@ typedef struct EmitFromParticlesData { float hr_smooth; } EmitFromParticlesData; -static void emit_from_particles_task_cb(void *userdata, const int z) +static void emit_from_particles_task_cb(void *userdata, const int z, const ParallelRangeTLS *UNUSED(tls)) { EmitFromParticlesData *data = userdata; SmokeFlowSettings *sfs = data->sfs; @@ -1567,7 +1567,7 @@ typedef struct EmitFromDMData { int *min, *max, *res; } EmitFromDMData; -static void emit_from_derivedmesh_task_cb(void *userdata, const int z) +static void emit_from_derivedmesh_task_cb(void *userdata, const int z, const ParallelRangeTLS *UNUSED(tls)) { EmitFromDMData *data = userdata; EmissionMap *em = data->em; @@ -2436,7 +2436,7 @@ typedef struct UpdateEffectorsData { unsigned char *obstacle; } UpdateEffectorsData; -static void update_effectors_task_cb(void *userdata, const int x) +static void update_effectors_task_cb(void *userdata, const int x, const ParallelRangeTLS *UNUSED(tls)) { UpdateEffectorsData *data = userdata; SmokeDomainSettings *sds = data->sds; diff --git a/source/blender/blenkernel/intern/tracking_auto.c b/source/blender/blenkernel/intern/tracking_auto.c index 40234bacdfe..5dc350640c0 100644 --- a/source/blender/blenkernel/intern/tracking_auto.c +++ b/source/blender/blenkernel/intern/tracking_auto.c @@ -432,7 +432,9 @@ AutoTrackContext *BKE_autotrack_context_new(MovieClip *clip, return context; } -static void autotrack_context_step_cb(void *userdata, int track) +static void autotrack_context_step_cb(void *userdata, + int track, + const ParallelRangeTLS *UNUSED(tls)) { AutoTrackContext *context = userdata; const int frame_delta = context->backwards ? -1 : 1; diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c index edddeb41cc8..9e8f01df1d5 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.c +++ b/source/blender/blenkernel/intern/tracking_stabilize.c @@ -1503,7 +1503,10 @@ typedef struct TrackingStabilizeFrameInterpolationData { interpolation_func interpolation; } TrackingStabilizeFrameInterpolationData; -static void tracking_stabilize_frame_interpolation_cb(void *userdata, int j) +static void tracking_stabilize_frame_interpolation_cb( + void *userdata, + int j, + const ParallelRangeTLS *UNUSED(tls)) { TrackingStabilizeFrameInterpolationData *data = userdata; ImBuf *ibuf = data->ibuf; diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index ccfa2b6e2e7..acfdd3729c1 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -116,15 +116,27 @@ void BLI_task_pool_delayed_push_begin(TaskPool *pool, int thread_id); void BLI_task_pool_delayed_push_end(TaskPool *pool, int thread_id); /* Parallel for routines */ -typedef void (*TaskParallelRangeFunc)(void *userdata, const int iter); -typedef void (*TaskParallelRangeFuncEx)(void *userdata, void *userdata_chunk, const int iter, const int thread_id); + +/* Per-thread specific data passed to the callback. */ +typedef struct ParallelRangeTLS { + /* Identifier of the thread who this data belongs to. */ + int thread_id; + /* Copy of user-specifier chunk, which is copied from original chunk to all + * worker threads. This is similar to OpenMP's firstprivate. + */ + void *userdata_chunk; +} ParallelRangeTLS; + +typedef void (*TaskParallelRangeFunc)(void *userdata, + const int iter, + const ParallelRangeTLS *tls); typedef void (*TaskParallelRangeFuncFinalize)(void *userdata, void *userdata_chunk); void BLI_task_parallel_range_ex( int start, int stop, void *userdata, void *userdata_chunk, const size_t userdata_chunk_size, - TaskParallelRangeFuncEx func_ex, + TaskParallelRangeFunc func, const bool use_threading, const bool use_dynamic_scheduling); void BLI_task_parallel_range( @@ -138,7 +150,7 @@ void BLI_task_parallel_range_finalize( void *userdata, void *userdata_chunk, const size_t userdata_chunk_size, - TaskParallelRangeFuncEx func_ex, + TaskParallelRangeFunc func, TaskParallelRangeFuncFinalize func_finalize, const bool use_threading, const bool use_dynamic_scheduling); diff --git a/source/blender/blenlib/intern/BLI_kdopbvh.c b/source/blender/blenlib/intern/BLI_kdopbvh.c index bd16bc1a9c6..6e33f75fe69 100644 --- a/source/blender/blenlib/intern/BLI_kdopbvh.c +++ b/source/blender/blenlib/intern/BLI_kdopbvh.c @@ -798,7 +798,7 @@ typedef struct BVHDivNodesData { int first_of_next_level; } BVHDivNodesData; -static void non_recursive_bvh_div_nodes_task_cb(void *userdata, const int j) +static void non_recursive_bvh_div_nodes_task_cb(void *userdata, const int j, const ParallelRangeTLS *UNUSED(tls)) { BVHDivNodesData *data = userdata; @@ -929,8 +929,9 @@ static void non_recursive_bvh_div_nodes( } else { /* Less hassle for debugging. */ + ParallelRangeTLS tls = {0}; for (int i_task = i; i_task < i_stop; i_task++) { - non_recursive_bvh_div_nodes_task_cb(&cb_data, i_task); + non_recursive_bvh_div_nodes_task_cb(&cb_data, i_task, &tls); } } } @@ -1276,7 +1277,7 @@ 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) +static void bvhtree_overlap_task_cb(void *userdata, const int j, const ParallelRangeTLS *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 fd7418a8f7b..cfadbba028f 100644 --- a/source/blender/blenlib/intern/math_statistics.c +++ b/source/blender/blenlib/intern/math_statistics.c @@ -46,7 +46,8 @@ typedef struct CovarianceData { int nbr_cos_vn; } CovarianceData; -static void covariance_m_vn_ex_task_cb(void *userdata, const int a) +static void covariance_m_vn_ex_task_cb(void *userdata, const int a, + const ParallelRangeTLS *UNUSED(tls)) { CovarianceData *data = userdata; const float *cos_vn = data->cos_vn; diff --git a/source/blender/blenlib/intern/task.c b/source/blender/blenlib/intern/task.c index afa20e3d766..030d4124e62 100644 --- a/source/blender/blenlib/intern/task.c +++ b/source/blender/blenlib/intern/task.c @@ -994,7 +994,6 @@ typedef struct ParallelRangeState { void *userdata; TaskParallelRangeFunc func; - TaskParallelRangeFuncEx func_ex; int iter; int chunk_size; @@ -1015,23 +1014,17 @@ BLI_INLINE bool parallel_range_next_iter_get( static void parallel_range_func( TaskPool * __restrict pool, void *userdata_chunk, - int threadid) + int thread_id) { ParallelRangeState * __restrict state = BLI_task_pool_userdata(pool); + ParallelRangeTLS tls = { + .thread_id = thread_id, + .userdata_chunk = userdata_chunk, + }; int iter, count; - while (parallel_range_next_iter_get(state, &iter, &count)) { - int i; - - if (state->func_ex) { - for (i = 0; i < count; ++i) { - state->func_ex(state->userdata, userdata_chunk, iter + i, threadid); - } - } - else { - for (i = 0; i < count; ++i) { - state->func(state->userdata, iter + i); - } + for (int i = 0; i < count; ++i) { + state->func(state->userdata, iter + i, &tls); } } } @@ -1047,7 +1040,6 @@ static void task_parallel_range_ex( void *userdata_chunk, const size_t userdata_chunk_size, TaskParallelRangeFunc func, - TaskParallelRangeFuncEx func_ex, TaskParallelRangeFuncFinalize func_finalize, const bool use_threading, const bool use_dynamic_scheduling) @@ -1059,7 +1051,7 @@ static void task_parallel_range_ex( void *userdata_chunk_local = NULL; void *userdata_chunk_array = NULL; - const bool use_userdata_chunk = (func_ex != NULL) && (userdata_chunk_size != 0) && (userdata_chunk != NULL); + const bool use_userdata_chunk = (userdata_chunk_size != 0) && (userdata_chunk != NULL); if (start == stop) { return; @@ -1067,7 +1059,6 @@ static void task_parallel_range_ex( BLI_assert(start < stop); if (userdata_chunk_size != 0) { - BLI_assert(func_ex != NULL && func == NULL); BLI_assert(userdata_chunk != NULL); } @@ -1075,28 +1066,25 @@ static void task_parallel_range_ex( * do everything from the main thread. */ if (!use_threading) { - if (func_ex) { - if (use_userdata_chunk) { - userdata_chunk_local = MALLOCA(userdata_chunk_size); - memcpy(userdata_chunk_local, userdata_chunk, userdata_chunk_size); - } - - for (i = start; i < stop; ++i) { - func_ex(userdata, userdata_chunk_local, i, 0); - } - - if (func_finalize) { - func_finalize(userdata, userdata_chunk_local); - } + if (use_userdata_chunk) { + userdata_chunk_local = MALLOCA(userdata_chunk_size); + memcpy(userdata_chunk_local, userdata_chunk, userdata_chunk_size); + } - MALLOCA_FREE(userdata_chunk_local, userdata_chunk_size); + ParallelRangeTLS tls = { + .thread_id = 0, + .userdata_chunk = userdata_chunk_local, + }; + for (i = start; i < stop; ++i) { + func(userdata, i, &tls); } - else { - for (i = start; i < stop; ++i) { - func(userdata, i); - } + + if (func_finalize) { + func_finalize(userdata, userdata_chunk_local); } + MALLOCA_FREE(userdata_chunk_local, userdata_chunk_size); + return; } @@ -1114,7 +1102,6 @@ static void task_parallel_range_ex( state.stop = stop; state.userdata = userdata; state.func = func; - state.func_ex = func_ex; state.iter = start; if (use_dynamic_scheduling) { state.chunk_size = 32; @@ -1180,12 +1167,12 @@ void BLI_task_parallel_range_ex( void *userdata, void *userdata_chunk, const size_t userdata_chunk_size, - TaskParallelRangeFuncEx func_ex, + TaskParallelRangeFunc func, const bool use_threading, const bool use_dynamic_scheduling) { task_parallel_range_ex( - start, stop, userdata, userdata_chunk, userdata_chunk_size, NULL, func_ex, NULL, + start, stop, userdata, userdata_chunk, userdata_chunk_size, func, NULL, use_threading, use_dynamic_scheduling); } @@ -1206,7 +1193,7 @@ void BLI_task_parallel_range( TaskParallelRangeFunc func, const bool use_threading) { - task_parallel_range_ex(start, stop, userdata, NULL, 0, func, NULL, NULL, use_threading, false); + task_parallel_range_ex(start, stop, userdata, NULL, 0, func, NULL, use_threading, false); } /** @@ -1232,13 +1219,13 @@ void BLI_task_parallel_range_finalize( void *userdata, void *userdata_chunk, const size_t userdata_chunk_size, - TaskParallelRangeFuncEx func_ex, + TaskParallelRangeFunc func, TaskParallelRangeFuncFinalize func_finalize, const bool use_threading, const bool use_dynamic_scheduling) { task_parallel_range_ex( - start, stop, userdata, userdata_chunk, userdata_chunk_size, NULL, func_ex, func_finalize, + start, stop, userdata, userdata_chunk, userdata_chunk_size, func, func_finalize, use_threading, use_dynamic_scheduling); } diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 96b2eb17c4c..29f74b13af8 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -419,7 +419,8 @@ typedef struct BMLoopInterpMultiresData { float d; } BMLoopInterpMultiresData; -static void loop_interp_multires_cb(void *userdata, int ix) +static void loop_interp_multires_cb(void *userdata, int ix, + const ParallelRangeTLS *UNUSED(tls)) { BMLoopInterpMultiresData *data = userdata; diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 09d25be41d6..4c5d68fb7ef 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -107,7 +107,9 @@ typedef struct CalculatePengindData { unsigned int layers; } CalculatePengindData; -static void calculate_pending_func(void *data_v, int i) +static void calculate_pending_func(void *data_v, + int i, + const ParallelRangeTLS * /*tls*/) { CalculatePengindData *data = (CalculatePengindData *)data_v; Depsgraph *graph = data->graph; diff --git a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc index 63d010849c3..546d4e3cf5d 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval_flush.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval_flush.cc @@ -83,14 +83,18 @@ void lib_id_recalc_data_tag(Main *bmain, ID *id) DEG_id_type_tag(bmain, GS(id->name)); } -void flush_init_operation_node_func(void *data_v, int i) +void flush_init_operation_node_func(void *data_v, + int i, + const ParallelRangeTLS * /*tls*/) { Depsgraph *graph = (Depsgraph *)data_v; OperationDepsNode *node = graph->operations[i]; node->scheduled = false; } -void flush_init_id_node_func(void *data_v, int i) +void flush_init_id_node_func(void *data_v, + int i, + const ParallelRangeTLS * /*tls*/) { Depsgraph *graph = (Depsgraph *)data_v; IDDepsNode *id_node = graph->id_nodes[i]; @@ -279,7 +283,9 @@ void deg_graph_flush_updates(Main *bmain, Depsgraph *graph) flush_editors_id_update(bmain, graph); } -static void graph_clear_func(void *data_v, int i) +static void graph_clear_func(void *data_v, + int i, + const ParallelRangeTLS * /*tls*/) { Depsgraph *graph = (Depsgraph *)data_v; OperationDepsNode *node = graph->operations[i]; diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index f0d9a0bbb68..1378952c4cc 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -151,7 +151,7 @@ typedef struct LoadTexData { float radius; } LoadTexData; -static void load_tex_task_cb_ex(void *userdata, void *UNUSED(userdata_chunck), const int j, const int thread_id) +static void load_tex_task_cb_ex(void *userdata, const int j, const ParallelRangeTLS *tls) { LoadTexData *data = userdata; Brush *br = data->br; @@ -212,7 +212,7 @@ static void load_tex_task_cb_ex(void *userdata, void *UNUSED(userdata_chunck), c if (col) { float rgba[4]; - paint_get_tex_pixel_col(mtex, x, y, rgba, pool, thread_id, convert_to_linear, colorspace); + paint_get_tex_pixel_col(mtex, x, y, rgba, pool, tls->thread_id, convert_to_linear, colorspace); buffer[index * 4] = rgba[0] * 255; buffer[index * 4 + 1] = rgba[1] * 255; @@ -220,7 +220,7 @@ static void load_tex_task_cb_ex(void *userdata, void *UNUSED(userdata_chunck), c buffer[index * 4 + 3] = rgba[3] * 255; } else { - float avg = paint_get_tex_pixel(mtex, x, y, pool, thread_id); + float avg = paint_get_tex_pixel(mtex, x, y, pool, tls->thread_id); avg += br->texture_sample_bias; @@ -367,7 +367,7 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima return 1; } -static void load_tex_cursor_task_cb(void *userdata, const int j) +static void load_tex_cursor_task_cb(void *userdata, const int j, const ParallelRangeTLS *UNUSED(tls)) { LoadTexData *data = userdata; Brush *br = data->br; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index a1aad2bdc57..b687c937a22 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -1070,7 +1070,8 @@ typedef struct Paint2DForeachData { int tilew; } Paint2DForeachData; -static void paint_2d_op_foreach_do(void *data_v, const int iter) +static void paint_2d_op_foreach_do(void *data_v, const int iter, + const ParallelRangeTLS *UNUSED(tls)) { Paint2DForeachData *data = (Paint2DForeachData *)data_v; paint_2d_do_making_brush(data->s, data->region, data->curveb, diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index 3b1b993a3e3..a48a3666ef9 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -104,7 +104,8 @@ typedef struct MaskTaskData { float (*clip_planes_final)[4]; } MaskTaskData; -static void mask_flood_fill_task_cb(void *userdata, const int i) +static void mask_flood_fill_task_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { MaskTaskData *data = userdata; @@ -218,7 +219,8 @@ static void flip_plane(float out[4], const float in[4], const char symm) out[3] = in[3]; } -static void mask_box_select_task_cb(void *userdata, const int i) +static void mask_box_select_task_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { MaskTaskData *data = userdata; @@ -373,7 +375,8 @@ static void mask_lasso_px_cb(int x, int x_end, int y, void *user_data) } while (++index != index_end); } -static void mask_gesture_lasso_task_cb(void *userdata, const int i) +static void mask_gesture_lasso_task_cb(void *userdata, const int i, + const ParallelRangeTLS *UNUSED(tls)) { LassoMaskData *lasso_data = userdata; MaskTaskData *data = &lasso_data->task_data; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index d61777a6d12..666272bd11a 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1431,7 +1431,7 @@ static float wpaint_get_active_weight(const MDeformVert *dv, const WeightPaintIn } static void do_wpaint_precompute_weight_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; const MDeformVert *dv = &data->me->dvert[n]; @@ -1458,7 +1458,7 @@ static void precompute_weight_values( } static void do_wpaint_brush_blur_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1547,7 +1547,7 @@ static void do_wpaint_brush_blur_task_cb_ex( } static void do_wpaint_brush_smear_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1654,7 +1654,7 @@ static void do_wpaint_brush_smear_task_cb_ex( } static void do_wpaint_brush_draw_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1724,7 +1724,7 @@ static void do_wpaint_brush_draw_task_cb_ex( } static void do_wpaint_brush_calc_average_weight_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2377,7 +2377,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f } static void do_vpaint_brush_calc_average_color_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2439,7 +2439,7 @@ static float tex_color_alpha_ubyte( } static void do_vpaint_brush_draw_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2531,7 +2531,7 @@ static void do_vpaint_brush_draw_task_cb_ex( } static void do_vpaint_brush_blur_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2640,7 +2640,7 @@ static void do_vpaint_brush_blur_task_cb_ex( } static void do_vpaint_brush_smear_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int UNUSED(thread_id)) + void *userdata, const int n, const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 53d7684e331..4684395c18d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -376,7 +376,8 @@ static bool sculpt_stroke_is_dynamic_topology( /*** paint mesh ***/ -static void paint_mesh_restore_co_task_cb(void *userdata, const int n) +static void paint_mesh_restore_co_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -794,7 +795,8 @@ static float calc_symmetry_feather(Sculpt *sd, StrokeCache *cache) * \note These are all _very_ similar, when changing one, check others. * \{ */ -static void calc_area_normal_and_center_task_cb(void *userdata, const int n) +static void calc_area_normal_and_center_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1626,7 +1628,7 @@ typedef struct { } SculptFindNearestToRayData; static void do_smooth_brush_mesh_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1648,7 +1650,7 @@ static void do_smooth_brush_mesh_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, smooth_mask ? 0.0f : (vd.mask ? *vd.mask : 0.0f), thread_id); + vd.no, vd.fno, smooth_mask ? 0.0f : (vd.mask ? *vd.mask : 0.0f), tls->thread_id); if (smooth_mask) { float val = neighbor_average_mask(ss, vd.vert_indices[vd.i]) - *vd.mask; val *= fade * bstrength; @@ -1674,7 +1676,7 @@ static void do_smooth_brush_mesh_task_cb_ex( } static void do_smooth_brush_bmesh_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1696,7 +1698,7 @@ static void do_smooth_brush_bmesh_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, smooth_mask ? 0.0f : *vd.mask, thread_id); + vd.no, vd.fno, smooth_mask ? 0.0f : *vd.mask, tls->thread_id); if (smooth_mask) { float val = bmesh_neighbor_average_mask(vd.bm_vert, vd.cd_vert_mask_offset) - *vd.mask; val *= fade * bstrength; @@ -1722,10 +1724,10 @@ static void do_smooth_brush_bmesh_task_cb_ex( } static void do_smooth_brush_multires_task_cb_ex( - void *userdata, void *userdata_chunk, const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; - SculptDoBrushSmoothGridDataChunk *data_chunk = userdata_chunk; + SculptDoBrushSmoothGridDataChunk *data_chunk = tls->userdata_chunk; SculptSession *ss = data->ob->sculpt; Sculpt *sd = data->sd; const Brush *brush = data->brush; @@ -1837,7 +1839,7 @@ static void do_smooth_brush_multires_task_cb_ex( const float strength_mask = (smooth_mask ? 0.0f : *mask); const float fade = bstrength * tex_strength( ss, brush, co, sqrtf(test.dist), - NULL, fno, strength_mask, thread_id); + NULL, fno, strength_mask, tls->thread_id); float f = 1.0f / 16.0f; if (x == 0 || x == gridsize - 1) @@ -1940,7 +1942,7 @@ static void do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_mask_brush_draw_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -1958,7 +1960,7 @@ static void do_mask_brush_draw_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, 0.0f, thread_id); + vd.no, vd.fno, 0.0f, tls->thread_id); (*vd.mask) += fade * bstrength; CLAMP(*vd.mask, 0, 1); @@ -2000,7 +2002,7 @@ static void do_mask_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_draw_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2022,7 +2024,7 @@ static void do_draw_brush_task_cb_ex( /* offset vertex */ const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -2060,7 +2062,7 @@ static void do_draw_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) * Used for 'SCULPT_TOOL_CREASE' and 'SCULPT_TOOL_BLOB' */ static void do_crease_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2084,7 +2086,7 @@ static void do_crease_brush_task_cb_ex( /* offset vertex */ const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float val1[3]; float val2[3]; @@ -2154,7 +2156,7 @@ static void do_crease_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_pinch_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2175,7 +2177,7 @@ static void do_pinch_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float val[3]; sub_v3_v3v3(val, test.location, vd.co); @@ -2205,7 +2207,7 @@ static void do_pinch_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_grab_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2232,7 +2234,7 @@ static void do_grab_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { const float fade = bstrength * tex_strength( ss, brush, orig_data.co, sqrtf(test.dist), - orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, thread_id); + orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -2266,7 +2268,7 @@ static void do_grab_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_nudge_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2288,7 +2290,7 @@ static void do_nudge_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -2322,7 +2324,7 @@ static void do_nudge_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_snake_hook_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2349,7 +2351,7 @@ static void do_snake_hook_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], grab_delta, fade); @@ -2428,7 +2430,7 @@ static void do_snake_hook_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int to } static void do_thumb_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2455,7 +2457,7 @@ static void do_thumb_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { const float fade = bstrength * tex_strength( ss, brush, orig_data.co, sqrtf(test.dist), - orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, thread_id); + orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], cono, fade); @@ -2489,7 +2491,7 @@ static void do_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_rotate_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2517,7 +2519,7 @@ static void do_rotate_brush_task_cb_ex( float vec[3], rot[3][3]; const float fade = bstrength * tex_strength( ss, brush, orig_data.co, sqrtf(test.dist), - orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, thread_id); + orig_data.no, NULL, vd.mask ? *vd.mask : 0.0f, tls->thread_id); sub_v3_v3v3(vec, orig_data.co, ss->cache->location); axis_angle_normalized_to_mat3(rot, ss->cache->sculpt_normal_symm, angle * fade); @@ -2551,7 +2553,7 @@ static void do_rotate_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_layer_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2585,7 +2587,7 @@ static void do_layer_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float *disp = &layer_disp[vd.i]; float val[3]; @@ -2638,7 +2640,7 @@ static void do_layer_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode } static void do_inflate_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2659,7 +2661,7 @@ static void do_inflate_brush_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); float val[3]; if (vd.fno) @@ -2802,7 +2804,7 @@ static float get_offset(Sculpt *sd, SculptSession *ss) } static void do_flatten_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2835,7 +2837,7 @@ static void do_flatten_brush_task_cb_ex( if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2880,7 +2882,7 @@ static void do_flatten_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totno } static void do_clay_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -2917,7 +2919,7 @@ static void do_clay_brush_task_cb_ex( * causes glitch with planes, see: T44390 */ const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -2966,7 +2968,7 @@ static void do_clay_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_clay_strips_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3002,7 +3004,7 @@ static void do_clay_strips_brush_task_cb_ex( * causes glitch with planes, see: T44390 */ const float fade = bstrength * tex_strength( ss, brush, vd.co, ss->cache->radius * test.dist, - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -3076,7 +3078,7 @@ static void do_clay_strips_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int t } static void do_fill_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3110,7 +3112,7 @@ static void do_fill_brush_task_cb_ex( if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -3157,7 +3159,7 @@ static void do_fill_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) } static void do_scrape_brush_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3190,7 +3192,7 @@ static void do_scrape_brush_task_cb_ex( if (plane_trim(ss->cache, brush, val)) { const float fade = bstrength * tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], val, fade); @@ -3237,7 +3239,7 @@ static void do_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnod } static void do_gravity_task_cb_ex( - void *userdata, void *UNUSED(userdata_chunk), const int n, const int thread_id) + void *userdata, const int n, const ParallelRangeTLS *tls) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3257,7 +3259,7 @@ static void do_gravity_task_cb_ex( if (sculpt_brush_test_sq_fn(&test, vd.co)) { const float fade = tex_strength( ss, brush, vd.co, sqrtf(test.dist), - vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, thread_id); + vd.no, vd.fno, vd.mask ? *vd.mask : 0.0f, tls->thread_id); mul_v3_v3fl(proxy[vd.i], offset, fade); @@ -3392,7 +3394,8 @@ static void sculpt_topology_update(Sculpt *sd, Object *ob, Brush *brush, Unified } } -static void do_brush_action_task_cb(void *userdata, const int n) +static void do_brush_action_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; @@ -3533,7 +3536,8 @@ static void sculpt_flush_pbvhvert_deform(Object *ob, PBVHVertexIter *vd) copy_v3_v3(me->mvert[index].co, newco); } -static void sculpt_combine_proxies_task_cb(void *userdata, const int n) +static void sculpt_combine_proxies_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; @@ -3628,7 +3632,8 @@ static void sculpt_update_keyblock(Object *ob) } } -static void sculpt_flush_stroke_deform_task_cb(void *userdata, const int n) +static void sculpt_flush_stroke_deform_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { SculptThreadedTaskData *data = userdata; SculptSession *ss = data->ob->sculpt; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 44bd872d107..ed3acf0edbb 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -316,7 +316,8 @@ static bool sculpt_undo_restore_mask(bContext *C, DerivedMesh *dm, SculptUndoNod return 1; } -static void sculpt_undo_bmesh_restore_generic_task_cb(void *userdata, const int n) +static void sculpt_undo_bmesh_restore_generic_task_cb(void *userdata, const int n, + const ParallelRangeTLS *UNUSED(tls)) { PBVHNode **nodes = userdata; diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 80cb42c0b3d..4c060f12a4b 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -459,13 +459,13 @@ typedef struct MakeHistogramViewData { } MakeHistogramViewData; static void make_histogram_view_from_ibuf_byte_cb_ex( - void *userdata, void *userdata_chunk, const int y, const int UNUSED(threadid)) + void *userdata, const int y, const ParallelRangeTLS *tls) { MakeHistogramViewData *data = userdata; const ImBuf *ibuf = data->ibuf; const unsigned char *src = (unsigned char *)ibuf->rect; - uint32_t (*cur_bins)[HIS_STEPS] = userdata_chunk; + uint32_t (*cur_bins)[HIS_STEPS] = tls->userdata_chunk; for (int x = 0; x < ibuf->x; x++) { const unsigned char *pixel = src + (y * ibuf->x + x) * 4; @@ -548,13 +548,13 @@ BLI_INLINE int get_bin_float(float f) } static void make_histogram_view_from_ibuf_float_cb_ex( - void *userdata, void *userdata_chunk, const int y, const int UNUSED(threadid)) + void *userdata, const int y, const ParallelRangeTLS *tls) { const MakeHistogramViewData *data = userdata; const ImBuf *ibuf = data->ibuf; const float *src = ibuf->rect_float; - uint32_t (*cur_bins)[HIS_STEPS] = userdata_chunk; + uint32_t (*cur_bins)[HIS_STEPS] = tls->userdata_chunk; for (int x = 0; x < ibuf->x; x++) { const float *pixel = src + (y * ibuf->x + x) * 4; diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c index fb8c0dd05a5..16fd3b098c9 100644 --- a/source/blender/modifiers/intern/MOD_displace.c +++ b/source/blender/modifiers/intern/MOD_displace.c @@ -213,7 +213,7 @@ typedef struct DisplaceUserdata { float (*vert_clnors)[3]; } DisplaceUserdata; -static void displaceModifier_do_task(void *userdata, const int iter) +static void displaceModifier_do_task(void *userdata, const int iter, const ParallelRangeTLS *UNUSED(tls)) { DisplaceUserdata *data = (DisplaceUserdata *)userdata; DisplaceModifierData *dmd = data->dmd; diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index b1938395a7b..afae29da350 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -234,7 +234,8 @@ typedef struct MeshdeformUserdata { float (*icagemat)[3]; } MeshdeformUserdata; -static void meshdeform_vert_task(void *userdata, const int iter) +static void meshdeform_vert_task(void *userdata, const int iter, + const ParallelRangeTLS *UNUSED(tls)) { MeshdeformUserdata *data = userdata; /*const*/ MeshDeformModifierData *mmd = data->mmd; diff --git a/source/blender/modifiers/intern/MOD_ocean.c b/source/blender/modifiers/intern/MOD_ocean.c index 8d8565e7e62..7fa539a0b5e 100644 --- a/source/blender/modifiers/intern/MOD_ocean.c +++ b/source/blender/modifiers/intern/MOD_ocean.c @@ -261,7 +261,8 @@ typedef struct GenerateOceanGeometryData { float ix, iy; } GenerateOceanGeometryData; -static void generate_ocean_geometry_vertices(void *userdata, const int y) +static void generate_ocean_geometry_vertices(void *userdata, const int y, + const ParallelRangeTLS *UNUSED(tls)) { GenerateOceanGeometryData *gogd = userdata; int x; @@ -275,7 +276,8 @@ static void generate_ocean_geometry_vertices(void *userdata, const int y) } } -static void generate_ocean_geometry_polygons(void *userdata, const int y) +static void generate_ocean_geometry_polygons(void *userdata, const int y, + const ParallelRangeTLS *UNUSED(tls)) { GenerateOceanGeometryData *gogd = userdata; int x; @@ -305,7 +307,8 @@ static void generate_ocean_geometry_polygons(void *userdata, const int y) } } -static void generate_ocean_geometry_uvs(void *userdata, const int y) +static void generate_ocean_geometry_uvs(void *userdata, const int y, + const ParallelRangeTLS *UNUSED(tls)) { GenerateOceanGeometryData *gogd = userdata; int x; diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index f8bad417f0b..d947ae148e9 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -753,7 +753,7 @@ BLI_INLINE float computeNormalDisplacement(const float point_co[3], const float return normal_dist; } -static void bindVert(void *userdata, void *UNUSED(userdata_chunk), const int index, const int UNUSED(threadid)) +static void bindVert(void *userdata, const int index, const ParallelRangeTLS *UNUSED(tls)) { SDefBindCalcData * const data = (SDefBindCalcData *)userdata; float point_co[3]; @@ -1049,7 +1049,7 @@ static bool surfacedeformBind(SurfaceDeformModifierData *smd, float (*vertexCos) return data.success == 1; } -static void deformVert(void *userdata, void *UNUSED(userdata_chunk), const int index, const int UNUSED(threadid)) +static void deformVert(void *userdata, const int index, const ParallelRangeTLS *UNUSED(tls)) { const SDefDeformData * const data = (SDefDeformData *)userdata; const SDefBind *sdbind = data->bind_verts[index].binds; diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c index b3fc3842635..99dc7a7bd92 100644 --- a/source/blender/modifiers/intern/MOD_uvwarp.c +++ b/source/blender/modifiers/intern/MOD_uvwarp.c @@ -112,7 +112,7 @@ typedef struct UVWarpData { int axis_v; } UVWarpData; -static void uv_warp_compute(void *userdata, const int i) +static void uv_warp_compute(void *userdata, const int i, const ParallelRangeTLS *UNUSED(tls)) { const UVWarpData *data = userdata; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 2ca380ba5c2..e26a3c49b7e 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -91,10 +91,10 @@ typedef struct Vert2GeomDataChunk { /** * Callback used by BLI_task 'for loop' helper. */ -static void vert2geom_task_cb_ex(void *userdata, void *userdata_chunk, const int iter, const int UNUSED(thread_id)) +static void vert2geom_task_cb_ex(void *userdata, const int iter, const ParallelRangeTLS *tls) { Vert2GeomData *data = userdata; - Vert2GeomDataChunk *data_chunk = userdata_chunk; + Vert2GeomDataChunk *data_chunk = tls->userdata_chunk; float tmp_co[3]; int i; diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index b215db49264..a33b6800df7 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -1007,7 +1007,8 @@ typedef struct SampleCallbackData { float *values; } SampleCallbackData; -static void point_density_sample_func(void *data_v, const int iter) +static void point_density_sample_func(void *data_v, const int iter, + const ParallelRangeTLS *UNUSED(tls)) { SampleCallbackData *data = (SampleCallbackData *)data_v; |