diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-07-14 17:49:44 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-08-14 20:05:26 +0300 |
commit | 9c010c44f4201ab114b3facc69d0343525a1779f (patch) | |
tree | 744271becd24cead6c900e4f023d8c0bfa6138b6 /source/blender/editors | |
parent | 45a45f7d66211e82a3a3288782ad9523e8fdc516 (diff) |
Mesh Batch Cache: Refactor + Multithread
For clarity sake, the batch cache now uses exclusively per Loop attributes.
While this is a bit of a waste of VRAM (for the few case where per vert
attribs are enough) it reduces the complexity and amount of overall VBO
to update in general situations.
This patch also makes the VertexBuffers filling multithreaded. This make
the update of dense meshes a bit faster. The main bottleneck is the
IndexBuffers update which cannot be multithreaded efficiently (have to
increment a counter and/or do a final sorting pass).
We introduce the concept of "extract" functions/step.
All extract functions are executed in one thread each and if possible,
using multiple thread for looping over all elements.
Reviewed By: brecht
Differential Revision: http://developer.blender.org/D5424
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index ed8178d1908..d97714061c0 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -163,13 +163,13 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) static void uvedit_get_batches(Object *ob, SpaceImage *sima, - const ToolSettings *ts, + const Scene *scene, GPUBatch **faces, GPUBatch **edges, GPUBatch **verts, GPUBatch **facedots) { - int drawfaces = draw_uvs_face_check(ts); + int drawfaces = draw_uvs_face_check(scene->toolsettings); const bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0; const bool draw_faces = (sima->flag & SI_NO_DRAWFACES) == 0; @@ -197,7 +197,7 @@ static void uvedit_get_batches(Object *ob, *faces = NULL; } - DRW_mesh_batch_cache_create_requested(ob, ob->data, ts, false, false); + DRW_mesh_batch_cache_create_requested(ob, ob->data, scene, false, false); } static void draw_uvs_shadow(SpaceImage *UNUSED(sima), @@ -212,7 +212,7 @@ static void draw_uvs_shadow(SpaceImage *UNUSED(sima), DRW_mesh_batch_cache_validate(me); GPUBatch *edges = DRW_mesh_batch_cache_get_uv_edges(me); - DRW_mesh_batch_cache_create_requested(eval_ob, me, scene->toolsettings, false, false); + DRW_mesh_batch_cache_create_requested(eval_ob, me, scene, false, false); if (edges) { GPU_batch_program_set_builtin(edges, GPU_SHADER_2D_UV_UNIFORM_COLOR); @@ -235,7 +235,7 @@ static void draw_uvs_texpaint(Scene *scene, Object *ob, Depsgraph *depsgraph) DRW_mesh_batch_cache_validate(me); GPUBatch *geom = DRW_mesh_batch_cache_get_uv_edges(me); - DRW_mesh_batch_cache_create_requested(eval_ob, me, scene->toolsettings, false, false); + DRW_mesh_batch_cache_create_requested(eval_ob, me, scene, false, false); GPU_batch_program_set_builtin(geom, GPU_SHADER_2D_UV_UNIFORM_COLOR); GPU_batch_uniform_4fv(geom, "color", col); @@ -300,7 +300,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, Object *obedit, Depsgraph * } } - uvedit_get_batches(eval_ob, sima, ts, &faces, &edges, &verts, &facedots); + uvedit_get_batches(eval_ob, sima, scene, &faces, &edges, &verts, &facedots); bool interpedges; bool draw_stretch = (sima->flag & SI_DRAW_STRETCH) != 0; |