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/screen | |
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/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 30 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_draw.c | 20 |
2 files changed, 25 insertions, 25 deletions
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(); } |