[Bf-blender-cvs] [bd3a1b9490d] blender2.8: OpenGL: use PRIM instead of GL enum for immBegin

Mike Erwin noreply at git.blender.org
Fri Apr 7 22:32:02 CEST 2017


Commit: bd3a1b9490d96ca00748f405037379b743744877
Author: Mike Erwin
Date:   Fri Apr 7 16:31:26 2017 -0400
Branches: blender2.8
https://developer.blender.org/rBbd3a1b9490d96ca00748f405037379b743744877

OpenGL: use PRIM instead of GL enum for immBegin

Getting ready for a Gawain API change...

Part of T49043

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

M	source/blender/draw/intern/draw_view.c
M	source/blender/editors/animation/anim_channels_defines.c
M	source/blender/editors/animation/anim_draw.c
M	source/blender/editors/animation/anim_markers.c
M	source/blender/editors/curve/editcurve_paint.c
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_panel.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/interface/view2d.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/mesh/editmesh_loopcut.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/screen/screen_draw.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/sculpt_paint/paint_image.c
M	source/blender/editors/sculpt_paint/paint_stroke.c
M	source/blender/editors/space_action/action_draw.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_graph_draw.c
M	source/blender/editors/space_clip/clip_utils.c
M	source/blender/editors/space_file/file_draw.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_graph/space_graph.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_nla/nla_draw.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_node/node_draw.c
M	source/blender/editors/space_outliner/outliner_draw.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_text/text_draw.c
M	source/blender/editors/space_time/space_time.c
M	source/blender/editors/space_view3d/drawanimviz.c
M	source/blender/editors/space_view3d/drawarmature.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/drawsimdebug.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_fly.c
M	source/blender/editors/space_view3d/view3d_ruler.c
M	source/blender/editors/space_view3d/view3d_walk.c
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/editors/transform/transform_generics.c
M	source/blender/editors/transform/transform_snap.c
M	source/blender/editors/util/ed_util.c
M	source/blender/editors/uvedit/uvedit_draw.c
M	source/blender/gpu/intern/gpu_immediate_util.c
M	source/blender/gpu/intern/gpu_viewport.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/manipulators/intern/manipulator_library/arrow_manipulator.c

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

diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index b5f4a13587d..5fc7fe1d8f4 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -240,7 +240,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
 					if (gridline_ct == 0)
 						goto drawgrid_cleanup; /* nothing to draw */
 
-					immBegin(GL_LINES, gridline_ct * 2);
+					immBegin(PRIM_LINES, gridline_ct * 2);
 				}
 
 				float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar);
@@ -293,7 +293,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
 		if (gridline_ct == 0)
 			goto drawgrid_cleanup; /* nothing to draw */
 
-		immBegin(GL_LINES, gridline_ct * 2);
+		immBegin(PRIM_LINES, gridline_ct * 2);
 
 		if (grids_to_draw == 2) {
 			UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2);
@@ -373,7 +373,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
 
 			immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
 
-			immBegin(GL_LINES, vertex_ct);
+			immBegin(PRIM_LINES, vertex_ct);
 
 			/* draw normal grid lines */
 			UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
@@ -460,7 +460,7 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
 			unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
 
 			immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
-			immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
+			immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
 
 			if (show_axis_x) {
 				UI_make_axis_color(col_grid, col_axis, 'X');
@@ -658,7 +658,7 @@ void DRW_draw_cursor(void)
 
 		const int segments = 16;
 
-		immBegin(GL_LINE_LOOP, segments);
+		immBegin(PRIM_LINE_LOOP, segments);
 		immAttrib3fv(wpos, co);
 
 		for (int i = 0; i < segments; ++i) {
@@ -677,7 +677,7 @@ void DRW_draw_cursor(void)
 
 		UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color);
 
-		immBegin(GL_LINES, 8);
+		immBegin(PRIM_LINES, 8);
 		immAttrib3ubv(color, crosshair_color);
 		immAttrib3fv(wpos, co);
 
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 17bca28cba7..0ebd556a0f5 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -3927,7 +3927,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float
 
 			glLineWidth(2.0f);
 
-			immBegin(GL_LINES, 2);
+			immBegin(PRIM_LINES, 2);
 			immVertex2f(pos, (float)offset, yminc);
 			immVertex2f(pos, (float)v2d->cur.xmax, yminc);
 			immEnd();
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 398bb225fbf..a2ad5c582d5 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -136,7 +136,7 @@ void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
 	/* Draw a light green line to indicate current frame */
 	immUniformThemeColor(TH_CFRAME);
 
-	immBegin(GL_LINES, 2);
+	immBegin(PRIM_LINES, 2);
 	immVertex2f(pos, x, v2d->cur.ymin - 500.0f); /* XXX arbitrary... want it go to bottom */
 	immVertex2f(pos, x, v2d->cur.ymax);
 	immEnd();
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 6f61ce3cf25..e78752a557c 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -361,7 +361,7 @@ static void draw_marker(
 			immUniformColor4ub(0, 0, 0, 96);
 		}
 
-		immBegin(GL_LINES, 2);
+		immBegin(PRIM_LINES, 2);
 		immVertex2f(pos, xpos + 0.5f, 12.0f);
 		immVertex2f(pos, xpos + 0.5f, (v2d->cur.ymax + 12.0f) * yscale);
 		immEnd();
diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c
index 60e2440bcc5..7212496a2cc 100644
--- a/source/blender/editors/curve/editcurve_paint.c
+++ b/source/blender/editors/curve/editcurve_paint.c
@@ -521,7 +521,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
 			glEnable(GL_LINE_SMOOTH);
 
 			imm_cpack(0x0);
-			immBegin(GL_LINE_STRIP, stroke_len);
+			immBegin(PRIM_LINE_STRIP, stroke_len);
 			glLineWidth(3.0f);
 
 			if (v3d->zbuf) {
@@ -535,7 +535,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), ARegion *UNUS
 			immEnd();
 
 			imm_cpack(0xffffffff);
-			immBegin(GL_LINE_STRIP, stroke_len);
+			immBegin(PRIM_LINE_STRIP, stroke_len);
 			glLineWidth(1.0f);
 
 			for (int i = 0; i < stroke_len; i++) {
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 7e33de7b271..70d97b28202 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -156,7 +156,7 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f
 		immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
 
 		/* Draw all triangles for filling the polygon */
-		immBegin(GL_TRIANGLES, tot_triangles * 3);
+		immBegin(PRIM_TRIANGLES, tot_triangles * 3);
 		/* TODO: use batch instead of immediate mode, to share vertices */
 
 		const tGPspoint *pt;
@@ -217,7 +217,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
 		/* if drawing a single point, draw it larger */
 		glPointSize((float)(thickness + 2) * points->pressure);
 		immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
-		immBegin(GL_POINTS, 1);
+		immBegin(PRIM_POINTS, 1);
 		gp_set_tpoint_varying_color(pt, ink, color);
 		immVertex2iv(pos, &pt->x);
 	}
@@ -229,7 +229,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
 
 		glLineWidth(max_ff(oldpressure * thickness, 1.0));
 		immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
-		immBeginAtMost(GL_LINE_STRIP, totpoints);
+		immBeginAtMost(PRIM_LINE_STRIP, totpoints);
 
 		/* TODO: implement this with a geometry shader to draw one continuous tapered stroke */
 
@@ -248,7 +248,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short
 				draw_points = 0;
 
 				glLineWidth(max_ff(pt->pressure * thickness, 1.0f));
-				immBeginAtMost(GL_LINE_STRIP, totpoints - i + 1);
+				immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1);
 
 				/* need to roll-back one point to ensure that there are no gaps in the stroke */
 				if (i != 0) { 
@@ -329,7 +329,7 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi
 
 	immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
 	GPU_enable_program_point_size();
-	immBegin(GL_POINTS, totpoints);
+	immBegin(PRIM_POINTS, totpoints);
 
 	const tGPspoint *pt = points;
 	for (int i = 0; i < totpoints; i++, pt++) {
@@ -356,7 +356,7 @@ static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints
 
 	immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
 	GPU_enable_program_point_size();
-	immBegin(GL_POINTS, totpoints);
+	immBegin(PRIM_POINTS, totpoints);
 
 	const bGPDspoint *pt = points;
 	for (int i = 0; i < totpoints; i++, pt++) {
@@ -389,7 +389,7 @@ static void gp_draw_stroke_volumetric_3d(
 
 	immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR);
 	GPU_enable_program_point_size();
-	immBegin(GL_POINTS, totpoints);
+	immBegin(PRIM_POINTS, totpoints);
 
 	const bGPDspoint *pt = points;
 	for (int i = 0; i < totpoints && pt; i++, pt++) {
@@ -536,7 +536,7 @@ static void gp_draw_stroke_fill(
 		immUniformColor4fv(color);
 
 		/* Draw all triangles for filling the polygon (cache must be calculated before) */
-		immBegin(GL_TRIANGLES, gps->tot_triangles * 3);
+		immBegin(PRIM_TRIANGLES, gps->tot_triangles * 3);
 		/* TODO: use batch instead of immediate mode, to share vertices */
 
 		bGPDtriangle *stroke_triangle = gps->triangles;
@@ -614,7 +614,7 @@ static void gp_draw_stroke_point(
 	/* set point thickness (since there's only one of these) */
 	immUniform1f("size", (float)(thickness + 2) * pt->pressure);
 
-	immBegin(GL_POINTS, 1);
+	immBegin(PRIM_POINTS, 1);
 	immVertex3fv(pos, fpt);
 	immEnd();
 
@@ -647,7 +647,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
 
 	/* draw stroke curve */
 	glLineWidth(max_ff(curpressure * thickness, 1.0f));
-	immBeginAtMost(GL_LINE_STRIP, totpoints + cyclic_add);
+	immBeginAtMost(PRIM_LINE_STRIP, totpoints + cyclic_add);
 	const bGPDspoint *pt = points;
 	for (int i = 0; i < totpoints; i++, pt++) {
 		gp_set_point_varying_color(pt, ink, color);
@@ -668,7 +668,7 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
 
 			curpressure = pt->pressure;
 			glLineWidth(max_ff(curpressure * thickness, 1.0f));
-			immBeginAtMost(GL_LINE_STRIP, totpoints - i + 1 + cyclic_add);
+			immBeginAtMost(PRIM_LINE_STRIP, totpoints - i + 1 + cyclic_add);
 
 			/* need to roll-back one point to ensure that there are no gaps in the stroke */
 			if (i != 0) { 
@@ -1185,7 +1185,7 @@ static void gp_draw_strokes_edit(
 			immBindBuiltinProgram(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR);
 		}
 
-		immBegin(GL_POINTS, gps->totpoints);
+		immBegin(PRIM_POINTS, gps->totpoints);
 
 		/* Draw start and end point differently if enabled stroke direction hint */
 		bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 3162584e910..bf14ed9df94 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -645,7 +645,7 @@ static void histogram_draw_one(
 		/* curve outline */
 		glLineWidth(1.5);
 
-		immBegin(GL_LINE_STRIP, res);
+		immBegin(PRIM_LINE_STRIP, res);
 		for (int i = 0; i < res; i++) {
 			float x2 = x + i * (w / (float)res);
 			immVertex2f(pos_attrib, x2, y + (data[i] * h));
@@ -654,7 +654,7 @@ static void histogram_draw_one(
 	}
 	else {
 		/* under the curv

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list