[Bf-blender-cvs] [c602ec74fdd] master: GPU: State: Replace GL_BLEND by GPU_blend

Clément Foucault noreply at git.blender.org
Mon Mar 25 20:27:08 CET 2019


Commit: c602ec74fdd20c17c9ca9c7eb59c048443efc2ce
Author: Clément Foucault
Date:   Mon Mar 25 20:26:52 2019 +0100
Branches: master
https://developer.blender.org/rBc602ec74fdd20c17c9ca9c7eb59c048443efc2ce

GPU: State: Replace GL_BLEND by GPU_blend

===================================================================

M	source/blender/draw/intern/draw_view.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/interface/interface_icons_event.c
M	source/blender/windowmanager/intern/wm_dragdrop.c
M	source/blender/windowmanager/intern/wm_draw.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_playanim.c

===================================================================

diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index c578625de05..71bf37b4e7a 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -215,7 +215,7 @@ void DRW_draw_cursor(void)
 
 			/* Draw nice Anti Aliased cursor. */
 			GPU_line_width(1.0f);
-			glEnable(GL_BLEND);
+			GPU_blend(true);
 			GPU_line_smooth(true);
 
 			float eps = 1e-5f;
@@ -277,7 +277,7 @@ void DRW_draw_cursor(void)
 
 			GPU_batch_draw(cursor_batch);
 
-			glDisable(GL_BLEND);
+			GPU_blend(false);
 			GPU_line_smooth(false);
 			GPU_matrix_pop();
 			GPU_matrix_projection_set(original_proj);
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 8d642e82208..45498882160 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1385,7 +1385,7 @@ void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const in
 	tgpw.dflag = dflag;
 
 	/* turn on alpha-blending */
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 	for (tgpil = tgpi->ilayers.first; tgpil; tgpil = tgpil->next) {
 		/* calculate parent position */
 		ED_gpencil_parent_location(depsgraph, obact, tgpi->gpd, tgpil->gpl, tgpw.diff_mat);
@@ -1403,7 +1403,7 @@ void ED_gp_draw_interpolation(const bContext *C, tGPDinterpolate *tgpi, const in
 			gp_draw_strokes(&tgpw);
 		}
 	}
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 }
 
 /* wrapper to draw strokes for filling operator */
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index a4b4b699e5e..acbf329b783 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -241,7 +241,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
 	tgpw.disable_fill = 1;
 	tgpw.dflag |= (GP_DRAWFILLS_ONLY3D | GP_DRAWFILLS_NOSTATUS);
 
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		/* calculate parent position */
@@ -309,7 +309,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
 		}
 	}
 
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 }
 
 /* draw strokes in offscreen buffer */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 3cab71272fa..f517cc59b7e 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1621,7 +1621,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y)
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
 	GPU_line_smooth(true);
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 	glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
 
 	immUniformColor4ub(255, 100, 100, 20);
@@ -1648,7 +1648,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y)
 
 	immUnbindProgram();
 
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 	GPU_line_smooth(false);
 }
 
@@ -1766,7 +1766,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 
 	GPU_line_smooth(true);
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 
 	/* Inner Ring: Color from UI panel */
 	immUniformColor4f(color[0], color[1], color[2], 0.8f);
@@ -1786,7 +1786,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
 	immUniformColor4f(darkcolor[0], darkcolor[1], darkcolor[2], 0.8f);
 	imm_draw_circle_wire_2d(pos, x, y, radius + 1, 40);
 
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 	GPU_line_smooth(false);
 
 	/* Draw line for lazy mouse */
@@ -1794,7 +1794,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
 	    (brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP))
 	{
 		GPU_line_smooth(true);
-		glEnable(GL_BLEND);
+		GPU_blend(true);
 
 		copy_v3_v3(color, brush->add_col);
 		immUniformColor4f(color[0], color[1], color[2], 0.8f);
@@ -1807,7 +1807,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
 		        last_mouse_position[1] + ar->winrct.ymin);
 		immEnd();
 
-		glDisable(GL_BLEND);
+		GPU_blend(false);
 		GPU_line_smooth(false);
 	}
 
diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c
index 8cd60c69b62..2af9bbf9e88 100644
--- a/source/blender/editors/interface/interface_icons_event.c
+++ b/source/blender/editors/interface/interface_icons_event.c
@@ -127,7 +127,7 @@ static void icon_draw_rect_input_line_prim(
         const char lines[][2], int lines_len)
 {
 	GPU_line_smooth(true);
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 	BLI_assert(ELEM(prim, GPU_PRIM_LINE_LOOP, GPU_PRIM_LINE_STRIP));
 	const uint pos_id = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -145,7 +145,7 @@ static void icon_draw_rect_input_line_prim(
 	immEnd();
 	immUnbindProgram();
 	GPU_line_smooth(false);
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 }
 
 void icon_draw_rect_input(
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c
index fcfc9c8b0ae..11e803c4b82 100644
--- a/source/blender/windowmanager/intern/wm_dragdrop.c
+++ b/source/blender/windowmanager/intern/wm_dragdrop.c
@@ -41,6 +41,7 @@
 #include "BKE_idcode.h"
 
 #include "GPU_shader.h"
+#include "GPU_state.h"
 
 #include "IMB_imbuf_types.h"
 
@@ -388,7 +389,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
 	}
 
 	/* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 	for (drag = wm->drags.first; drag; drag = drag->next) {
 		const char text_col[] = {255, 255, 255, 255};
 		int iconsize = UI_DPI_ICON_SIZE;
@@ -466,5 +467,5 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect)
 
 		}
 	}
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 }
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 6a3eeea14f0..4f299201bdf 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -59,6 +59,7 @@
 #include "GPU_framebuffer.h"
 #include "GPU_immediate.h"
 #include "GPU_matrix.h"
+#include "GPU_state.h"
 #include "GPU_texture.h"
 #include "GPU_viewport.h"
 
@@ -463,7 +464,7 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
 
 	if (blend) {
 		/* GL_ONE because regions drawn offscreen have premultiplied alpha. */
-		glEnable(GL_BLEND);
+		GPU_blend(true);
 		glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
 	}
 
@@ -507,7 +508,7 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend)
 
 	if (blend) {
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
-		glDisable(GL_BLEND);
+		GPU_blend(false);
 	}
 }
 
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index c9853776902..013ee029200 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -197,7 +197,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
 
 	uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT);
 
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 
 	immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
 	immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f);
@@ -206,7 +206,7 @@ static void wm_gesture_draw_rect(wmGesture *gt)
 
 	immUnbindProgram();
 
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 
 	shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
 
@@ -231,7 +231,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
 {
 	rcti *rect = (rcti *)gt->customdata;
 
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 
 	const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
 
@@ -242,7 +242,7 @@ static void wm_gesture_draw_circle(wmGesture *gt)
 
 	immUnbindProgram();
 
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 
 	immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR);
 
@@ -304,7 +304,7 @@ static void draw_filled_lasso(wmGesture *gt)
 		       draw_filled_lasso_px_cb, &lasso_fill_data);
 
 		/* Additive Blending */
-		glEnable(GL_BLEND);
+		GPU_blend(true);
 		glBlendFunc(GL_ONE, GL_ONE);
 
 		GLint unpack_alignment;
@@ -324,7 +324,7 @@ static void draw_filled_lasso(wmGesture *gt)
 
 		MEM_freeN(pixel_buf);
 
-		glDisable(GL_BLEND);
+		GPU_blend(false);
 		glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
 	}
 
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 6f33bd62bcd..0b306406054 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2159,7 +2159,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
 	y = rc->initial_mouse[1];
 	GPU_matrix_translate_2f((float)x, (float)y);
 
-	glEnable(GL_BLEND);
+	GPU_blend(true);
 	GPU_line_smooth(true);
 
 	/* apply zoom if available */
@@ -2220,7 +2220,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void
 
 	BLF_disable(fontid, BLF_SHADOW);
 
-	glDisable(GL_BLEND);
+	GPU_blend(false);
 	GPU_line_smooth(false);
 
 }
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index e6c73bf3bf7..0a1ec29c01c 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -57,11 +57,12 @@
 
 #include "BIF_glutil.h"
 
+#include "GPU_context.h"
 #include "GPU_matrix.h"
 #include "GPU_immediate.h"
 #include "GPU_immediate_util.h"
-#include "GPU_context.h"
 #include "GPU_init_exit.h"
+#include "GPU_state.h"
 
 #include "DNA_scene_types.h"
 #include "ED_datafiles.h" /* for fonts */
@@ -311,7 +312,7 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
 
 	/* checkerboard for case alpha */
 	if (i

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list