libobs: libobs-d3d11: obs-filters: No excess alpha

Currently SrcBlendAlpha and DestBlendAlpha are both ONE, and can
combine together to form two. This is not a noticeable problem for
UNORM targets because the channels are clamped, but it will likely
become a problem if FLOAT targets are more widely used.

This change switches DestBlendAlpha to INVSRCALPHA, and starts
backgrounds as opaque black instead of transparent black. The blending
behavior of stacked transparents is preserved without overflowing the
alpha channel.
This commit is contained in:
James Park
2019-03-26 21:38:42 -07:00
parent a0ead6f974
commit d91bd327d7
7 changed files with 10 additions and 10 deletions

View File

@@ -230,7 +230,7 @@ static void gpu_delay_filter_render(void *data, gs_effect_t *effect)
bool async = (parent_flags & OBS_SOURCE_ASYNC) != 0;
struct vec4 clear_color;
vec4_zero(&clear_color);
vec4_set(&clear_color, 0.0f, 0.0f, 0.0f, 1.0f);
gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0);
gs_ortho(0.0f, (float)f->cx, 0.0f, (float)f->cy,
-100.0f, 100.0f);