[Bf-blender-cvs] [298329554a5] master: Cleanup: GPUState: remove double GPU_blend calls

Clément Foucault noreply at git.blender.org
Tue Aug 18 21:31:00 CEST 2020


Commit: 298329554a5a0ae40bc4a64ca9c1490d22edc947
Author: Clément Foucault
Date:   Sun Aug 16 16:48:21 2020 +0200
Branches: master
https://developer.blender.org/rB298329554a5a0ae40bc4a64ca9c1490d22edc947

Cleanup: GPUState: remove double GPU_blend calls

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

M	source/blender/blenfont/intern/blf_font.c
M	source/blender/draw/intern/draw_manager.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/animation/time_scrub_ui.c
M	source/blender/editors/gpencil/annotate_draw.c
M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/interface/interface_widgets.c
M	source/blender/editors/mask/mask_draw.c
M	source/blender/editors/mesh/editmesh_knife.c
M	source/blender/editors/screen/area.c
M	source/blender/editors/screen/screen_draw.c
M	source/blender/editors/sculpt_paint/paint_cursor.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_clip/clip_utils.c
M	source/blender/editors/space_graph/graph_draw.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_info/textview.c
M	source/blender/editors/space_nla/nla_draw.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_text/text_draw.c
M	source/blender/editors/space_view3d/drawobject.c
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_mode_edge_slide.c
M	source/blender/editors/transform/transform_mode_vert_slide.c
M	source/blender/gpu/GPU_state.h
M	source/blender/windowmanager/intern/wm_draw.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_playanim.c

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

diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 7febfb5d3d5..5724d844089 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -222,7 +222,6 @@ void blf_batch_draw(void)
   }
 
   GPU_blend(GPU_BLEND_ALPHA);
-  GPU_blend(GPU_BLEND_ALPHA);
 
 #ifndef BLF_STANDALONE
   /* We need to flush widget base first to ensure correct ordering. */
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 4e8b931f6a6..11430c4075e 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1596,7 +1596,6 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
     GPU_clear(GPU_COLOR_BIT);
     /* Premult Alpha over black background. */
     GPU_blend(GPU_BLEND_ALPHA_PREMULT);
-    GPU_blend(GPU_BLEND_ALPHA);
   }
 
   GPU_matrix_identity_set();
@@ -1606,7 +1605,6 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph,
 
   if (draw_background) {
     /* Reset default. */
-    GPU_blend(GPU_BLEND_ALPHA);
     GPU_blend(GPU_BLEND_NONE);
   }
 
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 656ff844948..0a464e6709a 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -4387,7 +4387,6 @@ void ANIM_channel_draw(
 
   /* set blending again, as may not be set in previous step */
   GPU_blend(GPU_BLEND_ALPHA);
-  GPU_blend(GPU_BLEND_ALPHA);
 
   /* step 1) draw backdrop ...........................................  */
   if (acf->draw_backdrop) {
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 0bebc25863b..73df0518f06 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -99,7 +99,6 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width)
   /* only draw this if preview range is set */
   if (PRVRANGEON) {
     GPU_blend(GPU_BLEND_ALPHA);
-    GPU_blend(GPU_BLEND_ALPHA);
 
     GPUVertFormat *format = immVertexFormat();
     uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
@@ -133,7 +132,6 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d)
 {
   /* draw darkened area outside of active timeline frame range */
   GPU_blend(GPU_BLEND_ALPHA);
-  GPU_blend(GPU_BLEND_ALPHA);
 
   GPUVertFormat *format = immVertexFormat();
   uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index 5f755b9f4d9..3bfa3b9d5be 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -499,7 +499,6 @@ static void draw_marker(
 
   marker_color_get(marker, text_color, line_color);
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   draw_marker_line(line_color, xpos, UI_DPI_FAC * 20, region_height);
@@ -528,7 +527,6 @@ static void draw_markers_background(rctf *rect)
 
   immUniformColor4ubv(shade);
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c
index 1690c9e3bba..0615e21c4a5 100644
--- a/source/blender/editors/animation/time_scrub_ui.c
+++ b/source/blender/editors/animation/time_scrub_ui.c
@@ -66,7 +66,6 @@ static void draw_background(const rcti *rect)
 
   immUniformThemeColor(TH_TIME_SCRUB_BACKGROUND);
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index 78f4df8f71a..654d1b87918 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -735,7 +735,6 @@ static void annotation_draw_data(
 
   /* turn on alpha-blending */
   GPU_blend(GPU_BLEND_ALPHA);
-  GPU_blend(GPU_BLEND_ALPHA);
 
   /* Do not write to depth (avoid self-occlusion). */
   bool prev_depth_mask = GPU_depth_mask_get();
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 56f554e5b7c..8237e6cfd62 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1701,7 +1701,6 @@ static void annotation_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_pt
 
     GPU_line_smooth(true);
     GPU_blend(GPU_BLEND_ALPHA);
-    GPU_blend(GPU_BLEND_ALPHA);
 
     immUniformColor4ub(255, 100, 100, 20);
     imm_draw_circle_fill_2d(shdr_pos, x, y, p->radius, 40);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 251d1b22846..3f62c3ec8c0 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2269,7 +2269,6 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
 
     GPU_line_smooth(true);
     GPU_blend(GPU_BLEND_ALPHA);
-    GPU_blend(GPU_BLEND_ALPHA);
 
     immUniformColor4ub(255, 100, 100, 20);
     imm_draw_circle_fill_2d(shdr_pos, x, y, p->radius, 40);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 46de164f381..8b77709bacb 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1761,7 +1761,6 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y)
 
   GPU_line_smooth(true);
   GPU_blend(GPU_BLEND_ALPHA);
-  GPU_blend(GPU_BLEND_ALPHA);
 
   immUniformColor4ub(255, 100, 100, 20);
   imm_draw_circle_fill_2d(shdr_pos, x, y, radius, 40);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index 8ebc8e60993..ba878be3dc7 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -752,7 +752,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
   GPU_scissor(rect->xmin, rect->ymin, w, h);
 #  endif
 
-  GPU_blend(GPU_BLEND_ALPHA);
   /* Combine with premultiplied alpha. */
   GPU_blend(GPU_BLEND_ALPHA_PREMULT);
 
@@ -781,8 +780,6 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
                    col);
 
   GPU_blend(GPU_BLEND_NONE);
-  /* Reset default. */
-  GPU_blend(GPU_BLEND_ALPHA);
 
 #  if 0
   // restore scissortest
@@ -924,7 +921,6 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
   float w = BLI_rctf_size_x(&rect);
   float h = BLI_rctf_size_y(&rect) * hist->ymax;
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   float color[4];
@@ -1067,7 +1063,6 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
   /* Flush text cache before changing scissors. */
   BLF_batch_draw_flush();
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   float color[4];
@@ -1095,7 +1090,6 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
   /* Flush text cache before drawing things on top. */
   BLF_batch_draw_flush();
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   GPUVertFormat *format = immVertexFormat();
@@ -1398,7 +1392,6 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
 
   float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   float color[4];
@@ -1956,7 +1949,6 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol,
   if (but->a1 == UI_GRAD_H) {
     /* grid, hsv uses different grid */
     GPU_blend(GPU_BLEND_ALPHA);
-    GPU_blend(GPU_BLEND_ALPHA);
     ARRAY_SET_ITEMS(color_backdrop, 0, 0, 0, 48.0 / 255.0);
     immUniformColor4fv(color_backdrop);
     ui_draw_but_curve_grid(pos, rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
@@ -2459,7 +2451,6 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region),
   int width = BLI_rctf_size_x(&rect) + 1;
   int height = BLI_rctf_size_y(&rect);
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
 
   /* need scissor test, preview image can draw outside of boundary */
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index e946aec2176..5410eed9915 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -2784,7 +2784,6 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
     rect->ymax += 0.1f * U.widget_unit;
   }
 
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
   widget_softshadow(rect, roundboxalign, wcol->roundness * U.widget_unit);
 
@@ -5163,7 +5162,6 @@ static void ui_draw_widget_back_color(uiWidgetTypeEnum type,
   uiWidgetType *wt = widget_type(type);
 
   if (use_shadow) {
-    GPU_blend(GPU_BLEND_ALPHA);
     GPU_blend(GPU_BLEND_ALPHA);
     widget_softshadow(rect, UI_CNR_ALL, 0.25f * U.widget_unit);
     GPU_blend(GPU_BLEND_NONE);
diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c
index b5db7b3d37e..dbaa335a9bf 100644
--- a/source/blender/editors/mask/mask_draw.c
+++ b/source/blender/editors/mask/mask_draw.c
@@ -594,7 +594,6 @@ static void draw_mask_layers(const bContext *C,
                              const int width,
                              const int height)
 {
-  GPU_blend(GPU_BLEND_ALPHA);
   GPU_blend(GPU_BLEND_ALPHA);
   GPU_program_point_size(true);
 
@@ -739,7 +738,6 @@ void ED_mask_draw_region(
 
     if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) {
       /* More blending types could be supported in the future. */
-      GPU_blend(GPU_BLEND_ALPHA);
       GPU_blend(GPU_BLEND_MULTIPLY);
     }
 
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editor

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list