[Bf-blender-cvs] [c10fbc002b] blender2.8: Correct assert failure in debug mode with lasso select

Sergey Sharybin noreply at git.blender.org
Wed Mar 15 14:06:12 CET 2017


Commit: c10fbc002b8968232ab4bfab19fe977f90744fba
Author: Sergey Sharybin
Date:   Wed Mar 15 14:01:30 2017 +0100
Branches: blender2.8
https://developer.blender.org/rBc10fbc002b8968232ab4bfab19fe977f90744fba

Correct assert failure in debug mode with lasso select

Just do early output and don't bother with any GLSL program bind when
there is not enough points of lasso to draw.

This could have happened at the very beginning of the stroke.

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

M	source/blender/windowmanager/intern/wm_gesture.c

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

diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 74dd9914c3..da490f793b 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -400,6 +400,16 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
 		draw_filled_lasso(win, gt);
 	}
 
+	numverts = gt->points;
+	if (gt->type == WM_GESTURE_LASSO) {
+		numverts++;
+	}
+
+	/* Nothing to drawe, do early output. */
+	if(numverts < 2) {
+		return;
+	}
+
 	VertexFormat* format = immVertexFormat();
 	unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
 	unsigned line_origin = add_attrib(format, "line_origin", COMP_F32, 2, KEEP_FLOAT);
@@ -415,11 +425,6 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
 	immUniform1f("dash_width", 2.0f);
 	immUniform1f("dash_width_on", 1.0f);
 
-	numverts = gt->points;
-	if (gt->type == WM_GESTURE_LASSO) {
-		numverts++;
-	}
-
 	immBegin(PRIM_LINE_STRIP, numverts);
 
 	for (i = 0; i < gt->points; i++, lasso += 2) {
@@ -441,7 +446,7 @@ static void wm_gesture_draw_lasso(wmWindow *win, wmGesture *gt, bool filled)
 	}
 
 	immEnd();
-	
+
 	immUnbindProgram();
 }




More information about the Bf-blender-cvs mailing list