Commit: 969bcf0793dca0e75bf42998aba92b1abd90ec23
Author: Clément Foucault
Date:   Sun Aug 16 15:16:21 2020 +0200
Branches: master
https://developer.blender.org/rB969bcf0793dca0e75bf42998aba92b1abd90ec23

Cleanup: GPUState: Replace blend func separate by enum

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

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.c
M       source/blender/editors/interface/interface_draw.c
M       source/blender/editors/interface/interface_icons.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/space_clip/clip_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_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_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_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/editors/uvedit/uvedit_draw.c
M       source/blender/gpu/GPU_state.h
M       source/blender/gpu/intern/gpu_state.cc
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 76829db755c..2a6bc41704b 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -222,8 +222,7 @@ void blf_batch_draw(void)
   }
 
   GPU_blend(true);
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(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 4aa12ff2d23..664d514a77e 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1606,8 +1606,7 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph 
*depsgraph,
 
   if (draw_background) {
     /* Reset default. */
-    GPU_blend_set_func_separate(
-        GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
     GPU_blend(false);
   }
 
diff --git a/source/blender/editors/animation/anim_channels_defines.c 
b/source/blender/editors/animation/anim_channels_defines.c
index 53401e0c05a..aa5dffffe36 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -4386,8 +4386,7 @@ void ANIM_channel_draw(
   }
 
   /* set blending again, as may not be set in previous step */
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
   GPU_blend(true);
 
   /* step 1) draw backdrop ...........................................  */
diff --git a/source/blender/editors/animation/anim_draw.c 
b/source/blender/editors/animation/anim_draw.c
index b2f687b49af..16c6638b6d9 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -98,8 +98,7 @@ 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_set_func_separate(
-        GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
     GPU_blend(true);
 
     GPUVertFormat *format = immVertexFormat();
@@ -133,8 +132,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, 
int end_frame_width)
 void ANIM_draw_framerange(Scene *scene, View2D *v2d)
 {
   /* draw darkened area outside of active timeline frame range */
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
   GPU_blend(true);
 
   GPUVertFormat *format = immVertexFormat();
diff --git a/source/blender/editors/animation/anim_markers.c 
b/source/blender/editors/animation/anim_markers.c
index bcdbf4c74f0..4e4e6b38342 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -500,8 +500,7 @@ static void draw_marker(
   marker_color_get(marker, text_color, line_color);
 
   GPU_blend(true);
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
 
   draw_marker_line(line_color, xpos, UI_DPI_FAC * 20, region_height);
 
@@ -530,8 +529,7 @@ static void draw_markers_background(rctf *rect)
   immUniformColor4ubv(shade);
 
   GPU_blend(true);
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(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 edc36326c57..8c2c01c60de 100644
--- a/source/blender/editors/animation/time_scrub_ui.c
+++ b/source/blender/editors/animation/time_scrub_ui.c
@@ -67,8 +67,7 @@ static void draw_background(const rcti *rect)
   immUniformThemeColor(TH_TIME_SCRUB_BACKGROUND);
 
   GPU_blend(true);
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(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 df479325027..e0e8f72fd16 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -734,8 +734,7 @@ static void annotation_draw_data(
   GPU_line_smooth(true);
 
   /* turn on alpha-blending */
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
   GPU_blend(true);
 
   /* Do not write to depth (avoid self-occlusion). */
diff --git a/source/blender/editors/gpencil/annotate_paint.c 
b/source/blender/editors/gpencil/annotate_paint.c
index 30e4fe0b531..52c6dcc5f77 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -1701,8 +1701,7 @@ static void annotation_draw_eraser(bContext *UNUSED(C), 
int x, int y, void *p_pt
 
     GPU_line_smooth(true);
     GPU_blend(true);
-    GPU_blend_set_func_separate(
-        GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func_separate(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 680e7b37d31..81999bc7721 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2269,8 +2269,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int 
x, int y, void *p_ptr)
 
     GPU_line_smooth(true);
     GPU_blend(true);
-    GPU_blend_set_func_separate(
-        GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func_separate(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 5aae10a5db5..aa3b6991a82 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1761,8 +1761,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, 
int y)
 
   GPU_line_smooth(true);
   GPU_blend(true);
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(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.c 
b/source/blender/editors/interface/interface.c
index 478ef216421..fc4bf1b5636 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1891,8 +1891,7 @@ void UI_block_draw(const bContext *C, uiBlock *block)
   }
 
   /* we set this only once */
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
 
   /* scale fonts */
   ui_fontscale(&style.paneltitle.points, block->aspect);
diff --git a/source/blender/editors/interface/interface_draw.c 
b/source/blender/editors/interface/interface_draw.c
index 0a40c39851a..4cb2b16910e 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -754,7 +754,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
 
   GPU_blend(true);
   /* Combine with premultiplied alpha. */
-  GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT);
 
   if (w != ibuf->x || h != ibuf->y) {
     /* We scale the bitmap, rather than have OGL do a worse job. */
@@ -782,8 +782,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region),
 
   GPU_blend(false);
   /* Reset default. */
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
 
 #  if 0
   // restore scissortest
@@ -832,8 +831,7 @@ void UI_draw_safe_areas(uint pos,
 
 static void draw_scope_end(const rctf *rect)
 {
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
 
   /* outline */
   UI_draw_roundbox_corner_set(UI_CNR_ALL);
@@ -863,7 +861,7 @@ static void histogram_draw_one(float r,
   }
 
   GPU_line_smooth(true);
-  GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE, GPU_ONE, GPU_ONE);
+  GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE);
 
   immUniformColor4fv(color);
 
@@ -893,8 +891,7 @@ static void histogram_draw_one(float r,
     /* curve outline */
     immUniformColor4f(0.0f, 0.0f, 0.0f, 0.25f);
 
-    GPU_blend_set_func_separate(
-        GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
     immBegin(GPU_PRIM_LINE_STRIP, res);
     for (int i = 0; i < res; i++) {
       float x2 = x + i * (w / (float)res);
@@ -928,8 +925,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region),
   float h = BLI_rctf_size_y(&rect) * hist->ymax;
 
   GPU_blend(true);
-  GPU_blend_set_func_separate(
-      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, 
GPU_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(GPU_BLEND_ALPHA);
 
   float color[4];
   UI_GetThemeColor4fv(TH_PREVIEW_BACK, color);
@@ -1072,8 +1068,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
   BLF_batch_draw_flush();
 
   GPU_blend(true);

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to