[Bf-blender-cvs] [acad0d75b14] master: Cleanup: GPU: Replace glBlendFunc by GPU equivalent

Clément Foucault noreply at git.blender.org
Sat Jul 18 03:08:14 CEST 2020


Commit: acad0d75b1448550c863ac8002bba4284d30d10d
Author: Clément Foucault
Date:   Thu Jul 16 18:08:21 2020 +0200
Branches: master
https://developer.blender.org/rBacad0d75b1448550c863ac8002bba4284d30d10d

Cleanup: GPU: Replace glBlendFunc by GPU equivalent

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

M	source/blender/editors/gpencil/gpencil_utils.c
M	source/blender/editors/interface/interface_draw.c
M	source/blender/editors/screen/area.c
M	source/blender/windowmanager/intern/wm_gesture.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_playanim.c

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

diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index a695d2e4cf2..579b5929c15 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1761,7 +1761,8 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y)
 
   GPU_line_smooth(true);
   GPU_blend(true);
-  glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func_separate(
+      GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_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 720a5bcff37..98419b0b0ac 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -867,7 +867,7 @@ static void histogram_draw_one(float r,
   }
 
   GPU_line_smooth(true);
-  glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE);
+  GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE, GPU_ONE, GPU_ONE);
 
   immUniformColor4fv(color);
 
@@ -1168,7 +1168,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region),
   }
 
   if (scopes->ok && scopes->waveform_1 != NULL) {
-    glBlendFunc(GL_ONE, GL_ONE);
+    GPU_blend_set_func(GPU_ONE, GPU_ONE);
     GPU_point_size(1.0);
 
     /* LUMA (1 channel) */
@@ -1468,7 +1468,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region),
     /* pixel point cloud */
     float col[3] = {alpha, alpha, alpha};
 
-    glBlendFunc(GL_ONE, GL_ONE);
+    GPU_blend_set_func(GPU_ONE, GPU_ONE);
     GPU_point_size(1.0);
 
     GPU_matrix_push();
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index d8859ec8532..f87f631c643 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -135,7 +135,7 @@ static void region_draw_emboss(const ARegion *region, const rcti *scirct, int si
   immUnbindProgram();
 
   GPU_blend(false);
-  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+  GPU_blend_set_func(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
 }
 
 void ED_region_pixelspace(ARegion *region)
diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c
index 6b2a74138c9..52c934424e4 100644
--- a/source/blender/windowmanager/intern/wm_gesture.c
+++ b/source/blender/windowmanager/intern/wm_gesture.c
@@ -355,7 +355,7 @@ static void draw_filled_lasso(wmGesture *gt)
 
     /* Additive Blending */
     GPU_blend(true);
-    glBlendFunc(GL_ONE, GL_ONE);
+    GPU_blend_set_func(GPU_ONE, GPU_ONE);
 
     GLint unpack_alignment;
     glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment);
@@ -387,7 +387,7 @@ static void draw_filled_lasso(wmGesture *gt)
     MEM_freeN(pixel_buf);
 
     GPU_blend(false);
-    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA);
   }
 
   MEM_freeN(mcoords);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index cb5a039765a..aa3f11c2515 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -351,7 +351,7 @@ void WM_init(bContext *C, int argc, const char **argv)
   BKE_material_copybuf_clear();
   ED_render_clear_mtex_copybuf();
 
-  // glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+  // GPU_blend_set_func(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
 
   wm_history_file_read();
 
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 50d2b4dd49e..bdc61153f07 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -316,7 +316,8 @@ static void playanim_toscreen(
   /* checkerboard for case alpha */
   if (ibuf->planes == 32) {
     GPU_blend(true);
-    glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+    GPU_blend_set_func_separate(
+        GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
 
     imm_draw_box_checker_2d_ex(offs_x,
                                offs_y,



More information about the Bf-blender-cvs mailing list