Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2022-06-14 19:58:38 +0300
committerJoseph Eagar <joeedh@gmail.com>2022-06-14 20:02:30 +0300
commit7a24fe372c2148bf28e3768d42c14192ed46c5d6 (patch)
tree8e2d2aa196f71bf6f19bb3bc72ac3c04d8e297d3
parentf5e7221fbdc3277528b0cd8da4e9b3e0197e334f (diff)
Fix T98879: PBVH active attrs only optimization is buggy
PBVH draw has an optimization where it only sends the active attribute to the GPU in workbench mode. This fails if multiple viewports are open with a mix of workbench and EEVEE mode; it also causes severe lag if any workbench viewport is in material mode. There are two solutions: either add the code in sculpt-dev that checks for EEVEE viewports at the beginning of each frame, or integrate pbvh draw properly inside the draw manager and let it handle which attributes should go to the GPU.
-rw-r--r--source/blender/blenkernel/intern/pbvh.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 3a69a33105e..fabc74464ab 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -1419,8 +1419,14 @@ static void pbvh_check_draw_layout(PBVH *pbvh, bool full_render)
break;
}
- /* rebuild all draw buffers if attribute layout changed */
- if (GPU_pbvh_attribute_names_update(pbvh->type, pbvh->vbo_id, vdata, ldata, !full_render)) {
+ /* Rebuild all draw buffers if attribute layout changed.
+ *
+ * NOTE: The optimization where we only send active attributes
+ * to the GPU in workbench mode is disabled due to bugs
+ * (there's no guarantee there isn't another EEVEE viewport which would
+ * free the draw buffers and corrupt the draw cache).
+ */
+ if (GPU_pbvh_attribute_names_update(pbvh->type, pbvh->vbo_id, vdata, ldata, false)) {
/* attribute layout changed; force rebuild */
for (int i = 0; i < pbvh->totnode; i++) {
PBVHNode *node = pbvh->nodes + i;