diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-16 16:38:34 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-08-18 22:30:10 +0300 |
commit | bf1b622dd962416fef94ccb2f47878eced31e20d (patch) | |
tree | 8622462ebdfbc6e347975d1b875b817356e4e84a /source/blender/editors/interface/interface_draw.c | |
parent | 10558d6973be8fc461a4b8aad734ba0881d18e85 (diff) |
GPUState: GPU_blend final API renaming
We now use GPU_blend for enabling / disabling blending and explicitly
set the blend equation.
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 96 |
1 files changed, 48 insertions, 48 deletions
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); } |