diff options
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 15 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_text.c | 20 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_text.h | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_view.c | 4 | ||||
-rw-r--r-- | source/blender/editors/curve/editcurve_paint.c | 21 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 8 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw_legacy.c | 22 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 14 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_snap.c | 4 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 3 |
13 files changed, 35 insertions, 98 deletions
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index b7326ca5842..ea25739e52d 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -877,7 +877,7 @@ static void drw_engines_draw_text(void) PROFILE_START(stime); if (data->text_draw_cache) { - DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.v3d, DST.draw_ctx.ar, false); + DRW_text_cache_draw(data->text_draw_cache, DST.draw_ctx.ar); } PROFILE_END_UPDATE(data->render_time, stime); @@ -1237,9 +1237,7 @@ void DRW_draw_render_loop_ex( RegionView3D *rv3d = ar->regiondata; DST.draw_ctx.evil_C = evil_C; - DST.viewport = viewport; - v3d->zbuf = true; /* Setup viewport */ GPU_viewport_engines_data_validate(DST.viewport, DRW_engines_get_hash()); @@ -1658,8 +1656,6 @@ void DRW_draw_select_loop( GPU_viewport_size_set(viewport, (const int[2]){BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)}); DST.viewport = viewport; - v3d->zbuf = true; - DST.options.is_select = true; /* Get list of enabled engines */ @@ -1853,10 +1849,7 @@ void DRW_draw_depth_loop( GPU_framebuffer_bind(g_select_buffer.framebuffer); GPU_framebuffer_clear_depth(g_select_buffer.framebuffer, 1.0f); - bool cache_is_dirty; DST.viewport = viewport; - v3d->zbuf = true; - DST.options.is_depth = true; /* Get list of enabled engines */ @@ -1866,7 +1859,6 @@ void DRW_draw_depth_loop( } /* Setup viewport */ - cache_is_dirty = true; /* Instead of 'DRW_context_state_init(C, &DST.draw_ctx)', assign from args */ DST.draw_ctx = (DRWContextState){ @@ -1885,10 +1877,7 @@ void DRW_draw_depth_loop( drw_engines_init(); DRW_hair_init(); - /* TODO : tag to refresh by the dependency graph */ - /* ideally only refresh when objects are added/removed */ - /* or render properties / materials change */ - if (cache_is_dirty) { + { drw_engines_cache_init(); DEG_OBJECT_ITER_FOR_RENDER_ENGINE_BEGIN(depsgraph, ob) diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c index 56255af98ce..1f385b958b8 100644 --- a/source/blender/draw/intern/draw_manager_text.c +++ b/source/blender/draw/intern/draw_manager_text.c @@ -111,9 +111,7 @@ void DRW_text_cache_add( } } -void DRW_text_cache_draw( - DRWTextStore *dt, - View3D *v3d, ARegion *ar, bool depth_write) +void DRW_text_cache_draw(DRWTextStore *dt, ARegion *ar) { RegionView3D *rv3d = ar->regiondata; ViewCachedString *vos; @@ -149,13 +147,6 @@ void DRW_text_cache_draw( gpuPushMatrix(); gpuLoadIdentity(); - if (depth_write) { - if (v3d->zbuf) glDisable(GL_DEPTH_TEST); - } - else { - glDepthMask(GL_FALSE); - } - const int font_id = BLF_default(); const uiStyle *style = UI_style_get(); @@ -171,7 +162,7 @@ void DRW_text_cache_draw( BLF_position( font_id, - (float)(vos->sco[0] + vos->xoffs), (float)(vos->sco[1]), (depth_write) ? 0.0f : 2.0f); + (float)(vos->sco[0] + vos->xoffs), (float)(vos->sco[1]), 2.0f); ((vos->flag & DRW_TEXT_CACHE_ASCII) ? BLF_draw_ascii : @@ -182,13 +173,6 @@ void DRW_text_cache_draw( } } - if (depth_write) { - if (v3d->zbuf) glEnable(GL_DEPTH_TEST); - } - else { - glDepthMask(GL_TRUE); - } - gpuPopMatrix(); gpuLoadProjectionMatrix(original_proj); diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h index a58e167be0d..a675a200924 100644 --- a/source/blender/draw/intern/draw_manager_text.h +++ b/source/blender/draw/intern/draw_manager_text.h @@ -36,9 +36,7 @@ void DRW_text_cache_add( short xoffs, short flag, const unsigned char col[4]); -void DRW_text_cache_draw( - struct DRWTextStore *dt, - struct View3D *v3d, struct ARegion *ar, bool depth_write); +void DRW_text_cache_draw(struct DRWTextStore *dt, struct ARegion *ar); enum { DRW_TEXT_CACHE_ASCII = (1 << 0), diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index a666ec5395f..347932619b9 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -744,8 +744,6 @@ void DRW_draw_cursor(void) void DRW_draw_manipulator_3d(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - View3D *v3d = draw_ctx->v3d; - v3d->zbuf = false; ARegion *ar = draw_ctx->ar; /* draw depth culled manipulators - manipulators need to be updated *after* view matrix was set up */ @@ -760,8 +758,6 @@ void DRW_draw_manipulator_3d(void) void DRW_draw_manipulator_2d(void) { const DRWContextState *draw_ctx = DRW_context_state_get(); - View3D *v3d = draw_ctx->v3d; - v3d->zbuf = false; ARegion *ar = draw_ctx->ar; WM_manipulatormap_draw( diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index e679b04f25d..5e3fec93340 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -373,7 +373,6 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS return; } - View3D *v3d = cdd->vc.v3d; Object *obedit = cdd->vc.obedit; Curve *cu = obedit->data; @@ -434,37 +433,29 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); + GPU_depth_test(false); GPU_blend(true); GPU_line_smooth(true); + GPU_line_width(3.0f); imm_cpack(0x0); immBegin(GWN_PRIM_LINE_STRIP, stroke_len); - GPU_line_width(3.0f); - - if (v3d->zbuf) { - GPU_depth_test(false); - } - for (int i = 0; i < stroke_len; i++) { immVertex3fv(pos, coord_array[i]); } - immEnd(); - imm_cpack(0xffffffff); - immBegin(GWN_PRIM_LINE_STRIP, stroke_len); GPU_line_width(1.0f); + imm_cpack(0xffffffff); + immBegin(GWN_PRIM_LINE_STRIP, stroke_len); for (int i = 0; i < stroke_len; i++) { immVertex3fv(pos, coord_array[i]); } - immEnd(); - if (v3d->zbuf) { - GPU_depth_test(true); - } - + /* Reset defaults */ + GPU_depth_test(true); GPU_blend(false); GPU_line_smooth(false); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index a511100ff4e..8f8400e2d20 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1037,12 +1037,11 @@ static void knife_init_colors(KnifeColors *colors) } /* modal loop selection drawing callback */ -static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) +static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { - View3D *v3d = CTX_wm_view3d(C); const KnifeTool_OpData *kcd = arg; - if (v3d->zbuf) GPU_depth_test(false); + GPU_depth_test(false); glPolygonOffset(1.0f, 1.0f); @@ -1196,7 +1195,8 @@ static void knifetool_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) gpuPopMatrix(); - if (v3d->zbuf) GPU_depth_test(true); + /* Reset default */ + GPU_depth_test(true); } /** diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 8493d15a3b1..b437bdca111 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -106,14 +106,12 @@ typedef struct RingSelOpData { } RingSelOpData; /* modal loop selection drawing callback */ -static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) +static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg) { - View3D *v3d = CTX_wm_view3d(C); RingSelOpData *lcd = arg; if ((lcd->totedge > 0) || (lcd->totpoint > 0)) { - if (v3d && v3d->zbuf) - GPU_depth_test(false); + GPU_depth_test(false); gpuPushMatrix(); gpuMultMatrix(lcd->ob->obmat); @@ -150,8 +148,8 @@ static void ringsel_draw(const bContext *C, ARegion *UNUSED(ar), void *arg) gpuPopMatrix(); - if (v3d && v3d->zbuf) - GPU_depth_test(true); + /* Reset default */ + GPU_depth_test(true); } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 0d5240d8e86..a428b60643d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -703,7 +703,6 @@ void ED_view3d_draw_depth( Scene *scene = DEG_get_evaluated_scene(depsgraph); RegionView3D *rv3d = ar->regiondata; - short zbuf = v3d->zbuf; short flag = v3d->flag; float glalphaclip = U.glalphaclip; int obcenter_dia = U.obcenter_dia; @@ -727,7 +726,6 @@ void ED_view3d_draw_depth( /* get surface depth without bias */ rv3d->rflag |= RV3D_ZOFFSET_DISABLED; - v3d->zbuf = true; GPU_depth_test(true); DRW_draw_depth_loop(depsgraph, ar, v3d); @@ -737,8 +735,8 @@ void ED_view3d_draw_depth( } rv3d->rflag &= ~RV3D_ZOFFSET_DISABLED; - v3d->zbuf = zbuf; - if (!v3d->zbuf) GPU_depth_test(false); + /* Reset default for UI */ + GPU_depth_test(false); U.glalphaclip = glalphaclip; v3d->flag = flag; diff --git a/source/blender/editors/space_view3d/view3d_draw_legacy.c b/source/blender/editors/space_view3d/view3d_draw_legacy.c index 06cdba3f537..cfeb199de15 100644 --- a/source/blender/editors/space_view3d/view3d_draw_legacy.c +++ b/source/blender/editors/space_view3d/view3d_draw_legacy.c @@ -210,7 +210,9 @@ static void backdrawview3d( } #endif +#if 0 /* v3d->zbuf deprecated */ if (v3d->drawtype > OB_WIRE) v3d->zbuf = true; +#endif /* dithering and AA break color coding, so disable */ glDisable(GL_DITHER); @@ -249,14 +251,8 @@ static void backdrawview3d( GPU_scissor(ar->winrct.xmin, ar->winrct.ymin, BLI_rcti_size_x(&ar->winrct), BLI_rcti_size_y(&ar->winrct)); GPU_clear_color(0.0, 0.0, 0.0, 0.0); - if (v3d->zbuf) { - GPU_depth_test(true); - GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT); - } - else { - GPU_clear(GPU_COLOR_BIT); - GPU_depth_test(false); - } + GPU_depth_test(true); + GPU_clear(GPU_COLOR_BIT | GPU_DEPTH_BIT); if (rv3d->rflag & RV3D_CLIPPING) ED_view3d_clipping_set(rv3d); @@ -273,7 +269,6 @@ static void backdrawview3d( v3d->flag &= ~V3D_INVALID_BACKBUF; G.f &= ~G_BACKBUFSEL; - v3d->zbuf = false; GPU_depth_test(false); glEnable(GL_DITHER); @@ -684,7 +679,7 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph, ibuf = ibuf->mipmap[mip - 1]; } - if (v3d->zbuf) GPU_depth_test(false); + GPU_depth_test(false); glDepthMask(GL_FALSE); GPU_blend(true); @@ -718,7 +713,7 @@ static void view3d_draw_bgpic(Scene *scene, Depsgraph *depsgraph, GPU_blend(false); glDepthMask(GL_TRUE); - if (v3d->zbuf) GPU_depth_test(true); + GPU_depth_test(true); if (freeibuf) IMB_freeImBuf(freeibuf); @@ -878,22 +873,19 @@ void ED_view3d_draw_depth_gpencil( Depsgraph *depsgraph, Scene *scene, ARegion *ar, View3D *v3d) { ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); - bool zbuf = v3d->zbuf; /* Setup view matrix. */ ED_view3d_draw_setup_view(NULL, depsgraph, scene, ar, v3d, NULL, NULL, NULL); GPU_clear(GPU_DEPTH_BIT); - v3d->zbuf = true; GPU_depth_test(true); if (v3d->flag2 & V3D_SHOW_GPENCIL) { ED_gpencil_draw_view3d(NULL, scene, view_layer, depsgraph, v3d, ar, true); } - v3d->zbuf = zbuf; - if (!zbuf) GPU_depth_test(false); + GPU_depth_test(false); } /* *********************** customdata **************** */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index aad2ac7284f..c9e915a6415 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1004,7 +1004,6 @@ int view3d_opengl_select( ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, &rect); if (v3d->drawtype > OB_WIRE) { - v3d->zbuf = true; GPU_depth_test(true); } @@ -1050,7 +1049,6 @@ int view3d_opengl_select( ED_view3d_draw_setup_view(vc->win, depsgraph, scene, ar, v3d, vc->rv3d->viewmat, NULL, NULL); if (v3d->drawtype > OB_WIRE) { - v3d->zbuf = 0; GPU_depth_test(false); } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cab478413eb..d26da986a6c 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -6972,11 +6972,9 @@ static void drawEdgeSlide(TransInfo *t) /* Even mode */ if ((slp->use_even == true) || (is_clamp == false)) { - View3D *v3d = t->view; const float line_size = UI_GetThemeValuef(TH_OUTLINE_WIDTH) + 0.5f; - if (v3d && v3d->zbuf) - GPU_depth_test(false); + GPU_depth_test(false); GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); @@ -7074,8 +7072,7 @@ static void drawEdgeSlide(TransInfo *t) GPU_blend(false); - if (v3d && v3d->zbuf) - GPU_depth_test(true); + GPU_depth_test(true); } } } @@ -7603,7 +7600,6 @@ static void drawVertSlide(TransInfo *t) /* Non-Prop mode */ { - View3D *v3d = t->view; TransDataVertSlideVert *curr_sv = &sld->sv[sld->curr_sv_index]; TransDataVertSlideVert *sv; const float ctrl_size = UI_GetThemeValuef(TH_FACEDOT_SIZE) + 1.5f; @@ -7611,8 +7607,7 @@ static void drawVertSlide(TransInfo *t) const int alpha_shade = -160; int i; - if (v3d && v3d->zbuf) - GPU_depth_test(false); + GPU_depth_test(false); GPU_blend(true); GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); @@ -7706,8 +7701,7 @@ static void drawVertSlide(TransInfo *t) gpuPopMatrix(); - if (v3d && v3d->zbuf) - GPU_depth_test(true); + GPU_depth_test(true); } } } diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 48ec664d634..9ffd14ad956 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -155,7 +155,6 @@ void drawSnapping(const struct bContext *C, TransInfo *t) if (t->spacetype == SPACE_VIEW3D) { if (validSnap(t)) { TransSnapPoint *p; - View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d = CTX_wm_region_view3d(C); float imat[4][4]; float size; @@ -201,8 +200,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) immUnbindProgram(); - if (v3d->zbuf) - GPU_depth_test(true); + GPU_depth_test(true); } } else if (t->spacetype == SPACE_IMAGE) { diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 6dbed4d5d6f..d78c731764e 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -238,7 +238,8 @@ typedef struct View3D { short flag3; /* drawflags, denoting state */ - char zbuf, transp, xray; + char zbuf DNA_DEPRECATED; + char transp, xray; char multiview_eye; /* multiview current eye - for internal use */ |