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.
This commit is contained in:
parent
f5e7221fbd
commit
7a24fe372c
Notes:
blender-bot
2023-02-14 02:30:10 +01:00
Referenced by issue #102299, Mesh disappearing in sculpt mode if certain modifiers are disabled. Referenced by issue #99282, Regression: Object invisible in Sculpt Mode when using >8 color attributes Referenced by issue #98879, Regression: Major performance regression in sculpt mode using the material color shading
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue