Blender Git Commit Log
Git Commits -> Revision 259b9c7
Revision 259b9c7 by Jeroen Bakker (master) June 8, 2021, 14:36 (GMT) |
GPU: Thread safe index buffer builders. Current index builder is designed to be used in a single thread. This makes all index buffer extractions single threaded. This patch adds a thread safe solution enabling multithreaded building of index buffers. To reduce locking the solution would provide a task/thread local index buffer builder (called sub builder). When a thread is finished this thread local index buffer builder can be joined with the initial index buffer builder. `GPU_indexbuf_subbuilder_init`: Initialized a sub builder. The index list is shared between the parent and sub buffer, but the counters are localized. Ensuring that updating counters would not need any locking. `GPU_indexbuf_subbuilder_finish`: merge the information of the sub builder back to the parent builder. Needs to be invoked outside the worker thread, or when sure that all worker threads have been finished. Internal the function is not thread safe. For testing purposes the extract_points extractor has been migrated to the new API. Herefore changes to the mesh extractor were needed. * When creating tasks, the task number of current task is stored in ExtractTaskData including the total number of tasks. * Adding two functions in `MeshExtract`. ** `task_init` will initialize the task specific userdata. ** `task_finish` should merge back the task specific userdata back. * adding task_id parameter to the iteration functions so they can access the correct task data without any need for locking. There is no noticeable change in end user performance. Reviewed By: mano-wii Differential Revision: https://developer.blender.org/D11499 |
Commit Details:
Full Hash: 259b9c73d067bb51a6e86ff8eadd3de30c74e5ac
Parent Commit: 08b0de4
Lines Changed: +241, -57
1 Added Path:
/source/blender/gpu/tests/gpu_index_buffer_test.cc (+47, -0) (View)
6 Modified Paths:
/source/blender/draw/intern/draw_cache_extract_mesh.cc (+134, -55) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_private.h (+5, -1) (Diff)
/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc (+20, -1) (Diff)
/source/blender/gpu/CMakeLists.txt (+2, -0) (Diff)
/source/blender/gpu/GPU_index_buffer.h (+14, -0) (Diff)
/source/blender/gpu/intern/gpu_index_buffer.cc (+19, -0) (Diff)
/source/blender/draw/intern/draw_cache_extract_mesh_private.h (+5, -1) (Diff)
/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc (+20, -1) (Diff)
/source/blender/gpu/CMakeLists.txt (+2, -0) (Diff)
/source/blender/gpu/GPU_index_buffer.h (+14, -0) (Diff)
/source/blender/gpu/intern/gpu_index_buffer.cc (+19, -0) (Diff)