From bf1b622dd962416fef94ccb2f47878eced31e20d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Foucault?= Date: Sun, 16 Aug 2020 15:38:34 +0200 Subject: GPUState: GPU_blend final API renaming We now use GPU_blend for enabling / disabling blending and explicitly set the blend equation. --- source/blender/blenfont/intern/blf_font.c | 6 +- source/blender/draw/intern/draw_manager.c | 8 +- source/blender/draw/intern/draw_view.c | 4 +- .../editors/animation/anim_channels_defines.c | 6 +- source/blender/editors/animation/anim_draw.c | 12 +-- source/blender/editors/animation/anim_markers.c | 12 +-- source/blender/editors/animation/keyframes_draw.c | 4 +- source/blender/editors/animation/time_scrub_ui.c | 6 +- source/blender/editors/curve/editcurve_paint.c | 4 +- .../gizmo_library/gizmo_types/arrow3d_gizmo.c | 8 +- .../gizmo_library/gizmo_types/button2d_gizmo.c | 8 +- .../gizmo_library/gizmo_types/cage2d_gizmo.c | 8 +- .../gizmo_library/gizmo_types/cage3d_gizmo.c | 8 +- .../gizmo_library/gizmo_types/dial3d_gizmo.c | 4 +- .../gizmo_library/gizmo_types/move3d_gizmo.c | 12 +-- .../gizmo_library/gizmo_types/primitive3d_gizmo.c | 8 +- source/blender/editors/gpencil/annotate_draw.c | 8 +- source/blender/editors/gpencil/annotate_paint.c | 10 +- source/blender/editors/gpencil/gpencil_fill.c | 4 +- source/blender/editors/gpencil/gpencil_paint.c | 6 +- source/blender/editors/gpencil/gpencil_utils.c | 14 +-- source/blender/editors/interface/interface.c | 2 +- source/blender/editors/interface/interface_draw.c | 96 +++++++++---------- source/blender/editors/interface/interface_icons.c | 20 ++-- source/blender/editors/interface/interface_panel.c | 22 ++--- .../editors/interface/interface_region_search.c | 24 ++--- .../blender/editors/interface/interface_widgets.c | 106 ++++++++++----------- source/blender/editors/mask/mask_draw.c | 12 +-- source/blender/editors/mesh/editmesh_knife.c | 6 +- source/blender/editors/object/object_remesh.c | 4 +- source/blender/editors/physics/particle_edit.c | 4 +- source/blender/editors/screen/area.c | 30 +++--- source/blender/editors/screen/screen_draw.c | 20 ++-- source/blender/editors/sculpt_paint/paint_cursor.c | 18 ++-- source/blender/editors/sculpt_paint/paint_image.c | 4 +- source/blender/editors/sculpt_paint/paint_stroke.c | 4 +- source/blender/editors/space_action/action_draw.c | 8 +- .../editors/space_clip/clip_dopesheet_draw.c | 8 +- source/blender/editors/space_clip/clip_draw.c | 18 ++-- .../blender/editors/space_clip/clip_graph_draw.c | 4 +- source/blender/editors/space_clip/clip_utils.c | 6 +- source/blender/editors/space_file/file_draw.c | 8 +- source/blender/editors/space_graph/graph_draw.c | 26 ++--- source/blender/editors/space_graph/space_graph.c | 8 +- source/blender/editors/space_image/image_draw.c | 36 +++---- source/blender/editors/space_info/textview.c | 10 +- source/blender/editors/space_nla/nla_draw.c | 26 ++--- source/blender/editors/space_node/drawnode.c | 14 +-- source/blender/editors/space_node/node_draw.c | 34 +++---- .../blender/editors/space_outliner/outliner_draw.c | 24 ++--- .../editors/space_sequencer/sequencer_draw.c | 70 +++++++------- source/blender/editors/space_text/text_draw.c | 10 +- source/blender/editors/space_view3d/drawobject.c | 6 +- source/blender/editors/space_view3d/view3d_draw.c | 20 ++-- .../space_view3d/view3d_gizmo_navigate_type.c | 10 +- .../editors/space_view3d/view3d_gizmo_ruler.c | 18 ++-- .../editors/space_view3d/view3d_placement.c | 12 +-- source/blender/editors/transform/transform.c | 6 +- .../editors/transform/transform_constraints.c | 2 +- .../editors/transform/transform_draw_cursors.c | 4 +- .../blender/editors/transform/transform_gizmo_3d.c | 4 +- .../editors/transform/transform_mode_edge_slide.c | 6 +- .../editors/transform/transform_mode_vert_slide.c | 4 +- source/blender/editors/transform/transform_snap.c | 4 +- source/blender/editors/uvedit/uvedit_draw.c | 26 ++--- .../blender/editors/uvedit/uvedit_smart_stitch.c | 4 +- source/blender/gpu/GPU_state.h | 2 +- source/blender/gpu/intern/gpu_state.cc | 12 +-- source/blender/windowmanager/intern/wm_dragdrop.c | 4 +- source/blender/windowmanager/intern/wm_draw.c | 6 +- source/blender/windowmanager/intern/wm_gesture.c | 14 +-- source/blender/windowmanager/intern/wm_operators.c | 4 +- source/blender/windowmanager/intern/wm_playanim.c | 6 +- 73 files changed, 503 insertions(+), 513 deletions(-) diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 2a6bc41704b..7febfb5d3d5 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -221,8 +221,8 @@ void blf_batch_draw(void) return; } - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); #ifndef BLF_STANDALONE /* We need to flush widget base first to ensure correct ordering. */ @@ -238,7 +238,7 @@ void blf_batch_draw(void) GPU_batch_uniform_1i(g_batch.batch, "glyph", 0); GPU_batch_draw(g_batch.batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* restart to 1st vertex data pointers */ GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.pos_loc, &g_batch.pos_step); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index fd57934b8e5..4e8b931f6a6 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -1595,8 +1595,8 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, GPU_clear_color(0.0f, 0.0f, 0.0f, 1.0f); GPU_clear(GPU_COLOR_BIT); /* Premult Alpha over black background. */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA); } GPU_matrix_identity_set(); @@ -1606,8 +1606,8 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, if (draw_background) { /* Reset default. */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(false); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_NONE); } /* Free temporary viewport. */ diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c index 1458ff5341c..0dc35d44788 100644 --- a/source/blender/draw/intern/draw_view.c +++ b/source/blender/draw/intern/draw_view.c @@ -123,7 +123,7 @@ void DRW_draw_cursor(void) /* Draw nice Anti Aliased cursor. */ GPU_line_width(1.0f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); float eps = 1e-5f; @@ -188,7 +188,7 @@ void DRW_draw_cursor(void) GPU_batch_draw(cursor_batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); GPU_matrix_pop(); GPU_matrix_projection_set(original_proj); diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index aa5dffffe36..656ff844948 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -4386,8 +4386,8 @@ void ANIM_channel_draw( } /* set blending again, as may not be set in previous step */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* step 1) draw backdrop ........................................... */ if (acf->draw_backdrop) { @@ -4436,7 +4436,7 @@ void ANIM_channel_draw( } /* turn off blending, since not needed anymore... */ - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* icon is drawn as widget now... */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) { diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 16c6638b6d9..0bebc25863b 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -98,8 +98,8 @@ 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_BLEND_ALPHA); - GPU_blend(true); + 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); @@ -120,7 +120,7 @@ void ANIM_draw_previewrange(const bContext *C, View2D *v2d, int end_frame_width) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -132,8 +132,8 @@ 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_BLEND_ALPHA); - GPU_blend(true); + 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); @@ -149,7 +149,7 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* thin lines where the actual frames are */ immUniformThemeColorShade(TH_BACK, -60); diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 4e4e6b38342..5f755b9f4d9 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -499,15 +499,15 @@ static void draw_marker( marker_color_get(marker, text_color, line_color); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); draw_marker_line(line_color, xpos, UI_DPI_FAC * 20, region_height); int icon_id = marker_get_icon_id(marker, flag); UI_icon_draw(xpos - 0.55f * UI_DPI_ICON_SIZE, UI_DPI_FAC * 18, icon_id); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); float name_y = UI_DPI_FAC * 18; /* Give an offset to the marker name when selected, @@ -528,12 +528,12 @@ static void draw_markers_background(rctf *rect) immUniformColor4ubv(shade); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index c69f3ce3e3a..4d6d7fa3ad5 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -692,7 +692,7 @@ static void draw_keylist(View2D *v2d, const float smaller_sz = 0.35f * icon_sz; const float ipo_sz = 0.1f * icon_sz; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */ /* TODO: allow this opacity factor to be themed? */ @@ -848,7 +848,7 @@ static void draw_keylist(View2D *v2d, } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* *************************** Channel Drawing Funcs *************************** */ diff --git a/source/blender/editors/animation/time_scrub_ui.c b/source/blender/editors/animation/time_scrub_ui.c index 8c2c01c60de..1690c9e3bba 100644 --- a/source/blender/editors/animation/time_scrub_ui.c +++ b/source/blender/editors/animation/time_scrub_ui.c @@ -66,12 +66,12 @@ static void draw_background(const rcti *rect) immUniformThemeColor(TH_TIME_SCRUB_BACKGROUND); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index ebad1995717..2dac273501d 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -420,7 +420,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); GPU_depth_test(false); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); GPU_line_width(3.0f); @@ -442,7 +442,7 @@ static void curve_draw_stroke_3d(const struct bContext *UNUSED(C), /* Reset defaults */ GPU_depth_test(true); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); immUnbindProgram(); diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c index 341f43d0662..d4d9f9bf424 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c @@ -195,9 +195,9 @@ static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool GPU_matrix_push(); GPU_matrix_mul(matrix_final); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); arrow_draw_geom(arrow, select, color); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); @@ -207,9 +207,9 @@ static void arrow_draw_intern(ArrowGizmo3D *arrow, const bool select, const bool GPU_matrix_push(); GPU_matrix_mul(inter->init_matrix_final); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); arrow_draw_geom(arrow, select, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); } diff --git a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c index ef3381110d4..13f3903f0b2 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/button2d_gizmo.c @@ -195,7 +195,7 @@ static void button2d_draw_intern(const bContext *C, } else { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); if (draw_options & ED_GIZMO_BUTTON_SHOW_BACKDROP) { const float fill_alpha = RNA_float_get(gz->ptr, "backdrop_fill_alpha"); @@ -265,7 +265,7 @@ static void button2d_draw_intern(const bContext *C, UI_icon_draw_alpha(pos[0], pos[1], button->icon, alpha); GPU_polygon_smooth(true); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (need_to_pop) { @@ -283,9 +283,9 @@ static void gizmo_button2d_draw(const bContext *C, wmGizmo *gz) { const bool is_highlight = (gz->state & WM_GIZMO_STATE_HIGHLIGHT) != 0; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); button2d_draw_intern(C, gz, false, is_highlight); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static int gizmo_button2d_test_select(bContext *C, wmGizmo *gz, const int mval[2]) diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c index 406d66dfd8f..be5f488d759 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage2d_gizmo.c @@ -626,14 +626,14 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz, /* Handy for quick testing draw (if it's outside bounds). */ if (false) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); float s = 0.5f; immRectf(pos, -s, -s, s, s); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (select) { @@ -722,7 +722,7 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz, float color[4], black[3] = {0, 0, 0}; gizmo_color_get(gz, highlight, color); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); float outline_line_width = gz->line_width + 3.0f; cage2d_draw_circle_wire(&r, margin, black, transform_flag, draw_options, outline_line_width); @@ -732,7 +732,7 @@ static void gizmo_cage2d_draw_intern(wmGizmo *gz, cage2d_draw_circle_handles(&r, margin, color, transform_flag, true); cage2d_draw_circle_handles(&r, margin, (const float[3]){0, 0, 0}, transform_flag, false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else { BLI_assert(0); diff --git a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c index 0bc65fe10a5..644a4247d84 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/cage3d_gizmo.c @@ -303,14 +303,14 @@ static void gizmo_cage3d_draw_intern( /* Handy for quick testing draw (if it's outside bounds). */ if (false) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); immUniformColor4fv((const float[4]){1, 1, 1, 0.5f}); float s = 0.5f; immRectf(pos, -s, -s, s, s); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (select) { @@ -382,7 +382,7 @@ static void gizmo_cage3d_draw_intern( float color[4], black[3] = {0, 0, 0}; gizmo_color_get(gz, highlight, color); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); cage3d_draw_circle_wire( size_real, margin, black, transform_flag, draw_options, gz->line_width + 3.0f); @@ -395,7 +395,7 @@ static void gizmo_cage3d_draw_intern( cage3d_draw_circle_handles(rv3d, matrix_final, size_real, margin, color, true, 40); GPU_polygon_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else { BLI_assert(0); diff --git a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c index 5d7c3a9e717..e1860d5d0fd 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/dial3d_gizmo.c @@ -482,9 +482,9 @@ static void gizmo_dial_draw(const bContext *C, wmGizmo *gz) clip_plane[3] += DIAL_CLIP_BIAS; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); dial_draw_intern(C, gz, false, is_highlight, clip_plane); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static int gizmo_dial_modal(bContext *C, diff --git a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c index db57a33f543..ad7036f4460 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/move3d_gizmo.c @@ -207,9 +207,9 @@ static void move3d_draw_intern(const bContext *C, GPU_matrix_mul(matrix_align); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); move_geom_draw(gz, color, select, draw_options); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); if (gz->interaction_data) { @@ -220,9 +220,9 @@ static void move3d_draw_intern(const bContext *C, GPU_matrix_mul(matrix_align); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); move_geom_draw(gz, (const float[4]){0.5f, 0.5f, 0.5f, 0.5f}, select, draw_options); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); } } @@ -240,9 +240,9 @@ static void gizmo_move_draw(const bContext *C, wmGizmo *gz) (void)is_modal; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); move3d_draw_intern(C, gz, false, is_highlight); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static int gizmo_move_modal(bContext *C, diff --git a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c index 48b2e3348c9..177687b6afd 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/primitive3d_gizmo.c @@ -96,9 +96,9 @@ static void gizmo_primitive_draw_intern(wmGizmo *gz, GPU_matrix_push(); GPU_matrix_mul(matrix_final); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); gizmo_primitive_draw_geom(color_inner, color_outer, draw_style); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); @@ -112,9 +112,9 @@ static void gizmo_primitive_draw_intern(wmGizmo *gz, GPU_matrix_push(); GPU_matrix_mul(inter->init_matrix_final); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); gizmo_primitive_draw_geom(color_inner, color_outer, draw_style); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); } diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index e0e8f72fd16..78f4df8f71a 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -734,8 +734,8 @@ static void annotation_draw_data( GPU_line_smooth(true); /* turn on alpha-blending */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + 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(); @@ -745,8 +745,8 @@ static void annotation_draw_data( annotation_draw_data_layers(gpd, offsx, offsy, winx, winy, cfra, dflag); /* turn off alpha blending, then smooth lines */ - GPU_blend(false); // alpha blending - GPU_line_smooth(false); // smooth lines + GPU_blend(GPU_BLEND_NONE); // alpha blending + GPU_line_smooth(false); // smooth lines GPU_depth_mask(prev_depth_mask); } diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 52c6dcc5f77..56f554e5b7c 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -1700,8 +1700,8 @@ static void annotation_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_pt immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + 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); @@ -1729,7 +1729,7 @@ static void annotation_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_pt immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } } @@ -1767,7 +1767,7 @@ static void annotation_draw_stabilizer(bContext *C, int x, int y, void *p_ptr) uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_width(1.25f); const float color[3] = {1.0f, 0.39f, 0.39f}; @@ -1792,7 +1792,7 @@ static void annotation_draw_stabilizer(bContext *C, int x, int y, void *p_ptr) immEnd(); /* Returns back all GPU settings */ - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); immUnbindProgram(); diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 9d99773348b..ae9146b3a6a 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -252,7 +252,7 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4]) tgpw.disable_fill = 1; tgpw.dflag |= (GP_DRAWFILLS_ONLY3D | GP_DRAWFILLS_NOSTATUS); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); bGPDlayer *gpl_active = BKE_gpencil_layer_active_get(gpd); BLI_assert(gpl_active != NULL); @@ -371,7 +371,7 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4]) } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* draw strokes in offscreen buffer */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 81999bc7721..251d1b22846 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -2268,8 +2268,8 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + 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); @@ -2297,7 +2297,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } } diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index aa3b6991a82..46de164f381 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -1760,8 +1760,8 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y) immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + 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); @@ -1789,7 +1789,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } @@ -1943,7 +1943,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Inner Ring: Color from UI panel */ immUniformColor4f(color[0], color[1], color[2], 0.8f); @@ -1962,13 +1962,13 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat immUniformColor4f(darkcolor[0], darkcolor[1], darkcolor[2], 0.8f); imm_draw_circle_wire_2d(pos, x, y, radius + 1, 40); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); /* Draw line for lazy mouse */ if ((last_mouse_position) && (brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP)) { GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); copy_v3_v3(color, brush->add_col); immUniformColor4f(color[0], color[1], color[2], 0.8f); @@ -1980,7 +1980,7 @@ static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdat last_mouse_position[1] + region->winrct.ymin); immEnd(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index fc4bf1b5636..c06c85e19d4 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1891,7 +1891,7 @@ void UI_block_draw(const bContext *C, uiBlock *block) } /* we set this only once */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(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 5614e802f75..8ebc8e60993 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -163,11 +163,11 @@ void UI_draw_roundbox_aa( GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float(*)[4]) & widget_params); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_batch_draw(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void UI_draw_roundbox_4fv( @@ -292,11 +292,11 @@ void UI_draw_roundbox_4fv( GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float(*)[4]) & widget_params); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_batch_draw(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } #if 0 @@ -479,14 +479,14 @@ void UI_draw_roundbox_shade_x(bool filled, .alpha_discard = 1.0f, }; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUBatch *batch = ui_batch_roundbox_widget_get(); GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE); GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float(*)[4]) & widget_params); GPU_batch_draw(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } #if 0 /* unused */ @@ -752,9 +752,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), GPU_scissor(rect->xmin, rect->ymin, w, h); # endif - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Combine with premultiplied alpha. */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); if (w != ibuf->x || h != ibuf->y) { /* We scale the bitmap, rather than have OGL do a worse job. */ @@ -780,9 +780,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), 1.0f, col); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* Reset default. */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); # if 0 // restore scissortest @@ -831,7 +831,7 @@ void UI_draw_safe_areas(uint pos, static void draw_scope_end(const rctf *rect) { - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* outline */ UI_draw_roundbox_corner_set(UI_CNR_ALL); @@ -861,7 +861,7 @@ static void histogram_draw_one(float r, } GPU_line_smooth(true); - GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE); + GPU_blend(GPU_BLEND_ADDITIVE); immUniformColor4fv(color); @@ -891,7 +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_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immBegin(GPU_PRIM_LINE_STRIP, res); for (int i = 0; i < res; i++) { float x2 = x + i * (w / (float)res); @@ -924,8 +924,8 @@ 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(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); float color[4]; UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); @@ -1067,8 +1067,8 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), /* Flush text cache before changing scissors. */ BLF_batch_draw_flush(); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); float color[4]; UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); @@ -1095,8 +1095,8 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), /* Flush text cache before drawing things on top. */ BLF_batch_draw_flush(); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + 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); @@ -1161,7 +1161,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), } if (scopes->ok && scopes->waveform_1 != NULL) { - GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE); + GPU_blend(GPU_BLEND_ADDITIVE); GPU_point_size(1.0); /* LUMA (1 channel) */ @@ -1257,7 +1257,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), /* outline */ draw_scope_end(&rect); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static float polar_to_x(float center, float diam, float ampli, float angle) @@ -1398,8 +1398,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha; - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); float color[4]; UI_GetThemeColor4fv(TH_PREVIEW_BACK, color); @@ -1463,7 +1463,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), /* pixel point cloud */ const float col[3] = {alpha, alpha, alpha}; - GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE); + GPU_blend(GPU_BLEND_ADDITIVE); GPU_point_size(1.0); GPU_matrix_push(); @@ -1482,7 +1482,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), /* outline */ draw_scope_end(&rect); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void ui_draw_colorband_handle_tri_hlight( @@ -1593,7 +1593,7 @@ static void ui_draw_colorband_handle(uint shdr_pos, shdr_pos, x - half_width, y1 - 1, x + half_width, y1 + height, false); /* draw all triangles blended */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); ui_draw_colorband_handle_tri(shdr_pos, x, y1 + height, half_width, half_width, true); @@ -1617,7 +1617,7 @@ static void ui_draw_colorband_handle(uint shdr_pos, immUniformColor3ub(0, 0, 0); ui_draw_colorband_handle_tri_hlight(shdr_pos, x, y1 + height, half_width, half_width); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUniformColor3ub(128, 128, 128); ui_draw_colorband_handle_box( @@ -1675,7 +1675,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR); /* layer: color ramp */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); CBData *cbd = coba->data; @@ -1723,7 +1723,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* New format */ format = immVertexFormat(); @@ -1735,7 +1735,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const imm_draw_box_wire_2d(pos_id, x1, y1, x1 + sizex, rect->ymax); /* layer: box outline */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); immBegin(GPU_PRIM_LINES, 2); @@ -1750,7 +1750,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const uiWidgetColors *UNUSED(wcol), const immVertex2f(pos_id, x1 + sizex, y1 - 1); immEnd(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* layer: draw handles */ for (int a = 0; a < coba->tot; a++, cbd++) { @@ -1815,10 +1815,10 @@ void ui_draw_but_UNITVEC(uiBut *but, const uiWidgetColors *wcol, const rcti *rec immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor3ubv(wcol->inner); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); imm_draw_circle_wire_2d(pos, 0.0f, 0.0f, 1.0f, 32); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); if (use_project_matrix) { @@ -1955,12 +1955,12 @@ 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(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + 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); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else { if (cumap->flag & CUMA_DO_CLIP) { @@ -2073,7 +2073,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, } immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Curve filled. */ immUniformColor3ubvAlpha(wcol->item, 128); @@ -2106,7 +2106,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, /* Reset state for fill & line. */ GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); /* The points, use aspect to make them visible on edges. */ @@ -2290,7 +2290,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region, /* Draw the triangles for the profile fill. */ immUniformColor3ubvAlpha((const uchar *)wcol->item, 128); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_polygon_smooth(false); immBegin(GPU_PRIM_TRIS, 3 * tot_triangles); for (i = 0; i < tot_triangles; i++) { @@ -2378,7 +2378,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region, /* Draw the control points. */ GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_point_size(max_ff(3.0f, min_ff(UI_DPI_FAC / but->block->aspect * 5.0f, 5.0f))); immBegin(GPU_PRIM_POINTS, tot_points); for (i = 0; i < tot_points; i++) { @@ -2392,7 +2392,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region, /* Draw the handle points. */ if (selected_free_points > 0) { GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_point_size(max_ff(2.0f, min_ff(UI_DPI_FAC / but->block->aspect * 4.0f, 4.0f))); immBegin(GPU_PRIM_POINTS, selected_free_points * 2); for (i = 0; i < tot_points; i++) { @@ -2459,8 +2459,8 @@ 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(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* need scissor test, preview image can draw outside of boundary */ int scissor[4]; @@ -2594,7 +2594,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region), /* outline */ draw_scope_end(&rect); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* ****************************************************** */ @@ -2675,7 +2675,7 @@ static void ui_shadowbox(uint pos, void UI_draw_box_shadow(uchar alpha, float minx, float miny, float maxx, float maxy) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -2695,7 +2695,7 @@ void UI_draw_box_shadow(uchar alpha, float minx, float miny, float maxx, float m immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void ui_draw_dropshadow( @@ -2721,7 +2721,7 @@ void ui_draw_dropshadow( a = i * aspect; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); const float dalpha = alpha * 2.0f / 255.0f; float calpha = dalpha; float visibility = 1.0f; @@ -2772,5 +2772,5 @@ void ui_draw_dropshadow( radius + 0.5f, color); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index b43b32aefb3..edf66d82cbc 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1595,7 +1595,7 @@ static void icon_draw_cache_flush_ex(bool only_full_caches) /* We need to flush widget base first to ensure correct ordering. */ UI_widgetbase_draw_cache_flush(); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); if (!only_full_caches || g_icon_draw_cache.normal.calls == ICON_DRAW_CACHE_SIZE) { icon_draw_cache_texture_flush_ex(icongltex.tex[0], &g_icon_draw_cache.normal); @@ -1605,7 +1605,7 @@ static void icon_draw_cache_flush_ex(bool only_full_caches) icon_draw_cache_texture_flush_ex(icongltex.tex[1], &g_icon_draw_cache.border); } - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } } @@ -1619,9 +1619,9 @@ void UI_icon_draw_cache_end(void) return; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); icon_draw_cache_flush_ex(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void icon_draw_texture_cached(float x, @@ -1689,7 +1689,7 @@ static void icon_draw_texture(float x, /* We need to flush widget base first to ensure correct ordering. */ UI_widgetbase_draw_cache_flush(); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); float x1, x2, y1, y2; @@ -1725,7 +1725,7 @@ static void icon_draw_texture(float x, GPU_texture_unbind(texture); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } /* Drawing size for preview images */ @@ -1813,9 +1813,9 @@ static void icon_draw_size(float x, di->data.geom.inverted = invert; } - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); icon_draw_rect(x, y, w, h, aspect, w, h, ibuf->rect, alpha, desaturate); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } else if (di->type == ICON_TYPE_EVENT) { const short event_type = di->data.input.event_type; @@ -1896,10 +1896,10 @@ static void icon_draw_size(float x, } /* Preview images use premultiplied alpha. */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); icon_draw_rect( x, y, w, h, aspect, pi->w[size], pi->h[size], pi->rect[size], alpha, desaturate); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } } else if (di->type == ICON_TYPE_GPLAYER) { diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d334007a097..a70bcd208ab 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1000,7 +1000,7 @@ void ui_draw_aligned_panel(uiStyle *style, /* Mimick the border between aligned box widgets for the bottom of the header. */ if (!(is_closed_x || is_closed_y)) { immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ubv(box_wcol->outline); immRectf(pos, rect->xmin, headrect.ymin - U.pixelsize, rect->xmax, headrect.ymin); @@ -1013,7 +1013,7 @@ void ui_draw_aligned_panel(uiStyle *style, rect->xmax, headrect.ymin - U.pixelsize - 1); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } } @@ -1025,7 +1025,7 @@ void ui_draw_aligned_panel(uiStyle *style, float y = headrect.ymax; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* draw with background color */ immUniformThemeColor(TH_PANEL_HEADER); @@ -1041,7 +1041,7 @@ void ui_draw_aligned_panel(uiStyle *style, immEnd(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } @@ -1055,7 +1055,7 @@ void ui_draw_aligned_panel(uiStyle *style, uchar col_title[4]; panel_title_color_get(show_background, col_title); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw_ex(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect), (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED, @@ -1064,7 +1064,7 @@ void ui_draw_aligned_panel(uiStyle *style, 0.0f, col_title, false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* horizontal title */ @@ -1134,7 +1134,7 @@ void ui_draw_aligned_panel(uiStyle *style, } immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Draw panel backdrop if it wasn't already been drawn by the single opaque round box earlier. * Note: Sub-panels blend with panels, so they can't be opaque. */ @@ -2366,7 +2366,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) /* draw the background */ if (is_alpha) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ubv(theme_col_tab_bg); } else { @@ -2383,7 +2383,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) } if (is_alpha) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUnbindProgram(); @@ -2403,7 +2403,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) const bool is_active = STREQ(category_id, category_id_active); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); #ifdef USE_FLAT_INACTIVE if (is_active) @@ -2479,7 +2479,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) /* main tab title */ BLF_draw(fontid, category_id_draw, category_draw_len); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* tab blackline remaining (last tab) */ pos = GPU_vertformat_attr_add( diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 2010d89165e..adb2c1c802f 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -592,15 +592,15 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region) /* indicate more */ if (data->items.more) { ui_searchbox_butrect(&rect, data, data->items.maxitem - 1); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw(rect.xmax - 18, rect.ymin - 7, ICON_TRIA_DOWN); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (data->items.offset) { ui_searchbox_butrect(&rect, data, 0); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw(rect.xmin, rect.ymax - 9, ICON_TRIA_UP); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } else { @@ -657,15 +657,15 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *region) /* indicate more */ if (data->items.more) { ui_searchbox_butrect(&rect, data, data->items.maxitem - 1); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (data->items.offset) { ui_searchbox_butrect(&rect, data, 0); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } @@ -953,15 +953,15 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe /* indicate more */ if (data->items.more) { ui_searchbox_butrect(&rect, data, data->items.maxitem - 1); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (data->items.offset) { ui_searchbox_butrect(&rect, data, 0); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 54838dcbdbb..e946aec2176 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -525,7 +525,7 @@ void UI_draw_anti_tria( /* Note: This won't give back the original color. */ draw_color[3] *= 1.0f / WIDGET_AA_JITTER; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -544,7 +544,7 @@ void UI_draw_anti_tria( immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* triangle 'icon' inside rect */ @@ -569,7 +569,7 @@ void UI_draw_anti_fan(float tri_array[][2], uint length, const float color[4]) copy_v4_v4(draw_color, color); draw_color[3] *= 2.0f / WIDGET_AA_JITTER; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -593,7 +593,7 @@ void UI_draw_anti_fan(float tri_array[][2], uint length, const float color[4]) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void widget_init(uiWidgetBase *wtb) @@ -1197,11 +1197,11 @@ void UI_widgetbase_draw_cache_end(void) BLI_assert(g_widget_base_batch.enabled == true); g_widget_base_batch.enabled = false; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* Disable cached/instanced drawing and enforce single widget drawing pipeline. @@ -1307,9 +1307,9 @@ static void widgetbase_draw_ex(uiWidgetBase *wtb, widgetbase_set_uniform_colors_ubv( wtb, inner_col1, inner_col2, outline_col, emboss_col, tria_col, show_alpha_checkers); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); draw_widgetbase_batch(wtb); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -1363,9 +1363,9 @@ static void widget_draw_icon( float aspect, height; if (but->flag & UI_BUT_ICON_PREVIEW) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); widget_draw_preview(icon, alpha, rect); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); return; } @@ -1401,7 +1401,7 @@ static void widget_draw_icon( } } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); if (icon && icon != ICON_BLANK1) { float ofs = 1.0f / aspect; @@ -1454,7 +1454,7 @@ static void widget_draw_icon( } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void widget_draw_submenu_tria(const uiBut *but, @@ -1475,9 +1475,9 @@ static void widget_draw_submenu_tria(const uiBut *but, BLI_rctf_init(&tria_rect, xs, xs + tria_width, ys, ys + tria_height); BLI_rctf_scale(&tria_rect, 0.4f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); ui_draw_anti_tria_rect(&tria_rect, 'h', col); } @@ -2022,9 +2022,9 @@ static void widget_draw_text(const uiFontStyle *fstyle, if (drawstr[0] != 0) { /* We are drawing on top of widget bases. Flush cache. */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); if (but->selsta >= but->ofs) { selsta_draw = BLF_width(fstyle->uifont_id, drawstr + but->ofs, but->selsta - but->ofs); @@ -2069,9 +2069,9 @@ static void widget_draw_text(const uiFontStyle *fstyle, t = 0; } /* We are drawing on top of widget bases. Flush cache. */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); uint pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); @@ -2266,9 +2266,9 @@ static void widget_draw_node_link_socket(const uiWidgetColors *wcol, rgba_uchar_to_float(col, but->col); col[3] *= alpha; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); ED_node_socket_draw(but->custom_data, rect, col, scale); } @@ -2327,9 +2327,9 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle, /* draw icon in rect above the space reserved for the label */ rect->ymin += text_size; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); widget_draw_preview(icon, alpha, rect); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* offset rect to draw label in */ rect->ymin -= text_size; @@ -2784,15 +2784,15 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir rect->ymax += 0.1f * U.widget_unit; } - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); widget_softshadow(rect, roundboxalign, wcol->roundness * U.widget_unit); round_box_edges(&wtb, roundboxalign, rect, wcol->roundness * U.widget_unit); wtb.draw_emboss = false; widgetbase_draw(&wtb, wcol); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void ui_hsv_cursor(float x, float y) @@ -2804,11 +2804,11 @@ static void ui_hsv_cursor(float x, float y) immUniformColor3f(1.0f, 1.0f, 1.0f); imm_draw_circle_fill_2d(pos, x, y, 3.0f * U.pixelsize, 8); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); immUniformColor3f(0.0f, 0.0f, 0.0f); imm_draw_circle_wire_2d(pos, x, y, 3.0f * U.pixelsize, 12); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); immUnbindProgram(); @@ -2936,7 +2936,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); immUniformColor3ubv(wcol->outline); @@ -2944,7 +2944,7 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, const uiWidgetColors *wcol, const immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); /* cursor */ @@ -3243,9 +3243,9 @@ static void ui_draw_but_HSV_v(uiBut *but, const rcti *rect) })); /* We are drawing on top of widget bases. Flush cache. */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* cursor */ x = rect->xmin + 0.5f * BLI_rcti_size_x(rect); @@ -3269,7 +3269,7 @@ static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol) uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ubv(col); GPU_line_width(1.0f); @@ -3278,7 +3278,7 @@ static void ui_draw_separator(const rcti *rect, const uiWidgetColors *wcol) immVertex2f(pos, rect->xmax, y); immEnd(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } @@ -3836,9 +3836,9 @@ static void widget_swatch( bw += (bw < 0.5f) ? 0.5f : -0.5f; /* We are drawing on top of widget bases. Flush cache. */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -4200,9 +4200,9 @@ static void widget_tab(uiWidgetColors *wcol, rcti *rect, int state, int roundbox widgetbase_draw(&wtb, wcol); /* We are drawing on top of widget bases. Flush cache. */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_widgetbase_draw_cache_flush(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); #ifdef USE_TAB_SHADED_HIGHLIGHT /* draw outline (3d look) */ @@ -4817,12 +4817,12 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu } if (disabled) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); } wt->text(fstyle, &wt->wcol, but, rect); if (disabled) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } @@ -4905,7 +4905,7 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, rect->xmax - unit_size) : BLI_rcti_cent_x(rect); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Extracted from 'widget_menu_back', keep separate to avoid menu changes breaking popovers */ { @@ -4929,7 +4929,7 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, const int sign = is_down ? 1 : -1; float y = is_down ? rect->ymax : rect->ymin; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immBegin(GPU_PRIM_TRIS, 3); immUniformColor4ub(UNPACK3(wcol->outline), 166); immVertex2f(pos, cent_x - unit_half, y); @@ -4939,7 +4939,7 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, y = y - sign * round(U.pixelsize * 1.41); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immBegin(GPU_PRIM_TRIS, 3); immUniformColor4ub(0, 0, 0, 0); immVertex2f(pos, cent_x - unit_half, y); @@ -4947,7 +4947,7 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, immVertex2f(pos, cent_x, y + sign * unit_half); immEnd(); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immBegin(GPU_PRIM_TRIS, 3); immUniformColor4ubv(wcol->inner); immVertex2f(pos, cent_x - unit_half, y); @@ -4958,7 +4958,7 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol, immUnbindProgram(); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void ui_draw_popover_back(struct ARegion *region, @@ -5059,7 +5059,7 @@ void ui_draw_pie_center(uiBlock *block) GPU_matrix_push(); GPU_matrix_translate_2f(cx, cy); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); if (btheme->tui.wcol_pie_menu.shaded) { uchar col1[4], col2[4]; shadecolors4(col1, @@ -5142,7 +5142,7 @@ void ui_draw_pie_center(uiBlock *block) false); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); } @@ -5163,10 +5163,10 @@ static void ui_draw_widget_back_color(uiWidgetTypeEnum type, uiWidgetType *wt = widget_type(type); if (use_shadow) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); widget_softshadow(rect, UI_CNR_ALL, 0.25f * U.widget_unit); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } rcti rect_copy = *rect; @@ -5289,10 +5289,10 @@ void ui_draw_menu_item(const uiFontStyle *fstyle, height = ICON_SIZE_FROM_BUTRECT(rect); aspect = ICON_DEFAULT_HEIGHT / height; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* XXX scale weak get from fstyle? */ UI_icon_draw_ex(xs, ys, iconid, aspect, 1.0f, 0.0f, wt->wcol.text, false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* part text right aligned */ @@ -5328,9 +5328,9 @@ void ui_draw_preview_item( /* draw icon in rect above the space reserved for the label */ rect->ymin += text_size; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); widget_draw_preview(iconid, 1.0f, rect); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); BLF_width_and_height( fstyle->uifont_id, name, BLF_DRAW_STR_DUMMY_MAX, &font_dims[0], &font_dims[1]); diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index a4f43650c3b..b5db7b3d37e 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -594,8 +594,8 @@ static void draw_mask_layers(const bContext *C, const int width, const int height) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPU_program_point_size(true); MaskLayer *mask_layer; @@ -632,7 +632,7 @@ static void draw_mask_layers(const bContext *C, } GPU_program_point_size(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void ED_mask_draw(const bContext *C, const char draw_flag, const char draw_type) @@ -739,8 +739,8 @@ void ED_mask_draw_region( if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) { /* More blending types could be supported in the future. */ - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_MULTIPLY); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_MULTIPLY); } GPU_matrix_push(); @@ -757,7 +757,7 @@ void ED_mask_draw_region( GPU_matrix_pop(); if (overlay_mode != MASK_OVERLAY_ALPHACHANNEL) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } MEM_freeN(buffer); diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 684350a15a6..1c1b69ca719 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1128,8 +1128,8 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v int i, snapped_verts_count, other_verts_count; float fcol[4]; - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPUVertBuf *vert = GPU_vertbuf_create_with_format(format); GPU_vertbuf_data_alloc(vert, kcd->totlinehit); @@ -1165,7 +1165,7 @@ static void knifetool_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), v GPU_batch_discard(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (kcd->totkedge > 0) { diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c index 8d8f01dd61a..f14c734da4e 100644 --- a/source/blender/editors/object/object_remesh.c +++ b/source/blender/editors/object/object_remesh.c @@ -294,7 +294,7 @@ static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), { VoxelSizeEditCustomData *cd = arg; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); uint pos3d = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); @@ -363,7 +363,7 @@ static void voxel_size_edit_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), GPU_matrix_pop(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 488bb7121a2..eb7ddfefb9c 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3213,11 +3213,11 @@ static void brush_drawcursor(bContext *C, int x, int y, void *UNUSED(customdata) immUniformColor4ub(255, 255, 255, 128); GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); imm_draw_circle_wire_2d(pos, (float)x, (float)y, pe_brush_size_get(scene, brush), 40); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); immUnbindProgram(); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 33632bbb0c3..784a933d494 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -93,8 +93,8 @@ static void region_draw_emboss(const ARegion *region, const rcti *scirct, int si rect.ymax = scirct->ymax - region->winrct.ymin; /* set transp line */ - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); float color[4] = {0.0f, 0.0f, 0.0f, 0.25f}; UI_GetThemeColor3fv(TH_EDITOR_OUTLINE, color); @@ -133,7 +133,7 @@ static void region_draw_emboss(const ARegion *region, const rcti *scirct, int si immEnd(); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void ED_region_pixelspace(ARegion *region) @@ -246,7 +246,7 @@ static void draw_azone_arrow(float x1, float y1, float x2, float y2, AZEdge edge GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* NOTE(fclem): There is something strange going on with Mesa and GPU_SHADER_2D_UNIFORM_COLOR * that causes a crash on some GPUs (see T76113). Using 3D variant avoid the issue. */ immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -264,12 +264,12 @@ static void draw_azone_arrow(float x1, float y1, float x2, float y2, AZEdge edge immEnd(); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void region_draw_azone_tab_arrow(ScrArea *area, ARegion *region, AZone *az) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* add code to draw region hidden as 'too small' */ switch (az->edge) { @@ -310,8 +310,8 @@ static void region_draw_azones(ScrArea *area, ARegion *region) } GPU_line_width(1.0f); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPU_matrix_push(); GPU_matrix_translate_2f(-region->winrct.xmin, -region->winrct.ymin); @@ -346,7 +346,7 @@ static void region_draw_azones(ScrArea *area, ARegion *region) GPU_matrix_pop(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void region_draw_status_text(ScrArea *area, ARegion *region) @@ -375,7 +375,7 @@ static void region_draw_status_text(ScrArea *area, ARegion *region) const float y1 = pad; const float y2 = region->winy - pad; - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); float color[4] = {0.0f, 0.0f, 0.0f, 0.5f}; UI_GetThemeColor3fv(TH_BACK, color); @@ -544,7 +544,7 @@ void ED_region_do_draw(bContext *C, ARegion *region) /* for debugging unneeded area redraws and partial redraw */ if (G.debug_value == 888) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -555,7 +555,7 @@ void ED_region_do_draw(bContext *C, ARegion *region) region->drawrct.xmax - region->winrct.xmin, region->drawrct.ymax - region->winrct.ymin); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } memset(®ion->drawrct, 0, sizeof(region->drawrct)); @@ -3269,15 +3269,15 @@ void ED_region_info_draw_multiline(ARegion *region, GPU_scissor_get(scissor); GPU_scissor(rect.xmin, rect.ymin, BLI_rcti_size_x(&rect) + 1, BLI_rcti_size_y(&rect) + 1); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4fv(fill_color); immRecti(pos, rect.xmin, rect.ymin, rect.xmax + 1, rect.ymax + 1); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* text */ UI_FontThemeColor(fontid, TH_TEXT_HI); diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 129c8015c01..a9e38244f62 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -296,7 +296,7 @@ static GPUBatch *batch_screen_edges_get(int *corner_len) */ static void scrarea_draw_shape_dark(ScrArea *area, char dir, uint pos) { - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ub(0, 0, 0, 50); draw_join_shape(area, dir, pos); @@ -307,7 +307,7 @@ static void scrarea_draw_shape_dark(ScrArea *area, char dir, uint pos) */ static void scrarea_draw_shape_light(ScrArea *area, char UNUSED(dir), uint pos) { - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ub(255, 255, 255, 25); immRectf(pos, area->v1->vec.x, area->v1->vec.y, area->v3->vec.x, area->v3->vec.y); @@ -410,8 +410,8 @@ void ED_screen_draw_edges(wmWindow *win) corner_scale = U.pixelsize * 8.0f; edge_thickness = corner_scale * 0.21f; - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPUBatch *batch = batch_screen_edges_get(&verts_per_corner); GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_AREA_EDGES); @@ -423,7 +423,7 @@ void ED_screen_draw_edges(wmWindow *win) drawscredge_area(area, winsize_x, winsize_y, edge_thickness); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); if (U.pixelsize <= 1.0f) { GPU_scissor_test(false); @@ -466,12 +466,12 @@ void ED_screen_draw_join_shape(ScrArea *sa1, ScrArea *sa2) break; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); scrarea_draw_shape_dark(sa2, dir, pos); scrarea_draw_shape_light(sa1, dira, pos); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUnbindProgram(); @@ -483,8 +483,8 @@ void ED_screen_draw_split_preview(ScrArea *area, const int dir, const float fac) immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* splitpoint */ - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor4ub(255, 255, 255, 100); @@ -526,7 +526,7 @@ void ED_screen_draw_split_preview(ScrArea *area, const int dir, const float fac) immEnd(); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index a80339d4cf7..bb4139cc510 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -634,8 +634,8 @@ static bool paint_draw_tex_overlay(UnifiedPaintSettings *ups, uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); /* Premultiplied alpha blending. */ - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -727,8 +727,8 @@ static bool paint_draw_cursor_overlay( uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); uint texCoord = GPU_vertformat_attr_add(format, "texCoord", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); immBindBuiltinProgram(GPU_SHADER_2D_IMAGE_COLOR); @@ -918,7 +918,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) PaintCurvePoint *cp = pc->points; GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Draw the bezier handles and the curve segment between the current and next point. */ uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -979,7 +979,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) draw_rect_point( pos, selec_col, handle_col, &cp->bez.vec[2][0], 8.0f, cp->bez.f3 || cp->bez.f2); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); immUnbindProgram(); @@ -1835,7 +1835,7 @@ static void paint_cursor_update_anchored_location(PaintCursorContext *pcontext) static void paint_cursor_setup_2D_drawing(PaintCursorContext *pcontext) { GPU_line_width(2.0f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); pcontext->pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -1845,7 +1845,7 @@ static void paint_cursor_setup_2D_drawing(PaintCursorContext *pcontext) static void paint_cursor_setup_3D_drawing(PaintCursorContext *pcontext) { GPU_line_width(2.0f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); pcontext->pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); @@ -1855,7 +1855,7 @@ static void paint_cursor_setup_3D_drawing(PaintCursorContext *pcontext) static void paint_cursor_restore_drawing_state(void) { immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 431ab998f62..d2ae6912fc3 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -438,7 +438,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda if (pop) { GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); @@ -467,7 +467,7 @@ static void gradient_draw_line(bContext *UNUSED(C), int x, int y, void *customda immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } } diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 071042e6728..52cdebf3fd5 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -143,7 +143,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata if (stroke && brush) { GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); ARegion *region = stroke->vc.region; @@ -161,7 +161,7 @@ static void paint_draw_smooth_cursor(bContext *C, int x, int y, void *customdata immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } } diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index ada4243ab4e..8634e5a5f29 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -169,7 +169,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* first backdrop strips */ float ymax = ACHANNEL_FIRST_TOP(ac); @@ -276,7 +276,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region } } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* black line marking 'current frame' for Time-Slide transform mode */ if (saction->flag & SACTION_MOVING) { @@ -558,7 +558,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Iterate over pointcaches on the active object, and draw each one's range. */ float y_offset = 0.0f; @@ -577,7 +577,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene) y_offset += cache_draw_height; } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); BLI_freelistN(&pidlist); diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index c7328ae9f8f..8aaf3faffec 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -142,7 +142,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) strip[3] = 0.5f; selected_strip[3] = 1.0f; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); clip_draw_dopesheet_background(region, clip, pos_id); @@ -288,7 +288,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *region, Scene *scene) immUnbindProgram(); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -389,7 +389,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) PropertyRNA *chan_prop_lock = RNA_struct_type_find_property(&RNA_MovieTrackingTrack, "lock"); BLI_assert(chan_prop_lock); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); for (channel = dopesheet->channels.first; channel; channel = channel->next) { float yminc = (float)(y - CHANNEL_HEIGHT_HALF); float ymaxc = (float)(y + CHANNEL_HEIGHT_HALF); @@ -426,7 +426,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region) /* adjust y-position for next one */ y -= CHANNEL_STEP; } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); UI_block_end(C, block); UI_block_draw(C, block); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index d17041737e4..38c668acd37 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -153,8 +153,8 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip MovieTrackingPlaneTrack *act_plane_track = BKE_tracking_plane_track_get_active(&clip->tracking); MovieTrackingReconstruction *reconstruction = BKE_tracking_get_active_reconstruction(tracking); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* cache background */ ED_region_cache_draw_background(region); @@ -244,7 +244,7 @@ static void draw_movieclip_cache(SpaceClip *sc, ARegion *region, MovieClip *clip } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* current frame */ x = (sc->user.framenr - sfra) / (efra - sfra + 1) * region->winx; @@ -329,8 +329,8 @@ static void draw_movieclip_buffer(const bContext *C, /* checkerboard for case alpha */ if (ibuf->planes == 32) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); imm_draw_box_checker_2d(x, y, x + zoomx * ibuf->x, y + zoomy * ibuf->y); } @@ -344,7 +344,7 @@ static void draw_movieclip_buffer(const bContext *C, ED_draw_imbuf_ctx(C, ibuf, x, y, use_filter, zoomx * width / ibuf->x, zoomy * height / ibuf->y); if (ibuf->planes == 32) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (sc->flag & SC_SHOW_METADATA) { @@ -1210,8 +1210,8 @@ static void draw_plane_marker_image(Scene *scene, if (plane_track->image_opacity != 1.0f || ibuf->planes == 32) { transparent = true; - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } GPUTexture *texture = GPU_texture_create_nD(ibuf->x, @@ -1263,7 +1263,7 @@ static void draw_plane_marker_image(Scene *scene, GPU_texture_free(texture); if (transparent) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } diff --git a/source/blender/editors/space_clip/clip_graph_draw.c b/source/blender/editors/space_clip/clip_graph_draw.c index 277930495bd..4cf3e3e0798 100644 --- a/source/blender/editors/space_clip/clip_graph_draw.c +++ b/source/blender/editors/space_clip/clip_graph_draw.c @@ -192,7 +192,7 @@ static void draw_tracks_motion_and_error_curves(View2D *v2d, SpaceClip *sc, uint } /* Draw graph lines. */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); clip_graph_tracking_values_iterate(sc, (sc->flag & SC_SHOW_GRAPH_SEL_ONLY) != 0, (sc->flag & SC_SHOW_GRAPH_HIDDEN) != 0, @@ -200,7 +200,7 @@ static void draw_tracks_motion_and_error_curves(View2D *v2d, SpaceClip *sc, uint tracking_segment_point_cb, tracking_segment_start_cb, tracking_segment_end_cb); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* Selected knot handles on top of curves. */ if (draw_knots) { diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index 8e50c3f6774..0de1497a1af 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -415,8 +415,8 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) UI_view2d_view_ortho(v2d); /* currently clip editor supposes that editing clip length is equal to scene frame range */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -425,7 +425,7 @@ void clip_draw_sfra_efra(View2D *v2d, Scene *scene) immRectf(pos, v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax); immRectf(pos, (float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUniformThemeColorShade(TH_BACK, -60); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 88fd505d26d..51e6c99ff39 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -267,7 +267,7 @@ static void file_draw_preview(uiBlock *block, xco = sx + (int)dx; yco = sy - layout->prv_h + (int)dy; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* the large image */ @@ -290,7 +290,7 @@ static void file_draw_preview(uiBlock *block, if (!is_icon && typeflags & FILE_TYPE_BLENDERLIB) { /* Datablock preview images use premultiplied alpha. */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); @@ -308,7 +308,7 @@ static void file_draw_preview(uiBlock *block, 1.0f, col); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); if (icon && is_icon) { /* Small icon in the middle of large image, scaled to fit container and UI scale */ @@ -389,7 +389,7 @@ static void file_draw_preview(uiBlock *block, UI_but_drag_set_image(but, BLI_strdup(path), icon, imb, scale, true); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 677707602b2..0be3d8665cf 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -290,7 +290,7 @@ static void draw_fcurve_vertices(ARegion *region, uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_program_point_size(true); /* draw the two handles first (if they're shown, the curve doesn't @@ -303,7 +303,7 @@ static void draw_fcurve_vertices(ARegion *region, draw_fcurve_keyframe_vertices(fcu, v2d, !(fcu->flag & FCURVE_PROTECTED), pos); GPU_program_point_size(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* Handles ---------------- */ @@ -344,7 +344,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(true); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immBeginAtMost(GPU_PRIM_LINES, 4 * 2 * fcu->totvert); @@ -421,7 +421,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu) immEnd(); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(false); } @@ -474,7 +474,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu) if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(true); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -486,7 +486,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *region, FCurve *fcu) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(false); } @@ -1002,7 +1002,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(true); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); const uint shdr_pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -1034,7 +1034,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(false); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* This is called twice from space_graph.c -> graph_main_region_draw() @@ -1088,7 +1088,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, shor if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(true); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); const uint shdr_pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -1149,7 +1149,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceGraph *sipo, ARegion *region, shor if ((sipo->flag & SIPO_BEAUTYDRAW_OFF) == 0) { GPU_line_smooth(false); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* 2) draw handles and vertices as appropriate based on active @@ -1262,8 +1262,8 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) float ymax = ACHANNEL_FIRST_TOP(ac); /* set blending again, as may not be set in previous step */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); for (ale = anim_data.first; ale; ale = ale->next, ymax -= ACHANNEL_STEP(ac), channel_index++) { float ymin = ymax - ACHANNEL_HEIGHT(ac); @@ -1281,7 +1281,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) UI_block_end(C, block); UI_block_draw(C, block); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* free tempolary channels */ diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index a4f76384cc6..4e0f60544e6 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -249,7 +249,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) /* Draw a green line to indicate the cursor value */ immUniformThemeColorShadeAlpha(TH_CFRAME, -10, -50); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_width(2.0); immBegin(GPU_PRIM_LINES, 2); @@ -257,7 +257,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) immVertex2f(pos, v2d->cur.xmax, y); immEnd(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* current frame or vertical component of vertical component of the cursor */ @@ -268,7 +268,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) /* to help differentiate this from the current frame, * draw slightly darker like the horizontal one */ immUniformThemeColorShadeAlpha(TH_CFRAME, -40, -50); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_width(2.0); immBegin(GPU_PRIM_LINES, 2); @@ -276,7 +276,7 @@ static void graph_main_region_draw(const bContext *C, ARegion *region) immVertex2f(pos, x, v2d->cur.ymax); immEnd(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUnbindProgram(); diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 7e6f92f37f1..6b79151da3f 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -175,8 +175,8 @@ void ED_image_draw_info(Scene *scene, float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0; float col[4], finalcol[4]; - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); @@ -188,7 +188,7 @@ void ED_image_draw_info(Scene *scene, immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi); @@ -349,7 +349,7 @@ void ED_image_draw_info(Scene *scene, copy_v4_v4(finalcol, col); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); dx += 0.25f * UI_UNIT_X; BLI_rcti_init(&color_rect, @@ -388,10 +388,10 @@ void ED_image_draw_info(Scene *scene, immRecti(pos, color_quater_x, color_quater_y, color_rect_half.xmax, color_rect_half.ymax); immRecti(pos, color_rect_half.xmin, color_rect_half.ymin, color_quater_x, color_quater_y); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor3fvAlpha(finalcol, fp ? fp[3] : (cp[3] / 255.0f)); immRecti(pos, color_rect.xmin, color_rect.ymin, color_rect.xmax, color_rect.ymax); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else { immUniformColor3fv(finalcol); @@ -539,8 +539,8 @@ static void draw_udim_label(ARegion *region, float fx, float fy, const char *lab int x, y; UI_view2d_view_to_region(®ion->v2d, fx, fy, &x, &y); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); int textwidth = BLF_width(blf_mono_font, label, strlen(label)) + 10; float stepx = BLI_rcti_size_x(®ion->v2d.mask) / BLI_rctf_size_x(®ion->v2d.cur); @@ -558,7 +558,7 @@ static void draw_udim_label(ARegion *region, float fx, float fy, const char *lab BLF_position(blf_mono_font, (int)(x + 10), (int)(y + 10), 0); BLF_draw_ascii(blf_mono_font, label, strlen(label)); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void draw_image_buffer(const bContext *C, @@ -600,8 +600,8 @@ static void draw_image_buffer(const bContext *C, if (sima_flag & SI_USE_ALPHA) { imm_draw_box_checker_2d(x, y, x + ibuf->x * zoomx, y + ibuf->y * zoomy); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } /* If RGBA display with color management */ @@ -659,7 +659,7 @@ static void draw_image_buffer(const bContext *C, } if (sima_flag & SI_USE_ALPHA) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -768,14 +768,14 @@ static void draw_image_paint_helpers( return; } - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); immDrawPixelsTex( &state, x, y, ibuf->x, ibuf->y, GPU_RGBA8, false, display_buffer, zoomx, zoomy, col); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); BKE_image_release_ibuf(brush->clone.image, ibuf, NULL); IMB_display_buffer_release(cache_handle); @@ -1054,8 +1054,8 @@ void draw_image_cache(const bContext *C, ARegion *region) const rcti *rect_visible = ED_region_visible_rect(region); const int region_bottom = rect_visible->ymin; - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* Draw cache background. */ ED_region_cache_draw_background(region); @@ -1071,7 +1071,7 @@ void draw_image_cache(const bContext *C, ARegion *region) region, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* Draw current frame. */ x = (cfra - sfra) / (efra - sfra + 1) * region->winx; diff --git a/source/blender/editors/space_info/textview.c b/source/blender/editors/space_info/textview.c index b55c83fed9c..698adf7ee8e 100644 --- a/source/blender/editors/space_info/textview.c +++ b/source/blender/editors/space_info/textview.c @@ -84,8 +84,8 @@ static void textview_draw_sel(const char *str, const int sta = BLI_str_utf8_offset_to_column(str, max_ii(sel[0], 0)); const int end = BLI_str_utf8_offset_to_column(str, min_ii(sel[1], str_len_draw)); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); @@ -96,7 +96,7 @@ static void textview_draw_sel(const char *str, immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -239,7 +239,7 @@ static bool textview_draw_string(TextViewDrawState *tds, int vpadding = (tds->lheight + (tds->row_vpadding * 2) - UI_DPI_ICON_SIZE) / 2; int hpadding = tds->draw_rect->xmin - (UI_DPI_ICON_SIZE * 1.3f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_icon_draw_ex(hpadding, line_top - UI_DPI_ICON_SIZE - vpadding, icon, @@ -248,7 +248,7 @@ static bool textview_draw_string(TextViewDrawState *tds, 0.0f, icon_fg, false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } tds->xy[1] += tds->row_vpadding; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 92f29023d73..6d4684e7a17 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -321,7 +321,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uin /* draw with AA'd line */ GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* influence -------------------------- */ if (strip->flag & NLASTRIP_FLAG_USR_INFLUENCE) { @@ -374,7 +374,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc, uin /* turn off AA'd lines */ GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* helper call to setup dashed-lines for strip outlines */ @@ -434,8 +434,8 @@ static void nla_draw_strip(SpaceNla *snla, */ if ((strip->extendmode != NLASTRIP_EXTEND_NOTHING) && (non_solo == 0)) { /* enable transparency... */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); switch (strip->extendmode) { /* since this does both sides, @@ -467,7 +467,7 @@ static void nla_draw_strip(SpaceNla *snla, break; } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* draw 'inside' of strip itself */ @@ -486,9 +486,9 @@ static void nla_draw_strip(SpaceNla *snla, /* strip is in disabled track - make less visible */ immUniformColor3fvAlpha(color, 0.1f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immRectf(shdr_pos, strip->start, yminc, strip->end, ymaxc); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* draw strip's control 'curves' @@ -745,8 +745,8 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) /* just draw a semi-shaded rect spanning the width of the viewable area if there's data, * and a second darker rect within which we draw keyframe indicator dots if there's data */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* get colors for drawing */ float color[4]; @@ -788,7 +788,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) nla_action_draw_keyframes( v2d, adt, ale->data, ycenter, ymin + NLACHANNEL_SKIP, ymax - NLACHANNEL_SKIP); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); break; } } @@ -852,8 +852,8 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region) float ymax = NLACHANNEL_FIRST_TOP(ac); /* set blending again, as may not be set in previous step */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* loop through channels, and set up drawing depending on their type */ for (ale = anim_data.first; ale; @@ -873,7 +873,7 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region) UI_block_end(C, block); UI_block_draw(C, block); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* free temporary channels */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index f41c482da76..d889bcb15d6 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -602,7 +602,7 @@ static void node_draw_reroute(const bContext *C, /* outline active and selected emphasis */ if (node->flag & SELECT) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); /* using different shades of TH_TEXT_HI for the empasis, like triangle */ if (node->flag & NODE_ACTIVE) { @@ -614,7 +614,7 @@ static void node_draw_reroute(const bContext *C, UI_draw_roundbox_4fv(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, size, debug_color); GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } #endif @@ -3688,12 +3688,12 @@ void draw_nodespace_back_pix(const bContext *C, GPU_shader_unbind(); } else if (snode->flag & SNODE_USE_ALPHA) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); ED_draw_imbuf_ctx(C, ibuf, x, y, false, snode->zoom, snode->zoom); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else { ED_draw_imbuf_ctx(C, ibuf, x, y, false, snode->zoom, snode->zoom); @@ -4012,7 +4012,7 @@ static void nodelink_batch_draw(SpaceNode *snode) return; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); float colors[6][4] = {{0.0f}}; UI_GetThemeColor4fv(TH_WIRE_INNER, colors[nodelink_get_color_id(TH_WIRE_INNER)]); @@ -4032,7 +4032,7 @@ static void nodelink_batch_draw(SpaceNode *snode) nodelink_batch_reset(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void nodelink_batch_start(SpaceNode *UNUSED(snode)) diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 9a61d757ef5..5553928b012 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -691,13 +691,13 @@ static void node_draw_mute_line(View2D *v2d, SpaceNode *snode, bNode *node) { bNodeLink *link; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); for (link = node->internal_links.first; link; link = link->next) { node_draw_link_bezier(v2d, snode, link, TH_REDALERT, TH_REDALERT, -1); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* flags used in gpu_shader_keyframe_diamond_frag.glsl */ @@ -836,7 +836,7 @@ void ED_node_socket_draw(bNodeSocket *sock, const rcti *rect, const float color[ format, "outlineColor", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); gpuPushAttr(GPU_BLEND_BIT); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_program_point_size(true); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); @@ -909,9 +909,9 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) node_draw_preview_background(BLI_rctf_size_x(prv) / 10.0f, &draw_rect); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* premul graphics */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); immDrawPixelsTex(&state, @@ -926,7 +926,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) scale, NULL); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -981,7 +981,7 @@ void node_draw_sockets(View2D *v2d, uint outline_col_id = GPU_vertformat_attr_add( format, "outlineColor", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_program_point_size(true); immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND); immUniform1f("outline_scale", 0.7f); @@ -1115,7 +1115,7 @@ void node_draw_sockets(View2D *v2d, immUnbindProgram(); GPU_program_point_size(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void node_draw_basis(const bContext *C, @@ -1391,7 +1391,7 @@ static void node_draw_hidden(const bContext *C, /* custom color inline */ if (node->flag & NODE_CUSTOM_COLOR) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); UI_draw_roundbox_3fv_alpha(false, @@ -1404,7 +1404,7 @@ static void node_draw_hidden(const bContext *C, 1.0f); GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* title */ @@ -1638,7 +1638,7 @@ void node_draw_nodetree(const bContext *C, } /* node lines */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); nodelink_batch_start(snode); for (link = ntree->links.first; link; link = link->next) { if (!nodeLinkIsHidden(link)) { @@ -1646,7 +1646,7 @@ void node_draw_nodetree(const bContext *C, } } nodelink_batch_end(snode); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* draw foreground nodes, last nodes in front */ for (a = 0, node = ntree->nodes.first; node; node = node->next, a++) { @@ -1707,12 +1707,12 @@ static void draw_group_overlay(const bContext *C, ARegion *region) float color[4]; /* shade node groups to separate them visually */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_GetThemeColorShadeAlpha4fv(TH_NODE_GROUP, 0, 0, color); UI_draw_roundbox_corner_set(UI_CNR_NONE); UI_draw_roundbox_4fv(true, rect.xmin, rect.ymin, rect.xmax, rect.ymax, 0, color); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* set the block bounds to clip mouse events from underlying nodes */ block = UI_block_begin(C, region, "node tree bounds block", UI_EMBOSS); @@ -1751,7 +1751,7 @@ void drawnodespace(const bContext *C, ARegion *region) ED_region_draw_cb_draw(C, region, REGION_DRAW_PRE_VIEW); /* only set once */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); /* nodes */ snode_set_context(C); @@ -1837,7 +1837,7 @@ void drawnodespace(const bContext *C, ARegion *region) } /* temporary links */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); for (nldrag = snode->linkdrag.first; nldrag; nldrag = nldrag->next) { for (linkdata = nldrag->links.first; linkdata; linkdata = linkdata->next) { @@ -1845,7 +1845,7 @@ void drawnodespace(const bContext *C, ARegion *region) } } GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); if (snode->flag & SNODE_SHOW_GPENCIL) { /* draw grease-pencil ('canvas' strokes) */ diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index ccbb191e411..1705b9dd606 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2729,7 +2729,7 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle, number_text, text_col); UI_fontstyle_set(fstyle); - GPU_blend(true); /* Roundbox and text drawing disables. */ + GPU_blend(GPU_BLEND_ALPHA); /* Roundbox and text drawing disables. */ } static void outliner_icon_background_colors(float icon_color[4], float icon_border[4]) @@ -2780,7 +2780,7 @@ static void outliner_draw_iconrow_doit(uiBlock *block, (float)ys + UI_UNIT_Y - ufac, (float)UI_UNIT_Y / 4.0f, icon_border); - GPU_blend(true); /* Roundbox disables. */ + GPU_blend(GPU_BLEND_ALPHA); /* Roundbox disables. */ } if (tselem->flag & TSE_HIGHLIGHTED) { @@ -2981,7 +2981,7 @@ static void outliner_draw_tree_element(bContext *C, xmax -= restrict_column_width + UI_UNIT_X; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* colors for active/selected data */ if (tselem->type == 0) { @@ -3068,7 +3068,7 @@ static void outliner_draw_tree_element(bContext *C, (float)*starty + UI_UNIT_Y - ufac, UI_UNIT_Y / 4.0f, icon_border); - GPU_blend(true); /* roundbox disables it */ + GPU_blend(GPU_BLEND_ALPHA); /* roundbox disables it */ te->flag |= TE_ACTIVE; /* For lookup in display hierarchies. */ } @@ -3116,7 +3116,7 @@ static void outliner_draw_tree_element(bContext *C, offsx += UI_UNIT_X + 4 * ufac; } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* name */ if ((tselem->flag & TSE_TEXTBUT) == 0) { @@ -3140,7 +3140,7 @@ static void outliner_draw_tree_element(bContext *C, else if (tselem->type != TSE_R_LAYER) { int tempx = startx + offsx; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); MergedIconRow merged = {{0}}; outliner_draw_iconrow(C, @@ -3156,7 +3156,7 @@ static void outliner_draw_tree_element(bContext *C, alpha_fac, &merged); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } @@ -3315,9 +3315,9 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *space_outliner, UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.4f, col); col[3] = 255; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); outliner_draw_hierarchy_lines_recursive(pos, space_outliner, lb, startx, col, false, starty); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } @@ -3464,7 +3464,7 @@ static void outliner_draw_highlights(ARegion *region, UI_GetThemeColor4fv(TH_MATCH, col_searchmatch); col_searchmatch[3] = 0.5f; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -3479,7 +3479,7 @@ static void outliner_draw_highlights(ARegion *region, startx, starty); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void outliner_draw_tree(bContext *C, @@ -3493,7 +3493,7 @@ static void outliner_draw_tree(bContext *C, const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; int starty, startx; - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); /* Only once. */ + GPU_blend(GPU_BLEND_ALPHA); /* Only once. */ if (space_outliner->outlinevis == SO_DATA_API) { /* struct marks */ diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 77bc8423365..2bc3550413d 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -295,7 +295,7 @@ static void draw_seq_waveform(View2D *v2d, /* Fcurve lookup is quite expensive, so do this after precondition. */ FCurve *fcu = id_data_find_fcurve(&scene->id, seq, &RNA_Sequence, "volume", 0, NULL); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); uint col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); @@ -351,7 +351,7 @@ static void draw_seq_waveform(View2D *v2d, immEnd(); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -382,8 +382,8 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, offset = 0; } - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); for (seq = seqbase->first; seq; seq = seq->next) { chan_min = min_ii(chan_min, seq->machine); @@ -443,7 +443,7 @@ static void drawmeta_contents(Scene *scene, Sequence *seqm, float x1, float y1, immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* Get handle width in pixels. */ @@ -489,9 +489,9 @@ static void draw_seq_handle(View2D *v2d, } if (!(seq->type & SEQ_TYPE_EFFECT) || BKE_sequence_effect_get_num_inputs(seq->type) == 0) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); if (seq->flag & whichsel) { if (seq_active) { @@ -510,7 +510,7 @@ static void draw_seq_handle(View2D *v2d, } immRectf(pos, rx1, y1, rx2, y2); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* Draw numbers for start and end of the strip next to its handles. */ @@ -752,8 +752,8 @@ static void draw_sequence_extensions(Scene *scene, Sequence *seq, uint pos, floa y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; y2 = seq->machine + SEQ_STRIP_OFSTOP; - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); color3ubv_from_seq(scene, seq, col); if (seq->flag & SELECT) { @@ -779,7 +779,7 @@ static void draw_sequence_extensions(Scene *scene, Sequence *seq, uint pos, floa imm_draw_box_wire_2d( pos, x2, y2 + pixely, (float)(seq->start + seq->len), y2 + SEQ_STRIP_OFSBOTTOM); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y, float y1) @@ -789,7 +789,7 @@ static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y, rgb_float_to_uchar(col, colvars->col); if (seq->flag & SEQ_MUTE) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); col[3] = MUTE_ALPHA; } else { @@ -810,7 +810,7 @@ static void draw_color_strip_band(Sequence *seq, uint pos, float text_margin_y, immEnd(); if (seq->flag & SEQ_MUTE) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -841,8 +841,8 @@ static void draw_seq_background(Scene *scene, } if (seq->flag & SEQ_MUTE) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); col[3] = MUTE_ALPHA; } @@ -907,13 +907,13 @@ static void draw_seq_background(Scene *scene, } if (seq->flag & SEQ_MUTE) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } static void draw_seq_locked(float x1, float y1, float x2, float y2) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_DIAG_STRIPES); @@ -927,12 +927,12 @@ static void draw_seq_locked(float x1, float y1, float x2, float y2) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void draw_seq_invalid(float x1, float x2, float y2, float text_margin_y) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -940,7 +940,7 @@ static void draw_seq_invalid(float x1, float x2, float y2, float text_margin_y) immRectf(pos, x1, y2, x2, text_margin_y); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void calculate_seq_text_offsets( @@ -1053,13 +1053,13 @@ static void draw_seq_fcurve( GPU_vertbuf_data_len_set(vbo, vert_count); GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); GPU_batch_uniform_4f(batch, "color", 0.0f, 0.0f, 0.0f, 0.15f); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); if (vert_count > 0) { GPU_batch_draw(batch); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_batch_discard(batch); } } @@ -1177,7 +1177,7 @@ static void draw_effect_inputs_highlight(Sequence *seq) Sequence *seq1 = seq->seq1; Sequence *seq2 = seq->seq2; Sequence *seq3 = seq->seq3; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1204,7 +1204,7 @@ static void draw_effect_inputs_highlight(Sequence *seq) seq3->machine + SEQ_STRIP_OFSTOP); } immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } void sequencer_special_update_set(Sequence *seq) @@ -1591,8 +1591,8 @@ static void sequencer_draw_display_buffer(const bContext *C, void *display_buffer; if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); } /* Format needs to be created prior to any immBindShader call. @@ -1677,7 +1677,7 @@ static void sequencer_draw_display_buffer(const bContext *C, } if (sseq->mainb == SEQ_DRAW_IMG_IMBUF && sseq->flag & SEQ_USE_ALPHA) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } if (draw_backdrop) { @@ -1933,7 +1933,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) else if (last_seq->type == SEQ_TYPE_MULTICAM) { int channel = last_seq->multicam_source; if (channel != 0) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1942,7 +1942,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) immRectf(pos, v2d->cur.xmin, channel, v2d->cur.xmax, channel + 1); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } @@ -1950,7 +1950,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) /* Draw highlight if "solo preview" is used. */ if (special_seq_update) { const Sequence *seq = special_seq_update; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -1964,7 +1964,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *region) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -1974,7 +1974,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) const int frame_sta = scene->r.sfra; const int frame_end = scene->r.efra + 1; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2035,7 +2035,7 @@ static void seq_draw_sfra_efra(Scene *scene, View2D *v2d) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } typedef struct CacheDrawData { @@ -2159,7 +2159,7 @@ static void draw_cache_view(const bContext *C) return; } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); @@ -2246,7 +2246,7 @@ static void draw_cache_view(const bContext *C) draw_cache_view_batch( userdata.final_out_vbo, userdata.final_out_vert_count, 1.0f, 0.4f, 0.2f, 0.4f); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* Draw sequencer timeline. */ diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index c91595646ff..f40cc98d4f7 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1353,10 +1353,10 @@ static void draw_text_decoration(SpaceText *st, ARegion *region) UI_GetThemeColor4fv(TH_TEXT, highlight_color); highlight_color[3] = 0.1f; immUniformColor4fv(highlight_color); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); immRecti(pos, 0, y1, region->winx, y2); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -1707,9 +1707,9 @@ void draw_text_main(SpaceText *st, ARegion *region) UI_GetThemeColor4fv(TH_TEXT, margin_color); margin_color[3] = 0.2f; immUniformColor4fv(margin_color); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immRecti(pos, margin_column_x, 0, margin_column_x + U.pixelsize, region->winy); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immUnbindProgram(); } } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index c102b4ff758..3c5b5abdefc 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -131,8 +131,8 @@ void ED_draw_object_facemap(Depsgraph *depsgraph, /* Just to create the data to pass to immediate mode, grr! */ const int *facemap_data = CustomData_get_layer(&me->pdata, CD_FACEMAP); if (facemap_data) { - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); const MVert *mvert = me->mvert; const MPoly *mpoly = me->mpoly; @@ -208,6 +208,6 @@ void ED_draw_object_facemap(Depsgraph *depsgraph, GPU_batch_discard(draw_batch); GPU_vertbuf_discard(vbo_pos); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 6fecf80650d..6973e55e5ea 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -588,8 +588,8 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, float alpha = 1.0f; if (ca->passepartalpha != 1.0f) { - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); alpha = ca->passepartalpha; } @@ -608,7 +608,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, immRectf(shdr_pos, x1i, y1i, x2i, 0.0f); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUniformThemeColor3(TH_BACK); @@ -667,7 +667,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, /* safety border */ if (ca) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformThemeColorAlpha(TH_VIEW_OVERLAY, 0.75f); if (ca->dtx & CAM_DTX_CENTER) { @@ -779,7 +779,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *region, imm_draw_box_wire_2d(shdr_pos, rect.xmin, rect.ymin, rect.xmax, rect.ymax); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUnbindProgram(); @@ -1026,8 +1026,8 @@ static void draw_view_axis(RegionView3D *rv3d, const rcti *rect) /* draw axis lines */ GPU_line_width(2.0f); GPU_line_smooth(true); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + 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); @@ -1070,8 +1070,8 @@ static void draw_rotation_guide(const RegionView3D *rv3d) negate_v3_v3(o, rv3d->ofs); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPU_depth_mask(false); /* don't overwrite zbuf */ GPUVertFormat *format = immVertexFormat(); @@ -1161,7 +1161,7 @@ static void draw_rotation_guide(const RegionView3D *rv3d) immEnd(); immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_depth_mask(true); } #endif /* WITH_INPUT_NDOF */ diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c index 3ce4c8dc9a8..5f8ffc5f3f9 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate_type.c @@ -407,7 +407,7 @@ static void axis_geom_draw(const wmGizmo *gz, BLF_width_and_height(font.id, axis_str, 2, &offset[0], &offset[1]); BLF_position(font.id, roundf(offset[0] * -0.5f), roundf(offset[1] * -0.5f), 0); BLF_draw_ascii(font.id, axis_str, 2); - GPU_blend(true); /* XXX, blf disables */ + GPU_blend(GPU_BLEND_ALPHA); /* XXX, blf disables */ GPU_matrix_pop(); immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); @@ -465,9 +465,9 @@ static void axis3d_draw_intern(const bContext *C, UNUSED_VARS(C); #endif - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); axis_geom_draw(gz, color, select, &draw_info); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_matrix_pop(); } @@ -478,9 +478,9 @@ static void gizmo_axis_draw(const bContext *C, wmGizmo *gz) (void)is_modal; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); axis3d_draw_intern(C, gz, false, is_highlight); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static int gizmo_axis_test_select(bContext *UNUSED(C), wmGizmo *gz, const int mval[2]) diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c index 7799aba5c19..5aba1fecc53 100644 --- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c +++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c @@ -607,7 +607,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) GPU_matrix_projection_set(rv3d->winmat); GPU_matrix_set(rv3d->viewmat); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); const uint shdr_pos_3d = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); @@ -735,7 +735,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) rot_90_vec_b[1] = dir_ruler[0]; normalize_v2(rot_90_vec_b); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); if (proj_ok[1] && is_act && (ruler_item->flag & RULERITEM_USE_ANGLE_ACTIVE)) { GPU_line_width(3.0f); @@ -781,7 +781,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immEnd(); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* text */ @@ -800,13 +800,13 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) /* draw text (bg) */ if (proj_ok[1]) { immUniformColor4fv(color_back); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immRectf(shdr_pos_2d, posit[0] - bg_margin, posit[1] - bg_margin, posit[0] + bg_margin + numstr_size[0], posit[1] + bg_margin + numstr_size[1]); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUnbindProgram(); @@ -831,7 +831,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) normalize_v2(rot_90_vec); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniformColor3ubv(color_wire); @@ -855,7 +855,7 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) immEnd(); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } /* text */ @@ -877,13 +877,13 @@ static void gizmo_ruler_draw(const bContext *C, wmGizmo *gz) /* draw text (bg) */ if (proj_ok[0] && proj_ok[2]) { immUniformColor4fv(color_back); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immRectf(shdr_pos_2d, posit[0] - bg_margin, posit[1] - bg_margin, posit[0] + bg_margin + numstr_size[0], posit[1] + bg_margin + numstr_size[1]); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } immUnbindProgram(); diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index a21c1458286..6c61c83731d 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -258,7 +258,7 @@ static void draw_line_loop(const float coords[][3], int coords_len, const float GPU_vertbuf_attr_set(vert, pos, i, coords[i]); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_LINE_LOOP, vert, NULL, GPU_BATCH_OWNS_VBO); GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); @@ -272,7 +272,7 @@ static void draw_line_loop(const float coords[][3], int coords_len, const float GPU_batch_draw(batch); GPU_batch_discard(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void draw_line_pairs(const float coords_a[][3], @@ -291,7 +291,7 @@ static void draw_line_pairs(const float coords_a[][3], GPU_vertbuf_attr_set(vert, pos, (i * 2) + 1, coords_b[i]); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_LINES, vert, NULL, GPU_BATCH_OWNS_VBO); GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); @@ -305,7 +305,7 @@ static void draw_line_pairs(const float coords_a[][3], GPU_batch_draw(batch); GPU_batch_discard(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void draw_line_bounds(const BoundBox *bounds, const float color[4]) @@ -339,7 +339,7 @@ static void draw_line_bounds(const BoundBox *bounds, const float color[4]) GPU_vertbuf_attr_set(vert, pos, j++, bounds->vec[edges[i][1]]); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_LINES, vert, NULL, GPU_BATCH_OWNS_VBO); GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_POLYLINE_UNIFORM_COLOR); @@ -353,7 +353,7 @@ static void draw_line_bounds(const BoundBox *bounds, const float color[4]) GPU_batch_draw(batch); GPU_batch_discard(batch); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static bool calc_bbox(struct InteractivePlaceData *ipd, BoundBox *bounds) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index f760e90c68f..b97145c5f50 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1544,15 +1544,15 @@ static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *region) #endif /* autokey recording icon... */ - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); xco -= U.widget_unit; yco -= (int)printable_size[1] / 2; UI_icon_draw(xco, yco, ICON_REC); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } static void drawTransformPixel(const struct bContext *C, ARegion *region, void *arg) diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index d0e37f22236..0aa6b4f6131 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -884,7 +884,7 @@ void drawPropCircle(const struct bContext *C, TransInfo *t) float viewport[4]; GPU_viewport_size_get_f(viewport); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immUniform2fv("viewportSize", &viewport[2]); immUniform1f("lineWidth", 3.0f * U.pixelsize); diff --git a/source/blender/editors/transform/transform_draw_cursors.c b/source/blender/editors/transform/transform_draw_cursors.c index 95ca5ae0c30..84fc45e2b45 100644 --- a/source/blender/editors/transform/transform_draw_cursors.c +++ b/source/blender/editors/transform/transform_draw_cursors.c @@ -191,7 +191,7 @@ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customd } GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_matrix_push(); @@ -339,6 +339,6 @@ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customd GPU_matrix_pop(); GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 6155042f555..dffee72205b 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -1344,7 +1344,7 @@ void drawDial3d(const TransInfo *t) gizmo_get_axis_color(axis_idx, NULL, color, color); GPU_depth_test(false); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); ED_gizmotypes_dial_3d_draw_util(mat_basis, @@ -1360,7 +1360,7 @@ void drawDial3d(const TransInfo *t) GPU_line_smooth(false); GPU_depth_test(true); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index deed5c84d2b..d9fd8880c3f 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -1149,8 +1149,8 @@ void drawEdgeSlide(TransInfo *t) GPU_depth_test(false); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPU_matrix_push(); GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); @@ -1265,7 +1265,7 @@ void drawEdgeSlide(TransInfo *t) GPU_matrix_pop(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_depth_test(true); } diff --git a/source/blender/editors/transform/transform_mode_vert_slide.c b/source/blender/editors/transform/transform_mode_vert_slide.c index 9691da6a32f..1de7d219cae 100644 --- a/source/blender/editors/transform/transform_mode_vert_slide.c +++ b/source/blender/editors/transform/transform_mode_vert_slide.c @@ -392,8 +392,8 @@ void drawVertSlide(TransInfo *t) GPU_depth_test(false); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); GPU_matrix_push(); GPU_matrix_mul(TRANS_DATA_CONTAINER_FIRST_OK(t)->obedit->obmat); diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index a700dd320b7..09b5df82c2b 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -245,7 +245,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); uint pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -271,7 +271,7 @@ void drawSnapping(const struct bContext *C, TransInfo *t) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 03ec8c81294..faeefcb989e 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -237,10 +237,10 @@ static void draw_uvs_shadow(SpaceImage *sima, if (edges) { if (sima->flag & SI_SMOOTH_UV) { GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); } else if (overlay_alpha < 1.0f) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); } col[3] = overlay_alpha; @@ -250,10 +250,10 @@ static void draw_uvs_shadow(SpaceImage *sima, if (sima->flag & SI_SMOOTH_UV) { GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else if (overlay_alpha < 1.0f) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } } @@ -349,7 +349,7 @@ static void draw_uvs(SpaceImage *sima, interpedges = (ts->uv_selectmode == UV_SELECT_VERTEX); } - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); if (batch->faces) { GPU_batch_program_set_builtin(batch->faces, @@ -359,7 +359,7 @@ static void draw_uvs(SpaceImage *sima, GPU_SHADER_2D_UV_FACES); if (!draw_stretch) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); UI_GetThemeColor4fv(TH_FACE, col1); UI_GetThemeColor4fv(TH_FACE_SELECT, col2); @@ -386,16 +386,16 @@ static void draw_uvs(SpaceImage *sima, GPU_batch_draw(batch->faces); if (!draw_stretch) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } if (batch->edges) { if (sima->flag & SI_SMOOTH_UV) { GPU_line_smooth(true); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); } else if (overlay_alpha < 1.0f) { - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); } { @@ -464,10 +464,10 @@ static void draw_uvs(SpaceImage *sima, if (sima->flag & SI_SMOOTH_UV) { GPU_line_smooth(false); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } else if (overlay_alpha < 1.0f) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } @@ -477,7 +477,7 @@ static void draw_uvs(SpaceImage *sima, const float point_size = UI_GetThemeValuef(TH_VERTEX_SIZE); const float pinned_col[4] = {1.0f, 0.0f, 0.0f, 1.0f}; /* TODO Theme? */ UI_GetThemeColor4fv(TH_VERTEX, col1); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_program_point_size(true); GPU_batch_program_set_builtin(batch->verts, GPU_SHADER_2D_UV_VERTS); @@ -497,7 +497,7 @@ static void draw_uvs(SpaceImage *sima, GPU_batch_uniform_4fv(batch->verts, "selectColor", col2); GPU_batch_draw(batch->verts); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_program_point_size(false); } if (batch->facedots) { diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 6332a6ab48f..6dac31794b4 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1765,7 +1765,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); } - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); /* Static Tris */ if (stitch_preview->static_tris) { @@ -1829,7 +1829,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void stitch_draw_vbo(vbo_line, GPU_PRIM_LINES, col); } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); /* draw stitch vert/lines preview */ if (ssc->mode == STITCH_VERT) { diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 94dd2f18927..089edb860ef 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -106,7 +106,7 @@ typedef enum eGPUProvokingVertex { void GPU_state_init(void); void GPU_blend(bool enable); -void GPU_blend_set_func_separate(eGPUBlend blend); +void GPU_blend(eGPUBlend blend); void GPU_face_culling(eGPUFaceCullTest culling); void GPU_front_facing(bool invert); void GPU_provoking_vertex(eGPUProvokingVertex vert); diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index c670e034585..4c3b2cc119e 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -40,17 +40,7 @@ using namespace blender::gpu; -void GPU_blend(bool enable) -{ - if (enable) { - GLStateStack::set_blend(GPU_BLEND_ALPHA); - } - else { - GLStateStack::set_blend(GPU_BLEND_NONE); - } -} - -void GPU_blend_set_func_separate(eGPUBlend blend) +void GPU_blend(eGPUBlend blend) { GLStateStack::set_blend(blend); } diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index ec18a401fa4..37ed9f89bc7 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -401,7 +401,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) } /* XXX todo, multiline drag draws... but maybe not, more types mixed wont work well */ - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); for (drag = wm->drags.first; drag; drag = drag->next) { const uchar text_col[] = {255, 255, 255, 255}; int iconsize = UI_DPI_ICON_SIZE; @@ -495,5 +495,5 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) } } } - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 14f6ad420b5..d5e175b8cb4 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -577,8 +577,8 @@ void wm_draw_region_blend(ARegion *region, int view, bool blend) if (blend) { /* GL_ONE because regions drawn offscreen have premultiplied alpha. */ - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA_PREMULT); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA_PREMULT); } /* setup actual texture */ @@ -603,7 +603,7 @@ void wm_draw_region_blend(ARegion *region, int view, bool blend) GPU_texture_unbind(texture); if (blend) { - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } } diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 633c6b53ecd..d73da935626 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -236,7 +236,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) uint shdr_pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f); @@ -245,7 +245,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -274,7 +274,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) { rcti *rect = (rcti *)gt->customdata; - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); const uint shdr_pos = GPU_vertformat_attr_add( immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -286,7 +286,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) immUnbindProgram(); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -353,8 +353,8 @@ static void draw_filled_lasso(wmGesture *gt) draw_filled_lasso_px_cb, &lasso_fill_data); - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ADDITIVE); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ADDITIVE); IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR); GPU_shader_bind(state.shader); @@ -368,7 +368,7 @@ static void draw_filled_lasso(wmGesture *gt) MEM_freeN(pixel_buf); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); } MEM_freeN(mcoords); diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 8e6b139ca7d..9b25d660ff6 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2393,7 +2393,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void } GPU_matrix_translate_2f((float)x, (float)y); - GPU_blend(true); + GPU_blend(GPU_BLEND_ALPHA); GPU_line_smooth(true); /* apply zoom if available */ @@ -2472,7 +2472,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void BLF_position(fontid, -0.5f * strwidth, -0.5f * strheight, 0.0f); BLF_draw(fontid, str, strdrawlen); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); GPU_line_smooth(false); } diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index b75d9db1c38..2f949142eb7 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -315,8 +315,8 @@ static void playanim_toscreen( /* checkerboard for case alpha */ if (ibuf->planes == 32) { - GPU_blend(true); - GPU_blend_set_func_separate(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); + GPU_blend(GPU_BLEND_ALPHA); imm_draw_box_checker_2d_ex(offs_x, offs_y, @@ -341,7 +341,7 @@ static void playanim_toscreen( ((ps->draw_flip[1] ? -1.0f : 1.0f)) * (ps->zoom / (float)ps->win_y), NULL); - GPU_blend(false); + GPU_blend(GPU_BLEND_NONE); pupdate_time(); -- cgit v1.2.3