diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-28 00:21:39 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-28 15:22:22 +0300 |
commit | e0c1116ce3dfef8415b7a975e82cd1506383ed9c (patch) | |
tree | 5e1aac7b4ed95890e8025ef28ef8147338eeb861 /source/blender/draw/intern | |
parent | 2e211d099f8d13b79cdf9057f77532c587311c3d (diff) |
Cleanup: DRW: Rename DRW_STATE_BLEND_* for API clarity
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r-- | source/blender/draw/intern/DRW_render.h | 13 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_common.c | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_exec.c | 19 |
4 files changed, 20 insertions, 18 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 9de90dc5491..09144e0ceeb 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -336,15 +336,16 @@ typedef enum { DRW_STATE_STENCIL_NEQUAL = (1 << 14), /** Blend state */ - DRW_STATE_ADDITIVE = (1 << 15), + DRW_STATE_BLEND_ADD = (1 << 15), /** Same as additive but let alpha accumulate without premult. */ - DRW_STATE_ADDITIVE_FULL = (1 << 16), - DRW_STATE_BLEND = (1 << 17), + DRW_STATE_BLEND_ADD_FULL = (1 << 16), + /** Standard alpha blending. */ + DRW_STATE_BLEND_ALPHA = (1 << 17), /** Use that if color is already premult by alpha. */ - DRW_STATE_BLEND_PREMUL = (1 << 18), - DRW_STATE_BLEND_PREMUL_UNDER = (1 << 19), + DRW_STATE_BLEND_ALPHA_PREMUL = (1 << 18), + DRW_STATE_BLEND_ALPHA_UNDER_PREMUL = (1 << 19), DRW_STATE_BLEND_OIT = (1 << 20), - DRW_STATE_MULTIPLY = (1 << 21), + DRW_STATE_BLEND_MUL = (1 << 21), DRW_STATE_CLIP_PLANES = (1 << 22), DRW_STATE_WIRE_SMOOTH = (1 << 23), diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index bcca660f861..de860607a2e 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -501,7 +501,7 @@ struct DRWCallBuffer *buffer_instance(DRWPass *pass, }); DRWShadingGroup *grp = DRW_shgroup_create(sh_inst, pass); - DRW_shgroup_state_disable(grp, DRW_STATE_BLEND); + DRW_shgroup_state_disable(grp, DRW_STATE_BLEND_ALPHA); if (sh_cfg == GPU_SHADER_CFG_CLIPPED) { DRW_shgroup_state_enable(grp, DRW_STATE_CLIP_PLANES); } @@ -969,7 +969,7 @@ struct DRWCallBuffer *buffer_instance_bone_dof(struct DRWPass *pass, DRWShadingGroup *grp = DRW_shgroup_create(sh_data->bone_dofs, pass); if (blend) { - DRW_shgroup_state_enable(grp, DRW_STATE_BLEND); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); DRW_shgroup_state_disable(grp, DRW_STATE_CULL_FRONT); } return DRW_shgroup_call_buffer_instance(grp, g_formats.instance_bone_dof, geom); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index db882828867..b1f8e951b3e 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -385,7 +385,7 @@ void DRW_transform_none(GPUTexture *tex) */ void DRW_multisamples_resolve(GPUTexture *src_depth, GPUTexture *src_color, bool use_depth) { - DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_PREMUL; + DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL; if (use_depth) { state |= DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL; diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c index b232cfd01ad..11c19b292f0 100644 --- a/source/blender/draw/intern/draw_manager_exec.c +++ b/source/blender/draw/intern/draw_manager_exec.c @@ -183,26 +183,27 @@ void drw_state_set(DRWState state) /* Blending (all buffer) */ { int test; - if (CHANGED_ANY_STORE_VAR(DRW_STATE_BLEND | DRW_STATE_BLEND_PREMUL | DRW_STATE_ADDITIVE | - DRW_STATE_MULTIPLY | DRW_STATE_ADDITIVE_FULL | - DRW_STATE_BLEND_OIT | DRW_STATE_BLEND_PREMUL_UNDER, + if (CHANGED_ANY_STORE_VAR(DRW_STATE_BLEND_ALPHA | DRW_STATE_BLEND_ALPHA_PREMUL | + DRW_STATE_BLEND_ADD | DRW_STATE_BLEND_MUL | + DRW_STATE_BLEND_ADD_FULL | DRW_STATE_BLEND_OIT | + DRW_STATE_BLEND_ALPHA_UNDER_PREMUL, test)) { if (test) { glEnable(GL_BLEND); - if ((state & DRW_STATE_BLEND) != 0) { + if ((state & DRW_STATE_BLEND_ALPHA) != 0) { glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, /* RGB */ GL_ONE, GL_ONE_MINUS_SRC_ALPHA); /* Alpha */ } - else if ((state & DRW_STATE_BLEND_PREMUL_UNDER) != 0) { + else if ((state & DRW_STATE_BLEND_ALPHA_UNDER_PREMUL) != 0) { glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE); } - else if ((state & DRW_STATE_BLEND_PREMUL) != 0) { + else if ((state & DRW_STATE_BLEND_ALPHA_PREMUL) != 0) { glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } - else if ((state & DRW_STATE_MULTIPLY) != 0) { + else if ((state & DRW_STATE_BLEND_MUL) != 0) { glBlendFunc(GL_DST_COLOR, GL_ZERO); } else if ((state & DRW_STATE_BLEND_OIT) != 0) { @@ -211,14 +212,14 @@ void drw_state_set(DRWState state) GL_ZERO, GL_ONE_MINUS_SRC_ALPHA); /* Alpha */ } - else if ((state & DRW_STATE_ADDITIVE) != 0) { + else if ((state & DRW_STATE_BLEND_ADD) != 0) { /* Do not let alpha accumulate but premult the source RGB by it. */ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, /* RGB */ GL_ZERO, GL_ONE); /* Alpha */ } - else if ((state & DRW_STATE_ADDITIVE_FULL) != 0) { + else if ((state & DRW_STATE_BLEND_ADD_FULL) != 0) { /* Let alpha accumulate. */ glBlendFunc(GL_ONE, GL_ONE); } |