DRW: Add DRW_STATE_BLEND_CUSTOM
This one enable dual source blending, enabling more fine tuned blending parameters inside the shader.
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user