diff options
author | Jeroen Bakker <jeroen@blender.org> | 2021-06-01 13:59:15 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2021-06-01 14:18:41 +0300 |
commit | f0d93a71df85e91ec4e06d2b37e24fb728edf2c2 (patch) | |
tree | c07a29c2e6fb0b2ee0f99b25ce944945cee95480 /source/blender/draw | |
parent | 98c662672998a16a7ac00ab283357de17f3ae54c (diff) |
Cleanup: API for MeshExtractRunTimeData.
Diffstat (limited to 'source/blender/draw')
3 files changed, 159 insertions, 165 deletions
diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index b3ebce98524..5a086805580 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -54,63 +54,80 @@ namespace blender::draw { /** \name Mesh Elements Extract Struct * \{ */ -struct MeshExtractRunData { +struct ExtractorRunData { + /* Extractor where this run data belongs to. */ const MeshExtract *extractor; - void *buffer; - void *user_data; -}; - -using MeshExtractRunDataArray = blender::Vector<MeshExtractRunData>; + /* During iteration the VBO/IBO that is being build. */ + void *buffer = nullptr; + /* User data during iteration. Created in MeshExtract.init and passed along to other MeshExtract + * functions. */ + void *user_data = nullptr; -static void mesh_extract_run_data_array_add(MeshExtractRunDataArray &array, - const MeshExtract *extractor) -{ - MeshExtractRunData run_data; - run_data.extractor = extractor; - run_data.buffer = NULL; - run_data.user_data = NULL; - array.append(run_data); -} + ExtractorRunData(const MeshExtract *extractor) : extractor(extractor) + { + } +}; -static void mesh_extract_run_data_array_filter_iter_type(const MeshExtractRunDataArray &src, - MeshExtractRunDataArray &dst, - eMRIterType iter_type) -{ - for (const MeshExtractRunData &data : src) { - const MeshExtract *extractor = data.extractor; - if ((iter_type & MR_ITER_LOOPTRI) && extractor->iter_looptri_bm) { - BLI_assert(extractor->iter_looptri_mesh); - dst.append(data); - continue; - } - if ((iter_type & MR_ITER_POLY) && extractor->iter_poly_bm) { - BLI_assert(extractor->iter_poly_mesh); - dst.append(data); - continue; +class ExtractorRunDatas : public Vector<ExtractorRunData> { + public: + void filter_into(ExtractorRunDatas &result, eMRIterType iter_type) const + { + for (const ExtractorRunData &data : *this) { + const MeshExtract *extractor = data.extractor; + if ((iter_type & MR_ITER_LOOPTRI) && extractor->iter_looptri_bm) { + BLI_assert(extractor->iter_looptri_mesh); + result.append(data); + continue; + } + if ((iter_type & MR_ITER_POLY) && extractor->iter_poly_bm) { + BLI_assert(extractor->iter_poly_mesh); + result.append(data); + continue; + } + if ((iter_type & MR_ITER_LEDGE) && extractor->iter_ledge_bm) { + BLI_assert(extractor->iter_ledge_mesh); + result.append(data); + continue; + } + if ((iter_type & MR_ITER_LVERT) && extractor->iter_lvert_bm) { + BLI_assert(extractor->iter_lvert_mesh); + result.append(data); + continue; + } } - if ((iter_type & MR_ITER_LEDGE) && extractor->iter_ledge_bm) { - BLI_assert(extractor->iter_ledge_mesh); - dst.append(data); - continue; + } + + void filter_threaded_extractors_into(ExtractorRunDatas &result) + { + for (const ExtractorRunData &data : *this) { + const MeshExtract *extractor = data.extractor; + if (extractor->use_threading) { + result.append(extractor); + } } - if ((iter_type & MR_ITER_LVERT) && extractor->iter_lvert_bm) { - BLI_assert(extractor->iter_lvert_mesh); - dst.append(data); - continue; + } + + eMRIterType iter_types() + { + eMRIterType iter_type = static_cast<eMRIterType>(0); + + for (const ExtractorRunData &data : *this) { + const MeshExtract *extractor = data.extractor; + iter_type |= mesh_extract_iter_type(extractor); } + return iter_type; } -} -static void mesh_extract_run_data_array_filter_threading( - const MeshExtractRunDataArray &src, MeshExtractRunDataArray &dst_multi_threaded) -{ - for (const MeshExtractRunData &data : src) { - const MeshExtract *extractor = data.extractor; - if (extractor->use_threading) { - mesh_extract_run_data_array_add(dst_multi_threaded, extractor); + eMRDataType data_types() + { + eMRDataType data_type = static_cast<eMRDataType>(0); + for (const ExtractorRunData &data : *this) { + const MeshExtract *extractor = data.extractor; + data_type |= extractor->data_type; } + return data_type; } -} +}; /** \} */ @@ -118,34 +135,13 @@ static void mesh_extract_run_data_array_filter_threading( /** \name Extract * \{ */ -static void extracts_flags_get(const MeshExtractRunDataArray &extractors, - eMRIterType *r_iter_type, - eMRDataType *r_data_flag) -{ - eMRIterType iter_type = static_cast<eMRIterType>(0); - eMRDataType data_flag = static_cast<eMRDataType>(0); - - for (const MeshExtractRunData &data : extractors) { - const MeshExtract *extractor = data.extractor; - iter_type |= mesh_extract_iter_type(extractor); - data_flag |= extractor->data_flag; - } - - if (r_iter_type) { - *r_iter_type = iter_type; - } - if (r_data_flag) { - *r_data_flag = data_flag; - } -} - BLI_INLINE void extract_init(const MeshRenderData *mr, struct MeshBatchCache *cache, - MeshExtractRunDataArray &extractors, + ExtractorRunDatas &extractors, MeshBufferCache *mbc) { /* Multi thread. */ - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { const MeshExtract *extractor = run_data.extractor; run_data.buffer = mesh_extract_buffer_get(extractor, mbc); run_data.user_data = extractor->init(mr, cache, run_data.buffer); @@ -154,14 +150,14 @@ BLI_INLINE void extract_init(const MeshRenderData *mr, BLI_INLINE void extract_iter_looptri_bm(const MeshRenderData *mr, const ExtractTriBMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_LOOPTRI); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_LOOPTRI); EXTRACT_TRIS_LOOPTRI_FOREACH_BM_BEGIN(elt, elt_index, params) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_looptri_bm(mr, elt, elt_index, run_data.user_data); } } @@ -170,14 +166,14 @@ BLI_INLINE void extract_iter_looptri_bm(const MeshRenderData *mr, BLI_INLINE void extract_iter_looptri_mesh(const MeshRenderData *mr, const ExtractTriMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_LOOPTRI); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_LOOPTRI); EXTRACT_TRIS_LOOPTRI_FOREACH_MESH_BEGIN(mlt, mlt_index, params) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_looptri_mesh(mr, mlt, mlt_index, run_data.user_data); } } @@ -186,14 +182,14 @@ BLI_INLINE void extract_iter_looptri_mesh(const MeshRenderData *mr, BLI_INLINE void extract_iter_poly_bm(const MeshRenderData *mr, const ExtractPolyBMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_POLY); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_POLY); EXTRACT_POLY_FOREACH_BM_BEGIN(f, f_index, params, mr) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_poly_bm(mr, f, f_index, run_data.user_data); } } @@ -202,14 +198,14 @@ BLI_INLINE void extract_iter_poly_bm(const MeshRenderData *mr, BLI_INLINE void extract_iter_poly_mesh(const MeshRenderData *mr, const ExtractPolyMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_POLY); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_POLY); EXTRACT_POLY_FOREACH_MESH_BEGIN(mp, mp_index, params, mr) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_poly_mesh(mr, mp, mp_index, run_data.user_data); } } @@ -218,14 +214,14 @@ BLI_INLINE void extract_iter_poly_mesh(const MeshRenderData *mr, BLI_INLINE void extract_iter_ledge_bm(const MeshRenderData *mr, const ExtractLEdgeBMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_LEDGE); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_LEDGE); EXTRACT_LEDGE_FOREACH_BM_BEGIN(eed, ledge_index, params) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_ledge_bm(mr, eed, ledge_index, run_data.user_data); } } @@ -234,14 +230,14 @@ BLI_INLINE void extract_iter_ledge_bm(const MeshRenderData *mr, BLI_INLINE void extract_iter_ledge_mesh(const MeshRenderData *mr, const ExtractLEdgeMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_LEDGE); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_LEDGE); EXTRACT_LEDGE_FOREACH_MESH_BEGIN(med, ledge_index, params, mr) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_ledge_mesh(mr, med, ledge_index, run_data.user_data); } } @@ -250,14 +246,14 @@ BLI_INLINE void extract_iter_ledge_mesh(const MeshRenderData *mr, BLI_INLINE void extract_iter_lvert_bm(const MeshRenderData *mr, const ExtractLVertBMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_LVERT); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_LVERT); EXTRACT_LVERT_FOREACH_BM_BEGIN(eve, lvert_index, params) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_lvert_bm(mr, eve, lvert_index, run_data.user_data); } } @@ -266,14 +262,14 @@ BLI_INLINE void extract_iter_lvert_bm(const MeshRenderData *mr, BLI_INLINE void extract_iter_lvert_mesh(const MeshRenderData *mr, const ExtractLVertMesh_Params *params, - const MeshExtractRunDataArray &all_extractors) + const ExtractorRunDatas &all_extractors) { - MeshExtractRunDataArray extractors; - mesh_extract_run_data_array_filter_iter_type(all_extractors, extractors, MR_ITER_LVERT); + ExtractorRunDatas extractors; + all_extractors.filter_into(extractors, MR_ITER_LVERT); EXTRACT_LVERT_FOREACH_MESH_BEGIN(mv, lvert_index, params, mr) { - for (MeshExtractRunData &run_data : extractors) { + for (ExtractorRunData &run_data : extractors) { run_data.extractor->iter_lvert_mesh(mr, mv, lvert_index, run_data.user_data); } } @@ -282,9 +278,9 @@ BLI_INLINE void extract_iter_lvert_mesh(const MeshRenderData *mr, BLI_INLINE void extract_finish(const MeshRenderData *mr, struct MeshBatchCache *cache, - const MeshExtractRunDataArray &extractors) + const ExtractorRunDatas &extractors) { - for (const MeshExtractRunData &run_data : extractors) { + for (const ExtractorRunData &run_data : extractors) { const MeshExtract *extractor = run_data.extractor; if (extractor->finish) { extractor->finish(mr, cache, run_data.buffer, run_data.user_data); @@ -295,7 +291,7 @@ BLI_INLINE void extract_finish(const MeshRenderData *mr, /* Single Thread. */ BLI_INLINE void extract_run_and_finish_init(const MeshRenderData *mr, struct MeshBatchCache *cache, - MeshExtractRunDataArray &extractors, + ExtractorRunDatas &extractors, eMRIterType iter_type, MeshBufferCache *mbc) { @@ -385,7 +381,7 @@ struct ExtractTaskData { * This structure makes sure that when extract_init is called, that the user data of all * iterations are updated. */ - MeshExtractRunDataArray *extractors = nullptr; + ExtractorRunDatas *extractors = nullptr; MeshBufferCache *mbc = nullptr; int32_t *task_counter = nullptr; @@ -396,12 +392,12 @@ struct ExtractTaskData { ExtractTaskData(const MeshRenderData *mr, struct MeshBatchCache *cache, - MeshExtractRunDataArray *extractors, + ExtractorRunDatas *extractors, MeshBufferCache *mbc, int32_t *task_counter) : mr(mr), cache(cache), extractors(extractors), mbc(mbc), task_counter(task_counter) { - extracts_flags_get(*extractors, &iter_type, NULL); + iter_type = extractors->iter_types(); }; ExtractTaskData(const ExtractTaskData &src) = default; @@ -416,12 +412,11 @@ struct ExtractTaskData { #endif }; -static ExtractTaskData *extract_extract_iter_task_data_create_mesh( - const MeshRenderData *mr, - MeshBatchCache *cache, - MeshExtractRunDataArray *extractors, - MeshBufferCache *mbc, - int32_t *task_counter) +static ExtractTaskData *extract_extract_iter_task_data_create_mesh(const MeshRenderData *mr, + MeshBatchCache *cache, + ExtractorRunDatas *extractors, + MeshBufferCache *mbc, + int32_t *task_counter) { ExtractTaskData *taskdata = new ExtractTaskData(mr, cache, extractors, mbc, task_counter); @@ -445,7 +440,7 @@ BLI_INLINE void mesh_extract_iter(const MeshRenderData *mr, const eMRIterType iter_type, int start, int end, - MeshExtractRunDataArray &extractors) + ExtractorRunDatas &extractors) { switch (mr->extract_type) { case MR_EXTRACT_BMESH: @@ -791,14 +786,14 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, GPU_use_hq_normals_workaround(); /* Create an array containing all the extractors that needs to be executed. */ - MeshExtractRunDataArray extractors; + ExtractorRunDatas extractors; #define EXTRACT_ADD_REQUESTED(type, type_lowercase, name) \ do { \ if (DRW_##type_lowercase##_requested(mbc->type_lowercase.name)) { \ const MeshExtract *extractor = mesh_extract_override_get( \ &extract_##name, do_hq_normals, do_lines_loose_subbuffer); \ - mesh_extract_run_data_array_add(extractors, extractor); \ + extractors.append(extractor); \ } \ } while (0) @@ -847,9 +842,8 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, double rdata_start = PIL_check_seconds_timer(); #endif - eMRIterType iter_type; - eMRDataType data_flag; - extracts_flags_get(extractors, &iter_type, &data_flag); + eMRIterType iter_type = extractors.iter_types(); + eMRDataType data_flag = extractors.data_types(); MeshRenderData *mr = mesh_render_data_create(me, extraction_cache, @@ -880,11 +874,11 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, uint threads_to_use = 0; /* First run the requested extractors that do not support asynchronous ranges. */ - for (const MeshExtractRunData &run_data : extractors) { + for (const ExtractorRunData &run_data : extractors) { const MeshExtract *extractor = run_data.extractor; if (!extractor->use_threading) { - MeshExtractRunDataArray *single_threaded_extractors = new MeshExtractRunDataArray(); - mesh_extract_run_data_array_add(*single_threaded_extractors, extractor); + ExtractorRunDatas *single_threaded_extractors = new ExtractorRunDatas(); + single_threaded_extractors->append(extractor); ExtractTaskData *taskdata = extract_extract_iter_task_data_create_mesh( mr, cache, single_threaded_extractors, mbc, NULL); struct TaskNode *task_node = extract_single_threaded_task_node_create(task_graph, @@ -895,8 +889,8 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, } /* Distribute the remaining extractors into ranges per core. */ - MeshExtractRunDataArray *multi_threaded_extractors = new MeshExtractRunDataArray(); - mesh_extract_run_data_array_filter_threading(extractors, *multi_threaded_extractors); + ExtractorRunDatas *multi_threaded_extractors = new ExtractorRunDatas(); + extractors.filter_threaded_extractors_into(*multi_threaded_extractors); if (!multi_threaded_extractors->is_empty()) { /* * Determine the number of thread to use for multithreading. @@ -927,7 +921,7 @@ static void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, } else { /* Run all requests on the same thread. */ - MeshExtractRunDataArray *extractors_copy = new MeshExtractRunDataArray(extractors); + ExtractorRunDatas *extractors_copy = new ExtractorRunDatas(extractors); ExtractTaskData *taskdata = extract_extract_iter_task_data_create_mesh( mr, cache, extractors_copy, mbc, NULL); diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c b/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c index cc787b5a40f..324ebd2ec38 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c @@ -246,7 +246,7 @@ const MeshExtract extract_tris = {.init = extract_tris_init, .iter_looptri_bm = extract_tris_iter_looptri_bm, .iter_looptri_mesh = extract_tris_iter_looptri_mesh, .finish = extract_tris_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.tris)}; @@ -375,7 +375,7 @@ const MeshExtract extract_lines = {.init = extract_lines_init, .iter_ledge_bm = extract_lines_iter_ledge_bm, .iter_ledge_mesh = extract_lines_iter_ledge_mesh, .finish = extract_lines_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.lines)}; @@ -414,7 +414,7 @@ const MeshExtract extract_lines_with_lines_loose = { .iter_ledge_bm = extract_lines_iter_ledge_bm, .iter_ledge_mesh = extract_lines_iter_ledge_mesh, .finish = extract_lines_with_lines_loose_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.lines)}; @@ -542,7 +542,7 @@ const MeshExtract extract_points = {.init = extract_points_init, .iter_lvert_bm = extract_points_iter_lvert_bm, .iter_lvert_mesh = extract_points_iter_lvert_mesh, .finish = extract_points_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.points)}; @@ -617,7 +617,7 @@ const MeshExtract extract_fdots = {.init = extract_fdots_init, .iter_poly_bm = extract_fdots_iter_poly_bm, .iter_poly_mesh = extract_fdots_iter_poly_mesh, .finish = extract_fdots_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.fdots)}; @@ -700,7 +700,7 @@ const MeshExtract extract_lines_paint_mask = { .init = extract_lines_paint_mask_init, .iter_poly_mesh = extract_lines_paint_mask_iter_poly_mesh, .finish = extract_lines_paint_mask_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.lines_paint_mask)}; @@ -852,7 +852,7 @@ const MeshExtract extract_lines_adjacency = { .iter_looptri_bm = extract_lines_adjacency_iter_looptri_bm, .iter_looptri_mesh = extract_lines_adjacency_iter_looptri_mesh, .finish = extract_lines_adjacency_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.lines_adjacency)}; @@ -928,7 +928,7 @@ const MeshExtract extract_edituv_tris = { .iter_looptri_bm = extract_edituv_tris_iter_looptri_bm, .iter_looptri_mesh = extract_edituv_tris_iter_looptri_mesh, .finish = extract_edituv_tris_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.edituv_tris)}; @@ -1012,7 +1012,7 @@ const MeshExtract extract_edituv_lines = { .iter_poly_bm = extract_edituv_lines_iter_poly_bm, .iter_poly_mesh = extract_edituv_lines_iter_poly_mesh, .finish = extract_edituv_lines_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.edituv_lines)}; @@ -1091,7 +1091,7 @@ const MeshExtract extract_edituv_points = { .iter_poly_bm = extract_edituv_points_iter_poly_bm, .iter_poly_mesh = extract_edituv_points_iter_poly_mesh, .finish = extract_edituv_points_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.edituv_points)}; @@ -1182,7 +1182,7 @@ const MeshExtract extract_edituv_fdots = { .iter_poly_bm = extract_edituv_fdots_iter_poly_bm, .iter_poly_mesh = extract_edituv_fdots_iter_poly_mesh, .finish = extract_edituv_fdots_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, ibo.edituv_fdots)}; @@ -1362,7 +1362,7 @@ const MeshExtract extract_pos_nor = {.init = extract_pos_nor_init, .iter_lvert_bm = extract_pos_nor_iter_lvert_bm, .iter_lvert_mesh = extract_pos_nor_iter_lvert_mesh, .finish = extract_pos_nor_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.pos_nor)}; @@ -1550,7 +1550,7 @@ const MeshExtract extract_pos_nor_hq = { .iter_lvert_bm = extract_pos_nor_hq_iter_lvert_bm, .iter_lvert_mesh = extract_pos_nor_hq_iter_lvert_mesh, .finish = extract_pos_nor_hq_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.pos_nor)}; @@ -1641,7 +1641,7 @@ static void extract_lnor_hq_iter_poly_mesh(const MeshRenderData *mr, const MeshExtract extract_lnor_hq = {.init = extract_lnor_hq_init, .iter_poly_bm = extract_lnor_hq_iter_poly_bm, .iter_poly_mesh = extract_lnor_hq_iter_poly_mesh, - .data_flag = MR_DATA_LOOP_NOR, + .data_type = MR_DATA_LOOP_NOR, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.lnor)}; @@ -1730,7 +1730,7 @@ static void extract_lnor_iter_poly_mesh(const MeshRenderData *mr, const MeshExtract extract_lnor = {.init = extract_lnor_init, .iter_poly_bm = extract_lnor_iter_poly_bm, .iter_poly_mesh = extract_lnor_iter_poly_mesh, - .data_flag = MR_DATA_LOOP_NOR, + .data_type = MR_DATA_LOOP_NOR, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.lnor)}; @@ -1825,7 +1825,7 @@ static void *extract_uv_init(const MeshRenderData *mr, struct MeshBatchCache *ca } const MeshExtract extract_uv = {.init = extract_uv_init, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.uv)}; @@ -2014,7 +2014,7 @@ static void *extract_tan_init(const MeshRenderData *mr, struct MeshBatchCache *c } const MeshExtract extract_tan = {.init = extract_tan_init, - .data_flag = MR_DATA_POLY_NOR | MR_DATA_TAN_LOOP_NOR | + .data_type = MR_DATA_POLY_NOR | MR_DATA_TAN_LOOP_NOR | MR_DATA_LOOPTRI, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.tan)}; @@ -2033,7 +2033,7 @@ static void *extract_tan_hq_init(const MeshRenderData *mr, struct MeshBatchCache const MeshExtract extract_tan_hq = { .init = extract_tan_hq_init, - .data_flag = MR_DATA_POLY_NOR | MR_DATA_TAN_LOOP_NOR | MR_DATA_LOOPTRI, + .data_type = MR_DATA_POLY_NOR | MR_DATA_TAN_LOOP_NOR | MR_DATA_LOOPTRI, .use_threading = false, }; @@ -2132,7 +2132,7 @@ static void *extract_sculpt_data_init(const MeshRenderData *mr, const MeshExtract extract_sculpt_data = { .init = extract_sculpt_data_init, - .data_flag = 0, + .data_type = 0, /* TODO: enable threading. */ .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.sculpt_data)}; @@ -2280,7 +2280,7 @@ static void *extract_vcol_init(const MeshRenderData *mr, struct MeshBatchCache * } const MeshExtract extract_vcol = {.init = extract_vcol_init, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.vcol)}; @@ -2366,7 +2366,7 @@ const MeshExtract extract_orco = {.init = extract_orco_init, .iter_poly_bm = extract_orco_iter_poly_bm, .iter_poly_mesh = extract_orco_iter_poly_mesh, .finish = extract_orco_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.orco)}; @@ -2567,7 +2567,7 @@ const MeshExtract extract_edge_fac = { .iter_ledge_bm = extract_edge_fac_iter_ledge_bm, .iter_ledge_mesh = extract_edge_fac_iter_ledge_mesh, .finish = extract_edge_fac_finish, - .data_flag = MR_DATA_POLY_NOR, + .data_type = MR_DATA_POLY_NOR, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.edge_fac)}; @@ -2721,7 +2721,7 @@ const MeshExtract extract_weights = {.init = extract_weights_init, .iter_poly_bm = extract_weights_iter_poly_bm, .iter_poly_mesh = extract_weights_iter_poly_mesh, .finish = extract_weights_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.weights)}; @@ -3000,7 +3000,7 @@ const MeshExtract extract_edit_data = { .iter_ledge_mesh = extract_edit_data_iter_ledge_mesh, .iter_lvert_bm = extract_edit_data_iter_lvert_bm, .iter_lvert_mesh = extract_edit_data_iter_lvert_mesh, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.edit_data)}; @@ -3111,7 +3111,7 @@ const MeshExtract extract_edituv_data = { .iter_poly_bm = extract_edituv_data_iter_poly_bm, .iter_poly_mesh = extract_edituv_data_iter_poly_mesh, .finish = extract_edituv_data_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.edituv_data)}; @@ -3227,7 +3227,7 @@ static void extract_edituv_stretch_area_finish(const MeshRenderData *mr, const MeshExtract extract_edituv_stretch_area = { .init = extract_edituv_stretch_area_init, .finish = extract_edituv_stretch_area_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.edituv_stretch_area)}; @@ -3430,7 +3430,7 @@ const MeshExtract extract_edituv_stretch_angle = { .iter_poly_bm = extract_edituv_stretch_angle_iter_poly_bm, .iter_poly_mesh = extract_edituv_stretch_angle_iter_poly_mesh, .finish = extract_edituv_stretch_angle_finish, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.edituv_stretch_angle)}; @@ -4037,7 +4037,7 @@ const MeshExtract extract_mesh_analysis = { .finish = extract_analysis_iter_finish_mesh, /* This is not needed for all visualization types. * * Maybe split into different extract. */ - .data_flag = MR_DATA_POLY_NOR | MR_DATA_LOOPTRI, + .data_type = MR_DATA_POLY_NOR | MR_DATA_LOOPTRI, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.mesh_analysis)}; @@ -4117,7 +4117,7 @@ const MeshExtract extract_fdots_pos = { .init = extract_fdots_pos_init, .iter_poly_bm = extract_fdots_pos_iter_poly_bm, .iter_poly_mesh = extract_fdots_pos_iter_poly_mesh, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.fdots_pos)}; @@ -4199,7 +4199,7 @@ static void extract_fdots_nor_finish(const MeshRenderData *mr, const MeshExtract extract_fdots_nor = { .init = extract_fdots_nor_init, .finish = extract_fdots_nor_finish, - .data_flag = MR_DATA_POLY_NOR, + .data_type = MR_DATA_POLY_NOR, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.fdots_nor)}; @@ -4276,7 +4276,7 @@ static void extract_fdots_nor_hq_finish(const MeshRenderData *mr, const MeshExtract extract_fdots_nor_hq = { .init = extract_fdots_nor_hq_init, .finish = extract_fdots_nor_hq_finish, - .data_flag = MR_DATA_POLY_NOR, + .data_type = MR_DATA_POLY_NOR, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.fdots_nor)}; @@ -4375,7 +4375,7 @@ const MeshExtract extract_fdots_uv = { .iter_poly_bm = extract_fdots_uv_iter_poly_bm, .iter_poly_mesh = extract_fdots_uv_iter_poly_mesh, .finish = extract_fdots_uv_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.fdots_uv)}; @@ -4447,7 +4447,7 @@ const MeshExtract extract_fdots_edituv_data = { .iter_poly_bm = extract_fdots_edituv_data_iter_poly_bm, .iter_poly_mesh = extract_fdots_edituv_data_iter_poly_mesh, .finish = extract_fdots_edituv_data_finish, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.fdots_edituv_data)}; @@ -4504,7 +4504,7 @@ static void *extract_skin_roots_init(const MeshRenderData *mr, const MeshExtract extract_skin_roots = { .init = extract_skin_roots_init, - .data_flag = 0, + .data_type = 0, .use_threading = false, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.skin_roots)}; @@ -4676,7 +4676,7 @@ const MeshExtract extract_poly_idx = { .init = extract_select_idx_init, .iter_poly_bm = extract_poly_idx_iter_poly_bm, .iter_poly_mesh = extract_poly_idx_iter_poly_mesh, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.poly_idx)}; @@ -4686,7 +4686,7 @@ const MeshExtract extract_edge_idx = { .iter_poly_mesh = extract_edge_idx_iter_poly_mesh, .iter_ledge_bm = extract_edge_idx_iter_ledge_bm, .iter_ledge_mesh = extract_edge_idx_iter_ledge_mesh, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.edge_idx)}; @@ -4698,7 +4698,7 @@ const MeshExtract extract_vert_idx = { .iter_ledge_mesh = extract_vert_idx_iter_ledge_mesh, .iter_lvert_bm = extract_vert_idx_iter_lvert_bm, .iter_lvert_mesh = extract_vert_idx_iter_lvert_mesh, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.vert_idx)}; @@ -4743,6 +4743,6 @@ const MeshExtract extract_fdot_idx = { .init = extract_fdot_idx_init, .iter_poly_bm = extract_fdot_idx_iter_poly_bm, .iter_poly_mesh = extract_fdot_idx_iter_poly_mesh, - .data_flag = 0, + .data_type = 0, .use_threading = true, .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.fdot_idx)};
\ No newline at end of file diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_private.h b/source/blender/draw/intern/draw_cache_extract_mesh_private.h index 6dd2ef4c16f..fbce3b17a40 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_private.h +++ b/source/blender/draw/intern/draw_cache_extract_mesh_private.h @@ -430,7 +430,7 @@ typedef struct MeshExtract { /** Executed on one worker thread after all elements iterations. */ ExtractFinishFn *finish; /** Used to request common data. */ - const eMRDataType data_flag; + const eMRDataType data_type; /** Used to know if the element callbacks are thread-safe and can be parallelized. */ const bool use_threading; /** |