Commit: 31fb6c1d8f1a1b4e376b753072da0d535ef4010b Author: Antonioya Date: Sat Jun 22 16:56:25 2019 +0200 Branches: greasepencil-object https://developer.blender.org/rB31fb6c1d8f1a1b4e376b753072da0d535ef4010b
Merge branch 'master' into gp_stencil Conflicts: source/blender/draw/engines/gpencil/gpencil_draw_utils.c source/blender/draw/engines/gpencil/gpencil_engine.c =================================================================== =================================================================== diff --cc source/blender/draw/engines/gpencil/gpencil_draw_utils.c index eca6b0bfb23,1b8684c66df..450c978ccf0 --- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c @@@ -1552,24 -1537,14 +1552,17 @@@ void DRW_gpencil_populate_buffer_stroke false, 1.0f, (const int *)stl->storage->shade_render); + /* Disable stencil for this type */ + DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_stroke, + DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_NEQUAL); } - /* clean previous version of the batch */ - if (stl->storage->buffer_stroke) { - GPU_BATCH_DISCARD_SAFE(e_data->batch_buffer_stroke); - MEM_SAFE_FREE(e_data->batch_buffer_stroke); - stl->storage->buffer_stroke = false; - } - /* use unit matrix because the buffer is in screen space and does not need conversion */ if (gpd->runtime.mode == GP_STYLE_MODE_LINE) { - e_data->batch_buffer_stroke = DRW_gpencil_get_buffer_stroke_geom(gpd, lthick); + stl->g_data->batch_buffer_stroke = DRW_gpencil_get_buffer_stroke_geom(gpd, lthick); } else { - e_data->batch_buffer_stroke = DRW_gpencil_get_buffer_point_geom(gpd, lthick); + stl->g_data->batch_buffer_stroke = DRW_gpencil_get_buffer_point_geom(gpd, lthick); } /* buffer strokes, must show stroke always */ @@@ -1586,21 -1562,10 +1580,13 @@@ } stl->g_data->shgrps_drawing_fill = DRW_shgroup_create(e_data->gpencil_drawing_fill_sh, psl->drawing_pass); + /* Disable stencil for this type */ + DRW_shgroup_state_disable(stl->g_data->shgrps_drawing_stroke, + DRW_STATE_WRITE_STENCIL | DRW_STATE_STENCIL_NEQUAL); - /* clean previous version of the batch */ - if (stl->storage->buffer_fill) { - GPU_BATCH_DISCARD_SAFE(e_data->batch_buffer_fill); - MEM_SAFE_FREE(e_data->batch_buffer_fill); - stl->storage->buffer_fill = false; - } - e_data->batch_buffer_fill = DRW_gpencil_get_buffer_fill_geom(gpd); - DRW_shgroup_call(stl->g_data->shgrps_drawing_fill, e_data->batch_buffer_fill, NULL); - stl->storage->buffer_fill = true; + stl->g_data->batch_buffer_fill = DRW_gpencil_get_buffer_fill_geom(gpd); + DRW_shgroup_call(stl->g_data->shgrps_drawing_fill, stl->g_data->batch_buffer_fill, NULL); } - stl->storage->buffer_stroke = true; } } } diff --cc source/blender/draw/engines/gpencil/gpencil_engine.c index 6b53ff83b88,916f2eed575..1117b9d241f --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@@ -118,19 -120,19 +120,19 @@@ static void GPENCIL_create_framebuffers /* Framebufers for basic object drawing */ if (stl->storage->framebuffer_flag & GP_FRAMEBUFFER_BASIC) { /* temp textures for ping-pong buffers */ - e_data.temp_depth_tx_a = DRW_texture_pool_query_2d( + stl->g_data->temp_depth_tx_a = DRW_texture_pool_query_2d( - size[0], size[1], GPU_DEPTH_COMPONENT24, &draw_engine_gpencil_type); + size[0], size[1], GPU_DEPTH24_STENCIL8, &draw_engine_gpencil_type); - e_data.temp_color_tx_a = DRW_texture_pool_query_2d( + stl->g_data->temp_color_tx_a = DRW_texture_pool_query_2d( size[0], size[1], fb_format, &draw_engine_gpencil_type); GPU_framebuffer_ensure_config(&fbl->temp_fb_a, { - GPU_ATTACHMENT_TEXTURE(e_data.temp_depth_tx_a), - GPU_ATTACHMENT_TEXTURE(e_data.temp_color_tx_a), + GPU_ATTACHMENT_TEXTURE(stl->g_data->temp_depth_tx_a), + GPU_ATTACHMENT_TEXTURE(stl->g_data->temp_color_tx_a), }); - e_data.temp_depth_tx_b = DRW_texture_pool_query_2d( + stl->g_data->temp_depth_tx_b = DRW_texture_pool_query_2d( - size[0], size[1], GPU_DEPTH_COMPONENT24, &draw_engine_gpencil_type); + size[0], size[1], GPU_DEPTH24_STENCIL8, &draw_engine_gpencil_type); - e_data.temp_color_tx_b = DRW_texture_pool_query_2d( + stl->g_data->temp_color_tx_b = DRW_texture_pool_query_2d( size[0], size[1], fb_format, &draw_engine_gpencil_type); GPU_framebuffer_ensure_config(&fbl->temp_fb_b, { @@@ -139,9 -141,9 +141,9 @@@ }); /* used for FX effects and Layer blending */ - e_data.temp_depth_tx_fx = DRW_texture_pool_query_2d( + stl->g_data->temp_depth_tx_fx = DRW_texture_pool_query_2d( - size[0], size[1], GPU_DEPTH_COMPONENT24, &draw_engine_gpencil_type); + size[0], size[1], GPU_DEPTH24_STENCIL8, &draw_engine_gpencil_type); - e_data.temp_color_tx_fx = DRW_texture_pool_query_2d( + stl->g_data->temp_color_tx_fx = DRW_texture_pool_query_2d( size[0], size[1], fb_format, &draw_engine_gpencil_type); GPU_framebuffer_ensure_config(&fbl->temp_fb_fx, { @@@ -150,18 -152,25 +152,25 @@@ }); } - /* background framebuffer to speed up drawing process (always 16 bits) */ + /* background framebuffer to speed up drawing process */ if (stl->storage->framebuffer_flag & GP_FRAMEBUFFER_DRAW) { - e_data.background_depth_tx = DRW_texture_pool_query_2d( - size[0], size[1], GPU_DEPTH24_STENCIL8, &draw_engine_gpencil_type); - e_data.background_color_tx = DRW_texture_pool_query_2d( - size[0], size[1], GPU_RGBA32F, &draw_engine_gpencil_type); + if (txl->background_color_tx == NULL) { + stl->storage->background_ready = false; + } + DRW_texture_ensure_2d( - &txl->background_depth_tx, size[0], size[1], GPU_DEPTH_COMPONENT24, DRW_TEX_FILTER); ++ &txl->background_depth_tx, size[0], size[1], GPU_DEPTH24_STENCIL8, DRW_TEX_FILTER); + DRW_texture_ensure_2d( + &txl->background_color_tx, size[0], size[1], GPU_RGBA16F, DRW_TEX_FILTER); GPU_framebuffer_ensure_config(&fbl->background_fb, { - GPU_ATTACHMENT_TEXTURE(e_data.background_depth_tx), - GPU_ATTACHMENT_TEXTURE(e_data.background_color_tx), + GPU_ATTACHMENT_TEXTURE(txl->background_depth_tx), + GPU_ATTACHMENT_TEXTURE(txl->background_color_tx), }); } + else { + DRW_TEXTURE_FREE_SAFE(txl->background_depth_tx); + DRW_TEXTURE_FREE_SAFE(txl->background_color_tx); + } } } @@@ -1047,11 -1006,11 +1074,11 @@@ void GPENCIL_draw_scene(void *ved stl->storage->tonemapping = 0; /* Copy B texture to A texture to follow loop */ - e_data.input_depth_tx = e_data.temp_depth_tx_b; - e_data.input_color_tx = e_data.temp_color_tx_b; + stl->g_data->input_depth_tx = stl->g_data->temp_depth_tx_b; + stl->g_data->input_color_tx = stl->g_data->temp_color_tx_b; GPU_framebuffer_bind(fbl->temp_fb_a); - GPU_framebuffer_clear_color_depth(fbl->temp_fb_a, clearcol, 1.0f); + GPU_framebuffer_clear_color_depth_stencil(fbl->temp_fb_a, clearcol, 1.0f, 0x0); DRW_draw_pass(psl->mix_pass_noblend); /* prepare next group */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs