Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-06-27 15:36:40 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-06-27 15:41:35 +0300
commit1f4e9754c02891076ffe5c29a2d7c030aace219c (patch)
tree189c2482535f606cbae80de5985d2142948cc008 /source/blender
parent7f5a21177a058eab33a2ba1707ef3fc965a32cd7 (diff)
DRW: Add DRW_STATE_BLEND_CUSTOM
This one enable dual source blending, enabling more fine tuned blending parameters inside the shader.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/draw/intern/DRW_render.h10
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c7
2 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 392362e73c5..a8f67e10a4d 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -347,12 +347,14 @@ typedef enum {
DRW_STATE_BLEND_ALPHA_UNDER_PREMUL = (1 << 20),
DRW_STATE_BLEND_OIT = (1 << 21),
DRW_STATE_BLEND_MUL = (1 << 22),
+ /** Use dual source blending. WARNING: Only one color buffer allowed. */
+ DRW_STATE_BLEND_CUSTOM = (1 << 23),
- DRW_STATE_CLIP_PLANES = (1 << 23),
- DRW_STATE_WIRE_SMOOTH = (1 << 24),
- DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 25),
+ DRW_STATE_CLIP_PLANES = (1 << 28),
+ DRW_STATE_WIRE_SMOOTH = (1 << 29),
+ DRW_STATE_FIRST_VERTEX_CONVENTION = (1 << 30),
/** DO NOT USE. Assumed always enabled. Only used internally. */
- DRW_STATE_PROGRAM_POINT_SIZE = (1 << 26),
+ DRW_STATE_PROGRAM_POINT_SIZE = (1u << 31),
} DRWState;
#define DRW_STATE_DEFAULT \
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index 2596570c022..949d3e1d38b 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -225,7 +225,7 @@ void drw_state_set(DRWState state)
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,
+ DRW_STATE_BLEND_ALPHA_UNDER_PREMUL | DRW_STATE_BLEND_CUSTOM,
test)) {
if (test) {
glEnable(GL_BLEND);
@@ -262,6 +262,11 @@ void drw_state_set(DRWState state)
/* Let alpha accumulate. */
glBlendFunc(GL_ONE, GL_ONE);
}
+ else if ((state & DRW_STATE_BLEND_CUSTOM) != 0) {
+ /* Custom blend parameters using dual source blending.
+ * Can only be used with one Draw Buffer. */
+ glBlendFunc(GL_ONE, GL_SRC1_COLOR);
+ }
else {
BLI_assert(0);
}