diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-27 23:42:57 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-09-29 16:28:15 +0300 |
commit | f6fc863acd7c24874026202d4c2aec50c60b40d2 (patch) | |
tree | 541dab504b4a4132869d4ba982c42aeca049f661 /source/blender/gpu/GPU_buffers.h | |
parent | c931a0057ffea26175a2dc111718e5f3590b00f8 (diff) |
Sculpt: multithread GPU draw buffer filling for workbench
This improves performance of some sculpt tools, particularly those that modify
many vertices like filter and mask tools, or use brushes with large radius.
For mask expand it can make updates up to 2x faster on heavy meshes, but for
most tools it's more on the order of 1-1.1x. There are bigger bottlenecks to
solve, like normal updates.
Ref T70295
Differential Revision: https://developer.blender.org/D5926
Diffstat (limited to 'source/blender/gpu/GPU_buffers.h')
-rw-r--r-- | source/blender/gpu/GPU_buffers.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 9009c134837..552bad2b0d6 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -41,7 +41,8 @@ struct PBVH; /* Buffers for drawing from PBVH grids. */ typedef struct GPU_PBVH_Buffers GPU_PBVH_Buffers; -/* build */ +/* Build must be called once before using the other functions, used every time + * mesh topology changes. Threaded. */ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const int (*face_vert_indices)[3], const struct MPoly *mpoly, const struct MLoop *mloop, @@ -54,8 +55,13 @@ GPU_PBVH_Buffers *GPU_pbvh_grid_buffers_build(int totgrid, unsigned int **grid_h GPU_PBVH_Buffers *GPU_pbvh_bmesh_buffers_build(bool smooth_shading); -/* update */ +/* Free part of data for update. Not thread safe, must run in OpenGL main thread. */ +void GPU_pbvh_bmesh_buffers_update_free(GPU_PBVH_Buffers *buffers); +void GPU_pbvh_grid_buffers_update_free(GPU_PBVH_Buffers *buffers, + const struct DMFlagMat *grid_flag_mats, + int *grid_indices); +/* Update mesh buffers without topology changes. Threaded. */ enum { GPU_PBVH_BUFFERS_SHOW_MASK = (1 << 1), GPU_PBVH_BUFFERS_SHOW_VCOL = (1 << 1), @@ -85,6 +91,12 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers, const struct CCGKey *key, const int update_flags); +/* Finish update. Not thread safe, must run in OpenGL main thread. */ +void GPU_pbvh_buffers_update_flush(GPU_PBVH_Buffers *buffers); + +/* Free buffers. Not thread safe, must run in OpenGL main thread. */ +void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers); + /* draw */ struct GPUBatch *GPU_pbvh_buffers_batch_get(GPU_PBVH_Buffers *buffers, bool fast, bool wires); @@ -92,8 +104,4 @@ short GPU_pbvh_buffers_material_index_get(GPU_PBVH_Buffers *buffers); bool GPU_pbvh_buffers_has_mask(GPU_PBVH_Buffers *buffers); -void GPU_pbvh_buffers_free(GPU_PBVH_Buffers *buffers); - -void GPU_pbvh_fix_linking(void); - #endif |