[Bf-blender-cvs] [512a077166f] greasepencil-refactor: GPencil: Refactor: Fix assert caused by framebuffer usage optimisation

Clément Foucault noreply at git.blender.org
Fri Jan 17 13:56:26 CET 2020


Commit: 512a077166f0497e3a453657fd190a394809e3e7
Author: Clément Foucault
Date:   Fri Jan 17 13:56:17 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB512a077166f0497e3a453657fd190a394809e3e7

GPencil: Refactor: Fix assert caused by framebuffer usage optimisation

===================================================================

M	source/blender/draw/engines/gpencil/gpencil_engine.c
M	source/blender/draw/engines/gpencil/gpencil_engine.h

===================================================================

diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c
index 4860ad4152d..8fbe0a61750 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -168,7 +168,9 @@ void GPENCIL_cache_init(void *ved)
 
   const DRWContextState *draw_ctx = DRW_context_state_get();
   pd->cfra = (int)DEG_get_ctime(draw_ctx->depsgraph);
-  pd->use_layer_fb = false;
+  pd->simplify_antialias = GPENCIL_SIMPLIFY_AA(draw_ctx->scene);
+  /* Antialiasing needs the layer buffer to output to. */
+  pd->use_layer_fb = false || !pd->simplify_antialias;
   pd->use_object_fb = false;
   pd->use_mask_fb = false;
   pd->use_signed_fb = false;
@@ -682,7 +684,7 @@ void GPENCIL_cache_finish(void *ved)
                                     });
     }
 
-    if (!GPENCIL_SIMPLIFY_AA(draw_ctx->scene)) {
+    if (!pd->simplify_antialias) {
       GPENCIL_antialiasing_init(vedata);
     }
   }
@@ -822,7 +824,6 @@ void GPENCIL_draw_scene(void *ved)
   GPENCIL_PassList *psl = vedata->psl;
   GPENCIL_PrivateData *pd = vedata->stl->pd;
   GPENCIL_FramebufferList *fbl = vedata->fbl;
-  const DRWContextState *draw_ctx = DRW_context_state_get();
   float clear_cols[2][4] = {{0.0f, 0.0f, 0.0f, 0.0f}, {1.0f, 1.0f, 1.0f, 1.0f}};
 
   if (pd->draw_depth_only) {
@@ -851,7 +852,7 @@ void GPENCIL_draw_scene(void *ved)
     GPENCIL_fast_draw_end(vedata);
   }
 
-  if (!GPENCIL_SIMPLIFY_AA(draw_ctx->scene)) {
+  if (!pd->simplify_antialias) {
     GPENCIL_antialiasing_draw(vedata);
   }
 
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index daef1cbdffe..71b91e042d2 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -313,6 +313,7 @@ typedef struct GPENCIL_PrivateData {
   /* simplify settings */
   bool simplify_fill;
   bool simplify_fx;
+  bool simplify_antialias;
   /* Use scene lighting or flat shading (global setting). */
   bool use_lighting;
   /* Use physical lights or just ambient lighting. */



More information about the Bf-blender-cvs mailing list