diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-03-25 22:26:52 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-03-25 22:26:52 +0300 |
commit | c602ec74fdd20c17c9ca9c7eb59c048443efc2ce (patch) | |
tree | af55cc2a2da7c385db5a42735e2bbbdea7953e1f /source/blender/windowmanager/intern | |
parent | c41e8b8f6f38b9f5a037e11b83b49c4481256716 (diff) |
GPU: State: Replace GL_BLEND by GPU_blend
Diffstat (limited to 'source/blender/windowmanager/intern')
5 files changed, 18 insertions, 15 deletions
diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index fcfc9c8b0ae..11e803c4b82 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -41,6 +41,7 @@ #include "BKE_idcode.h" #include "GPU_shader.h" +#include "GPU_state.h" #include "IMB_imbuf_types.h" @@ -388,7 +389,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 */ - glEnable(GL_BLEND); + GPU_blend(true); for (drag = wm->drags.first; drag; drag = drag->next) { const char text_col[] = {255, 255, 255, 255}; int iconsize = UI_DPI_ICON_SIZE; @@ -466,5 +467,5 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) } } - glDisable(GL_BLEND); + GPU_blend(false); } diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c index 6a3eeea14f0..4f299201bdf 100644 --- a/source/blender/windowmanager/intern/wm_draw.c +++ b/source/blender/windowmanager/intern/wm_draw.c @@ -59,6 +59,7 @@ #include "GPU_framebuffer.h" #include "GPU_immediate.h" #include "GPU_matrix.h" +#include "GPU_state.h" #include "GPU_texture.h" #include "GPU_viewport.h" @@ -463,7 +464,7 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend) if (blend) { /* GL_ONE because regions drawn offscreen have premultiplied alpha. */ - glEnable(GL_BLEND); + GPU_blend(true); glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } @@ -507,7 +508,7 @@ void wm_draw_region_blend(ARegion *ar, int view, bool blend) if (blend) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_BLEND); + GPU_blend(false); } } diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index c9853776902..013ee029200 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -197,7 +197,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); - glEnable(GL_BLEND); + GPU_blend(true); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); immUniformColor4f(1.0f, 1.0f, 1.0f, 0.05f); @@ -206,7 +206,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) immUnbindProgram(); - glDisable(GL_BLEND); + GPU_blend(false); shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -231,7 +231,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) { rcti *rect = (rcti *)gt->customdata; - glEnable(GL_BLEND); + GPU_blend(true); const uint shdr_pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); @@ -242,7 +242,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) immUnbindProgram(); - glDisable(GL_BLEND); + GPU_blend(false); immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); @@ -304,7 +304,7 @@ static void draw_filled_lasso(wmGesture *gt) draw_filled_lasso_px_cb, &lasso_fill_data); /* Additive Blending */ - glEnable(GL_BLEND); + GPU_blend(true); glBlendFunc(GL_ONE, GL_ONE); GLint unpack_alignment; @@ -324,7 +324,7 @@ static void draw_filled_lasso(wmGesture *gt) MEM_freeN(pixel_buf); - glDisable(GL_BLEND); + GPU_blend(false); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 6f33bd62bcd..0b306406054 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2159,7 +2159,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void y = rc->initial_mouse[1]; GPU_matrix_translate_2f((float)x, (float)y); - glEnable(GL_BLEND); + GPU_blend(true); GPU_line_smooth(true); /* apply zoom if available */ @@ -2220,7 +2220,7 @@ static void radial_control_paint_cursor(bContext *UNUSED(C), int x, int y, void BLF_disable(fontid, BLF_SHADOW); - glDisable(GL_BLEND); + GPU_blend(false); GPU_line_smooth(false); } diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index e6c73bf3bf7..0a1ec29c01c 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -57,11 +57,12 @@ #include "BIF_glutil.h" +#include "GPU_context.h" #include "GPU_matrix.h" #include "GPU_immediate.h" #include "GPU_immediate_util.h" -#include "GPU_context.h" #include "GPU_init_exit.h" +#include "GPU_state.h" #include "DNA_scene_types.h" #include "ED_datafiles.h" /* for fonts */ @@ -311,7 +312,7 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf /* checkerboard for case alpha */ if (ibuf->planes == 32) { - glEnable(GL_BLEND); + GPU_blend(true); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); imm_draw_box_checker_2d(offs_x, offs_y, offs_x + span_x, offs_y + span_y); @@ -329,7 +330,7 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf ((ps->draw_flip[1] ? -1.0f : 1.0f)) * (ps->zoom / (float)ps->win_y), NULL); - glDisable(GL_BLEND); + GPU_blend(false); pupdate_time(); |