Commit: 2f9b8c7bc6e99cacda4fdc9c78346a52d916d577
Author: Antonio Vazquez
Date:   Wed Jun 20 11:05:18 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2f9b8c7bc6e99cacda4fdc9c78346a52d916d577

Fix multisample textures were using default not local copies

The multisamples used were not the custom textures for GP.

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

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 a7a31d0b21c..591b6999206 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.c
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.c
@@ -76,7 +76,7 @@ void DRW_gpencil_multisample_ensure(GPENCIL_Data *vedata, int 
rect_w, int rect_h
 {
        GPENCIL_FramebufferList *fbl = vedata->fbl;
        GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
-       DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+       GPENCIL_TextureList *txl = ((GPENCIL_Data *)vedata)->txl;
 
        short samples = stl->storage->multisamples;
 
@@ -84,15 +84,15 @@ void DRW_gpencil_multisample_ensure(GPENCIL_Data *vedata, 
int rect_w, int rect_h
                if (!fbl->multisample_fb) {
                        fbl->multisample_fb = GPU_framebuffer_create();
                        if (fbl->multisample_fb) {
-                               if (dtxl->multisample_color == NULL) {
-                                       dtxl->multisample_color = 
GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_RGBA8, NULL, samples, 
NULL);
+                               if (txl->multisample_color == NULL) {
+                                       txl->multisample_color = 
GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_RGBA8, NULL, samples, 
NULL);
                                }
-                               if (dtxl->multisample_depth == NULL) {
-                                       dtxl->multisample_depth = 
GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_DEPTH24_STENCIL8, NULL, 
samples, NULL);
+                               if (txl->multisample_depth == NULL) {
+                                       txl->multisample_depth = 
GPU_texture_create_2D_multisample(rect_w, rect_h, GPU_DEPTH24_STENCIL8, NULL, 
samples, NULL);
                                }
                                
GPU_framebuffer_ensure_config(&fbl->multisample_fb, {
-                                       
GPU_ATTACHMENT_TEXTURE(dtxl->multisample_depth),
-                                       
GPU_ATTACHMENT_TEXTURE(dtxl->multisample_color)
+                                       
GPU_ATTACHMENT_TEXTURE(txl->multisample_depth),
+                                       
GPU_ATTACHMENT_TEXTURE(txl->multisample_color)
                                        });
                                if 
(!GPU_framebuffer_check_valid(fbl->multisample_fb, NULL)) {
                                        
GPU_framebuffer_free(fbl->multisample_fb);
@@ -560,7 +560,7 @@ void GPENCIL_draw_scene(void *ved)
        GPENCIL_PassList *psl = ((GPENCIL_Data *)vedata)->psl;
        GPENCIL_FramebufferList *fbl = ((GPENCIL_Data *)vedata)->fbl;
        DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
-       DefaultTextureList *dtxl = DRW_viewport_texture_list_get();
+       GPENCIL_TextureList *txl = ((GPENCIL_Data *)vedata)->txl;
 
        int init_grp, end_grp;
        tGPencilObjectCache *cache;
@@ -579,7 +579,6 @@ void GPENCIL_draw_scene(void *ved)
                }
        }
 
-
        /* if we have a painting session, we use fast viewport drawing method */
        if ((!is_render) && (stl->g_data->session_flag & 
GP_DRW_PAINT_PAINTING)) {
                GPU_framebuffer_bind(dfbl->default_fb);
@@ -589,7 +588,7 @@ void GPENCIL_draw_scene(void *ved)
                DRW_draw_pass(psl->background_pass);
                DRW_draw_pass(psl->drawing_pass);
 
-               MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, 
dfbl->default_fb, dtxl);
+               MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, 
dfbl->default_fb, txl);
 
                /* free memory */
                gpencil_free_obj_list(stl);
@@ -632,7 +631,7 @@ void GPENCIL_draw_scene(void *ved)
                                                
stl->shgroups[init_grp].shgrps_fill != NULL ? 
stl->shgroups[init_grp].shgrps_fill : stl->shgroups[init_grp].shgrps_stroke,
                                                
stl->shgroups[end_grp].shgrps_stroke);
 
-                                       
MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fbl->temp_fb_a, 
dtxl);
+                                       
MULTISAMPLE_GP_SYNC_DISABLE(stl->storage->multisamples, fbl, fbl->temp_fb_a, 
txl);
                                }
                                /* Current buffer drawing */
                                if ((!is_render) && (gpd->sbuffer_size > 0)) {
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h 
b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 1ba82db5d65..5d033a824a6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -292,11 +292,11 @@ void GPENCIL_render_to_image(void *vedata, struct 
RenderEngine *engine, struct R
        } \
 }
 
-#define MULTISAMPLE_GP_SYNC_DISABLE(lvl, fbl, fb, dtxl) { \
+#define MULTISAMPLE_GP_SYNC_DISABLE(lvl, fbl, fb, txl) { \
        if ((lvl > 0) && (fbl->multisample_fb != NULL)) { \
                DRW_stats_query_start("GP Multisample Resolve"); \
                GPU_framebuffer_bind(fb); \
-               DRW_multisamples_resolve(dtxl->multisample_depth, 
dtxl->multisample_color); \
+               DRW_multisamples_resolve(txl->multisample_depth, 
txl->multisample_color); \
                DRW_stats_query_end(); \
        } \
 }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to