Fix 3D viewport select using grease pencil engine when not needed

Other draw loops also avoid the overhead of grease pencil drawing when there
are no grease pencil objects in the scene. It's a little faster to skip those
shaders and buffer when not needed.
This commit is contained in:
Brecht Van Lommel 2020-04-21 20:53:21 +02:00
parent aba78caa11
commit b2cc2dda9c
1 changed files with 6 additions and 2 deletions

View File

@ -2054,7 +2054,9 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
}
else if (!draw_surface) {
/* grease pencil selection */
use_drw_engine(&draw_engine_gpencil_type);
if (drw_gpencil_engine_needed(depsgraph, v3d)) {
use_drw_engine(&draw_engine_gpencil_type);
}
drw_engines_enable_overlays();
}
@ -2062,7 +2064,9 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph,
/* Draw surface for occlusion. */
drw_engines_enable_basic();
/* grease pencil selection */
use_drw_engine(&draw_engine_gpencil_type);
if (drw_gpencil_engine_needed(depsgraph, v3d)) {
use_drw_engine(&draw_engine_gpencil_type);
}
drw_engines_enable_overlays();
}