Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2018-07-03 20:22:00 +0300
committerClément Foucault <foucault.clem@gmail.com>2018-07-03 20:22:15 +0300
commitbb9355e7031404a4e0374ad49928e0fcad1f0aaa (patch)
tree7750e6d58dea5b8cb0e841b751bbb5d31d315b51 /source/blender/editors
parent79152371c3c259fed9d1106aa8003beef28168e6 (diff)
View3D: Remove v3d->zbuf
This is because depth test is set before drawing anything now. There is no case where we want to draw without depth test that is not selection and this case is not handle by v3d->zbuf anymore. UI assume depth test is off by default. The DRWManager assume it's on. This should fix T55623.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/curve/editcurve_paint.c21
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c8
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_draw_legacy.c22
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c2
-rw-r--r--source/blender/editors/transform/transform.c14
-rw-r--r--source/blender/editors/transform/transform_snap.c4
8 files changed, 28 insertions, 59 deletions
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) {