From 5099cbeec9c481600e359e95a806a3393ba4ab0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Thu, 16 Jul 2020 04:16:10 +0200 Subject: Cleanup: GPU: Move depth/color masks functions to GPU_state --- source/blender/editors/gpencil/drawgpencil.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/gpencil/drawgpencil.c') diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 60fd52db707..4df071c84f8 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -306,6 +306,10 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw) GPU_program_point_size(true); + /* Do not write to depth (avoid self-occlusion). */ + bool prev_depth_mask = GPU_depth_mask_get(); + GPU_depth_mask(false); + bGPDstroke *gps_init = (tgpw->gps) ? tgpw->gps : tgpw->t_gpf->strokes.first; for (bGPDstroke *gps = gps_init; gps; gps = gps->next) { @@ -343,11 +347,8 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw) /* check which stroke-drawer to use */ if (tgpw->dflag & GP_DRAWDATA_ONLY3D) { const int no_xray = (tgpw->dflag & GP_DRAWDATA_NO_XRAY); - int mask_orig = 0; if (no_xray) { - glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig); - glDepthMask(0); GPU_depth_test(true); /* first arg is normally rv3d->dist, but this isn't @@ -393,7 +394,6 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw) } } if (no_xray) { - glDepthMask(mask_orig); GPU_depth_test(false); bglPolygonOffset(0.0, 0.0); @@ -405,6 +405,7 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw) } } + GPU_depth_mask(prev_depth_mask); GPU_program_point_size(false); } -- cgit v1.2.3