From 7d38f5036794e7bf2678c8138b940257b152435b Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 14 May 2020 11:56:16 +0200 Subject: Fix T75908: Sculpt GPU Batches + Render Artifacts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When sculpting the GPU batches are constructed with only the required data for a single viewport. When that viewport changes shading or coloring mode (object to vertex) batches might not hold all the needed information. There is also a case when you have two 3d viewport one in object color mode and the other in vertex color mode that the GPU batches were updated without any vertex colors. In order to fix these category of issues this patch would always construct the full GPU batches for sculpting. Reviewed By: Clément Foucault, Pablo Dobarro Maniphest Tasks: T75908 Differential Revision: https://developer.blender.org/D7701 --- source/blender/draw/intern/DRW_render.h | 7 ++----- source/blender/draw/intern/draw_manager_data.c | 13 +++++-------- 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'source/blender/draw/intern') diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 663567fd51e..c4d9396307a 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -410,11 +410,8 @@ void DRW_shgroup_call_instances_with_attrs(DRWShadingGroup *shgroup, struct GPUBatch *geom, struct GPUBatch *inst_attributes); -void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask, bool vcol); -void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, - int num_sh, - Object *ob, - bool vcol); +void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask); +void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, int num_sh, Object *ob); DRWCallBuffer *DRW_shgroup_call_buffer(DRWShadingGroup *shading_group, struct GPUVertFormat *format, diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 1d0fe957631..95b204ac004 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -954,7 +954,7 @@ static void drw_sculpt_get_frustum_planes(Object *ob, float planes[6][4]) } } -static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd, bool use_vcol) +static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd) { /* PBVH should always exist for non-empty meshes, created by depsgrah eval. */ PBVH *pbvh = (scd->ob->sculpt) ? scd->ob->sculpt->pbvh : NULL; @@ -1015,7 +1015,6 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd, bool use_vcol) BKE_pbvh_update_normals(pbvh, mesh->runtime.subdiv_ccg); BKE_pbvh_draw_cb(pbvh, - use_vcol, update_only_visible, &update_frustum, &draw_frustum, @@ -1033,8 +1032,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd, bool use_vcol) } } -void DRW_shgroup_call_sculpt( - DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask, bool use_vcol) +void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask) { DRWSculptCallbackData scd = { .ob = ob, @@ -1044,13 +1042,12 @@ void DRW_shgroup_call_sculpt( .use_mats = false, .use_mask = use_mask, }; - drw_sculpt_generate_calls(&scd, use_vcol); + drw_sculpt_generate_calls(&scd); } void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups, int num_shgroups, - Object *ob, - bool use_vcol) + Object *ob) { DRWSculptCallbackData scd = { .ob = ob, @@ -1060,7 +1057,7 @@ void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups, .use_mats = true, .use_mask = false, }; - drw_sculpt_generate_calls(&scd, use_vcol); + drw_sculpt_generate_calls(&scd); } static GPUVertFormat inst_select_format = {0}; -- cgit v1.2.3