Merge branch 'blender-v2.83-release'

This commit is contained in:
Clément Foucault 2020-04-27 21:15:11 +02:00
commit fd0cb58122
Notes: blender-bot 2023-02-14 10:37:49 +01:00
Referenced by issue #76182, Bake All Physics operator bake all except Hair Physics
Referenced by issue #74243, Workbench x-ray, wireframe and anti-aliasing artifacts on NVIDIA / Linux
8 changed files with 48 additions and 18 deletions

View File

@ -481,6 +481,12 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_xray_depth_infront_copy(vedata);
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_in_front_fb);
}
OVERLAY_facing_infront_draw(vedata);
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_line_in_front_fb);
}

View File

@ -34,28 +34,41 @@ void OVERLAY_facing_cache_init(OVERLAY_Data *vedata)
OVERLAY_PassList *psl = vedata->psl;
OVERLAY_PrivateData *pd = vedata->stl->pd;
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA;
DRW_PASS_CREATE(psl->facing_ps, state | pd->clipping_state);
for (int i = 0; i < 2; i++) {
/* Non Meshes Pass (Camera, empties, lights ...) */
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA;
DRW_PASS_CREATE(psl->facing_ps[i], state | pd->clipping_state);
GPUShader *sh = OVERLAY_shader_facing();
pd->facing_grp = DRW_shgroup_create(sh, psl->facing_ps);
DRW_shgroup_uniform_block_persistent(pd->facing_grp, "globalsBlock", G_draw.block_ubo);
GPUShader *sh = OVERLAY_shader_facing();
pd->facing_grp[i] = DRW_shgroup_create(sh, psl->facing_ps[i]);
DRW_shgroup_uniform_block_persistent(pd->facing_grp[i], "globalsBlock", G_draw.block_ubo);
}
if (!pd->use_in_front) {
pd->facing_grp[IN_FRONT] = pd->facing_grp[NOT_IN_FRONT];
}
}
void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob)
{
OVERLAY_PrivateData *pd = vedata->stl->pd;
if (pd->xray_enabled) {
return;
}
const DRWContextState *draw_ctx = DRW_context_state_get();
const bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->v3d) &&
!DRW_state_is_image_render();
const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0;
if (use_sculpt_pbvh) {
DRW_shgroup_call_sculpt(pd->facing_grp, ob, false, false, false);
DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false, false);
}
else {
struct GPUBatch *geom = DRW_cache_object_surface_get(ob);
if (geom) {
DRW_shgroup_call(pd->facing_grp, geom, ob);
DRW_shgroup_call(pd->facing_grp[is_xray], geom, ob);
}
}
}
@ -64,5 +77,12 @@ void OVERLAY_facing_draw(OVERLAY_Data *vedata)
{
OVERLAY_PassList *psl = vedata->psl;
DRW_draw_pass(psl->facing_ps);
DRW_draw_pass(psl->facing_ps[NOT_IN_FRONT]);
}
void OVERLAY_facing_infront_draw(OVERLAY_Data *vedata)
{
OVERLAY_PassList *psl = vedata->psl;
DRW_draw_pass(psl->facing_ps[IN_FRONT]);
}

View File

@ -78,7 +78,7 @@ typedef struct OVERLAY_PassList {
DRWPass *extra_centers_ps;
DRWPass *extra_grid_ps;
DRWPass *gpencil_canvas_ps;
DRWPass *facing_ps;
DRWPass *facing_ps[2];
DRWPass *grid_ps;
DRWPass *image_background_ps;
DRWPass *image_empties_ps;
@ -239,7 +239,7 @@ typedef struct OVERLAY_PrivateData {
DRWShadingGroup *edit_text_overlay_grp;
DRWShadingGroup *edit_text_wire_grp[2];
DRWShadingGroup *extra_grid_grp;
DRWShadingGroup *facing_grp;
DRWShadingGroup *facing_grp[2];
DRWShadingGroup *motion_path_lines_grp;
DRWShadingGroup *motion_path_points_grp;
DRWShadingGroup *outlines_grp;
@ -500,6 +500,7 @@ void OVERLAY_facing_init(OVERLAY_Data *vedata);
void OVERLAY_facing_cache_init(OVERLAY_Data *vedata);
void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob);
void OVERLAY_facing_draw(OVERLAY_Data *vedata);
void OVERLAY_facing_infront_draw(OVERLAY_Data *vedata);
void OVERLAY_grid_init(OVERLAY_Data *vedata);
void OVERLAY_grid_cache_init(OVERLAY_Data *vedata);

View File

@ -217,8 +217,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
if (!v3d || (v3d->shading.type == OB_RENDER && BKE_scene_uses_blender_workbench(scene))) {
/* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
* But this is a workaround for a missing update tagging from operators. */
if (scene->display.shading.type != wpd->shading.type ||
(v3d && (XRAY_ENABLED(v3d) != XRAY_ENABLED(&scene->display))) ||
if ((v3d && (XRAY_ENABLED(v3d) != XRAY_ENABLED(&scene->display))) ||
(scene->display.shading.flag != wpd->shading.flag)) {
wpd->view_updated = true;
}
@ -245,8 +244,7 @@ void workbench_private_data_init(WORKBENCH_PrivateData *wpd)
else {
/* FIXME: This reproduce old behavior when workbench was separated in 2 engines.
* But this is a workaround for a missing update tagging from operators. */
if (v3d->shading.type != wpd->shading.type || XRAY_ENABLED(v3d) != XRAY_ENABLED(wpd) ||
v3d->shading.flag != wpd->shading.flag) {
if (XRAY_ENABLED(v3d) != XRAY_ENABLED(wpd) || v3d->shading.flag != wpd->shading.flag) {
wpd->view_updated = true;
}

View File

@ -547,7 +547,7 @@ void ED_region_exit(bContext *C, ARegion *region)
WM_event_remove_handlers(C, &region->handlers);
WM_event_modal_handler_region_replace(win, region, NULL);
WM_draw_region_free(region);
WM_draw_region_free(region, true);
if (region->headerstr) {
MEM_freeN(region->headerstr);

View File

@ -238,6 +238,9 @@ void ED_view3d_stop_render_preview(wmWindowManager *wm, ARegion *region)
RE_engine_free(rv3d->render_engine);
rv3d->render_engine = NULL;
}
/* A bit overkill but this make sure the viewport is reset completely. (fclem) */
WM_draw_region_free(region, false);
}
void ED_view3d_shade_update(Main *bmain, View3D *v3d, ScrArea *area)

View File

@ -773,7 +773,7 @@ void WM_draw_region_viewport_bind(struct ARegion *region);
void WM_draw_region_viewport_unbind(struct ARegion *region);
/* Region drawing */
void WM_draw_region_free(struct ARegion *region);
void WM_draw_region_free(struct ARegion *region, bool hide);
struct GPUViewport *WM_draw_region_get_viewport(struct ARegion *region);
struct GPUViewport *WM_draw_region_get_bound_viewport(struct ARegion *region);

View File

@ -1037,10 +1037,12 @@ void wm_draw_region_clear(wmWindow *win, ARegion *UNUSED(region))
screen->do_draw = true;
}
void WM_draw_region_free(ARegion *region)
void WM_draw_region_free(ARegion *region, bool hide)
{
wm_draw_region_buffer_free(region);
region->visible = 0;
if (hide) {
region->visible = 0;
}
}
void wm_draw_region_test(bContext *C, ScrArea *area, ARegion *region)