This part of the design will go over the changes for improving the draw manager threading. The design is based on D7578: Task: Graph Flow Task Scheduling.
In order to create the MeshRenderData in a task we need to split mesh_render_data_create in two phases. First phase will not happen in the callers thread and is responsible to create the MeshRenderData instance and fill it with the statistics of the mesh. These statistics are used to define how the scheduling would take place.
The second phase would do the heavier lifting and would happen in a separate TaskNode (task_node_mesh_render_data).
There will be several additional task_nodes.
- a task_node that handles all Single threaded extraction in a single task. we can tweak afterwards if we need to split this into multiple tasks.
- a task_node that handles a single task. One task for the whole VBO.
- a task_node for range tasks MR_ITER_LOOPTRI, MR_ITER_LOOP, MR_ITER_LEDGE, MR_ITER_LVERT.
The extract_lines_loose should be removed and we based on the existance of ibo.lines we should do it in the finalize of the extract_lines or as part of the Single threaded extraction when the lines were already up to date. As we only need to call extract_lines_loose_finish directly.
The TaskGraph will be instantiated in the draw_manager.c Main Draw Loops And stored in the DrawContext. We need to do this to keep the hacky-optimization that generates the batches during the free-ing of the ghash in drw_duplidata_free.