GP: Refactor drawing engine to single VBO
authorAntonioya <blendergit@gmail.com>
Tue, 20 Nov 2018 18:26:16 +0000 (19:26 +0100)
committerAntonioya <blendergit@gmail.com>
Tue, 20 Nov 2018 19:05:37 +0000 (20:05 +0100)
commite63c9472049f64221b34c4d2dd3101086b61520e
treee75fc34d3a450f88d8805833c04e98fd4442f616
parent140d383393764f28405b34775b2e0dc22c51e5a6
GP: Refactor drawing engine to single VBO

This is part of T57829.

Reduce the number of batches used to only one by shader type.  This reduces GPU overhead and increase a lot the FPS. As the number of batches is small, the time to allocate and free memory was reduced in 90% or more.

Also the code has been simplified and all batch management has been removed because this is not necessary. Now, all shading groups are created after all vertex buffer data for all strokes has been created using DRW_shgroup_call_range_add().

All batch cache data has been moved to the Object runtime struct and not as before where some parts (derived data) were saved inside GPD datablock.

For particles, now the code is faster and cleaner and gets better FPS.

Thanks to ClĂ©ment Foucault for his help and advices to improve speed.
28 files changed:
source/blender/blenkernel/BKE_gpencil.h
source/blender/blenkernel/BKE_gpencil_modifier.h
source/blender/blenkernel/intern/gpencil.c
source/blender/blenloader/intern/readfile.c
source/blender/draw/engines/gpencil/gpencil_cache_utils.c
source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
source/blender/draw/engines/gpencil/gpencil_draw_utils.c
source/blender/draw/engines/gpencil/gpencil_engine.c
source/blender/draw/engines/gpencil/gpencil_engine.h
source/blender/editors/gpencil/gpencil_data.c
source/blender/editors/gpencil/gpencil_utils.c
source/blender/gpencil_modifiers/intern/MOD_gpencilarmature.c
source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
source/blender/gpencil_modifiers/intern/MOD_gpencilcolor.c
source/blender/gpencil_modifiers/intern/MOD_gpencilhook.c
source/blender/gpencil_modifiers/intern/MOD_gpencillattice.c
source/blender/gpencil_modifiers/intern/MOD_gpencilmirror.c
source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
source/blender/gpencil_modifiers/intern/MOD_gpencilsimplify.c
source/blender/gpencil_modifiers/intern/MOD_gpencilsmooth.c
source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
source/blender/gpencil_modifiers/intern/MOD_gpenciltime.c
source/blender/gpencil_modifiers/intern/MOD_gpenciltint.c
source/blender/makesdna/DNA_gpencil_types.h