59 #ifdef WITH_CXX_GUARDEDALLOC
60 MEM_CXX_CLASS_ALLOC_FUNCS(
"DRAW:ExtractorRunData")
70 if ((iter_type & MR_ITER_LOOPTRI) && *(&extractor->
iter_looptri_bm + is_mesh)) {
74 if ((iter_type & MR_ITER_POLY) && *(&extractor->
iter_poly_bm + is_mesh)) {
78 if ((iter_type & MR_ITER_LEDGE) && *(&extractor->
iter_ledge_bm + is_mesh)) {
82 if ((iter_type & MR_ITER_LVERT) && *(&extractor->
iter_lvert_bm + is_mesh)) {
101 eMRIterType iter_type =
static_cast<eMRIterType
>(0);
113 uint bits =
static_cast<uint>(iter_type);
129 size_t data_size = 0;
137 #ifdef WITH_CXX_GUARDEDALLOC
138 MEM_CXX_CLASS_ALLOC_FUNCS(
"DRAW:ExtractorRunDatas")
178 #ifdef WITH_CXX_GUARDEDALLOC
179 MEM_CXX_CLASS_ALLOC_FUNCS(
"DRW:ExtractTaskData")
205 run_data.data_offset = data_offset;
220 mr, cache, run_data.buffer,
POINTER_OFFSET(data_stack, run_data.data_offset));
237 #ifdef WITH_CXX_GUARDEDALLOC
238 MEM_CXX_CLASS_ALLOC_FUNCS(
"DRW:MeshRenderDataUpdateTaskData")
243 void *__restrict chunk_to,
244 void *__restrict chunk_from)
261 void *extract_data = tls->userdata_chunk;
274 void *extract_data = tls->userdata_chunk;
289 void *extract_data = tls->userdata_chunk;
304 void *extract_data = tls->userdata_chunk;
319 void *extract_data = tls->userdata_chunk;
323 const int ledge_index =
data->loose_elems[iter];
335 void *extract_data = tls->userdata_chunk;
339 const int ledge_index =
data->loose_elems[iter];
351 void *extract_data = tls->userdata_chunk;
355 const int lvert_index =
data->loose_elems[iter];
367 void *extract_data = tls->userdata_chunk;
371 const int lvert_index =
data->loose_elems[iter];
381 const eMRIterType iter_type,
391 case MR_ITER_LOOPTRI:
425 const eMRIterType iter_type =
data->iter_type;
428 size_t userdata_chunk_size =
data->extractors->data_size_total();
429 void *userdata_chunk =
MEM_callocN(userdata_chunk_size, __func__);
441 if (iter_type & MR_ITER_LOOPTRI) {
444 if (iter_type & MR_ITER_POLY) {
447 if (iter_type & MR_ITER_LEDGE) {
450 if (iter_type & MR_ITER_LVERT) {
469 const bool use_threading)
505 #ifdef WITH_CXX_GUARDEDALLOC
506 MEM_CXX_CLASS_ALLOC_FUNCS(
"DRW:MeshRenderDataUpdateTaskData")
522 const eMRIterType iter_type = update_task_data->
iter_type;
534 const eMRIterType iter_type,
538 mr, cache, iter_type, data_flag);
560 const bool is_editmode,
561 const bool is_paint_mode,
562 const bool is_mode_active,
563 const float obmat[4][4],
565 const bool do_uvedit,
609 #define EXTRACT_ADD_REQUESTED(type, name) \
611 if (DRW_##type##_requested(mbuflist->type.name)) { \
612 const MeshExtract *extractor = mesh_extract_override_get( \
613 &extract_##name, do_hq_normals, override_single_mat); \
614 extractors.append(extractor); \
647 if (mbuflist->
ibo.
lines ==
nullptr) {
653 extractors.
append(extractor);
664 extractors.
append(extractor);
675 #undef EXTRACT_ADD_REQUESTED
686 object, me, is_editmode, is_paint_mode, is_mode_active, obmat, do_final, do_uvedit, ts);
695 eMRIterType iter_type = extractors.
iter_types();
699 task_graph, mr, mbc, iter_type, data_flag);
710 single_threaded_extractors->
append(extractor);
712 task_graph, mr, cache, single_threaded_extractors, mbuflist,
false);
720 extractors.filter_threaded_extractors_into(*multi_threaded_extractors);
721 if (!multi_threaded_extractors->
is_empty()) {
723 task_graph, mr, cache, multi_threaded_extractors, mbuflist,
true);
729 delete multi_threaded_extractors;
736 task_graph, mr, cache, extractors_copy, mbuflist,
false);
748 static double avg = 0;
749 static double avg_fps = 0;
750 static double avg_rdata = 0;
751 static double end_prev = 0;
757 avg = avg * 0.95 + (end - rdata_end) * 0.05;
758 avg_fps = avg_fps * 0.95 + (end - end_prev) * 0.05;
759 avg_rdata = avg_rdata * 0.95 + (rdata_end - rdata_start) * 0.05;
762 "rdata %.0fms iter %.0fms (frame %.0fms)\n", avg_rdata * 1000, avg * 1000, avg_fps * 1000);
784 #define EXTRACT_ADD_REQUESTED(type, name) \
786 if (DRW_##type##_requested(mbuflist->type.name)) { \
787 const MeshExtract *extractor = &extract_##name; \
788 extractors.append(extractor); \
814 if (mbuflist->
ibo.
lines ==
nullptr) {
820 extractors.
append(extractor);
831 extractors.
append(extractor);
853 #undef EXTRACT_ADD_REQUESTED
879 const int poly_origindex = subdiv_loop_poly_index[i * 4];
888 const int poly_origindex = subdiv_loop_poly_index[i * 4];
MINLINE int count_bits_i(unsigned int n)
void(* TaskGraphNodeFreeFunction)(void *task_data)
void BLI_task_graph_edge_create(struct TaskNode *from_node, struct TaskNode *to_node)
bool BLI_task_graph_node_push_work(struct TaskNode *task_node)
void BLI_task_parallel_range(int start, int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings)
void(* TaskParallelRangeFunc)(void *__restrict userdata, int iter, const TaskParallelTLS *__restrict tls)
struct TaskNode * BLI_task_graph_node_create(struct TaskGraph *task_graph, TaskGraphNodeRunFunction run, void *user_data, TaskGraphNodeFreeFunction free_func)
BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings)
void BLI_task_graph_work_and_wait(struct TaskGraph *task_graph)
#define POINTER_OFFSET(v, ofs)
bool GPU_use_hq_normals_workaround(void)
Read Guarded memory(de)allocation.
Utility defines for timing/benchmarks.
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
BLI_INLINE BMFace * BM_face_at_index(BMesh *bm, const int index)
void append(const T &value)
ExtractorRunData * data()
SyclQueue void void * src
void DRW_subdivide_loose_geom(DRWSubdivCache *subdiv_cache, MeshBufferCache *cache)
BLI_INLINE bool DRW_vbo_requested(GPUVertBuf *vbo)
BLI_INLINE void DRW_ibo_request(GPUBatch *batch, GPUIndexBuf **ibo)
BLI_INLINE bool DRW_ibo_requested(GPUIndexBuf *ibo)
ccl_global float * buffer
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
INLINE Rall1d< T, V, S > tan(const Rall1d< T, V, S > &arg)
void mesh_buffer_cache_create_requested(TaskGraph *task_graph, MeshBatchCache *cache, MeshBufferCache *mbc, Object *object, Mesh *me, bool is_editmode, bool is_paint_mode, bool is_mode_active, const float obmat[4][4], bool do_final, bool do_uvedit, const Scene *scene, const ToolSettings *ts, bool use_hide)
static void extract_range_iter_looptri_mesh(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
static void extract_range_iter_looptri_bm(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
static void extract_task_data_free(void *data)
BLI_INLINE void extract_init(const MeshRenderData *mr, MeshBatchCache *cache, ExtractorRunDatas &extractors, MeshBufferList *mbuflist, void *data_stack)
static struct TaskNode * extract_task_node_create(struct TaskGraph *task_graph, const MeshRenderData *mr, MeshBatchCache *cache, ExtractorRunDatas *extractors, MeshBufferList *mbuflist, const bool use_threading)
static void extract_range_iter_ledge_bm(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
static void extract_task_reduce(const void *__restrict userdata, void *__restrict chunk_to, void *__restrict chunk_from)
BLI_INLINE void extract_finish(const MeshRenderData *mr, MeshBatchCache *cache, const ExtractorRunDatas &extractors, void *data_stack)
static void extract_task_range_run(void *__restrict taskdata)
BLI_INLINE void extract_task_range_run_iter(const MeshRenderData *mr, ExtractorRunDatas *extractors, const eMRIterType iter_type, bool is_mesh, TaskParallelSettings *settings)
static struct TaskNode * mesh_extract_render_data_node_create(struct TaskGraph *task_graph, MeshRenderData *mr, MeshBufferCache *cache, const eMRIterType iter_type, const eMRDataType data_flag)
static void extract_range_iter_ledge_mesh(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
static void mesh_extract_render_data_node_exec(void *__restrict task_data)
static void extract_range_iter_poly_mesh(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
static void mesh_render_data_update_task_data_free(void *data)
static void extract_range_iter_lvert_bm(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache, MeshBufferCache *mbc, DRWSubdivCache *subdiv_cache, MeshRenderData *mr)
static void extract_range_iter_lvert_mesh(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
static void extract_range_iter_poly_bm(void *__restrict userdata, const int iter, const TaskParallelTLS *__restrict tls)
struct BMLoop *(* looptris)[3]
int * subdiv_loop_poly_index
GPUIndexBuf * lines_loose
struct MeshBufferList::@272 vbo
struct MeshBufferList::@273 ibo
eMRExtractType extract_type
uint32_t * subsurf_face_dot_tags
TaskParallelReduceFunc func_reduce
size_t userdata_chunk_size
MeshRenderDataUpdateTaskData(MeshRenderData *mr, MeshBufferCache *cache, eMRIterType iter_type, eMRDataType data_flag)
~MeshRenderDataUpdateTaskData()
double PIL_check_seconds_timer(void)