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:
2019-06-27 14:36:40 +02:00
parent 7f5a21177a
commit 1f4e9754c0
2 changed files with 12 additions and 5 deletions

View File

@@ -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);
}