summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/vega/shader.c
diff options
context:
space:
mode:
authorChia-I Wu <[email protected]>2010-12-04 21:42:51 +0800
committerChia-I Wu <[email protected]>2010-12-04 23:46:38 +0800
commit859106f196ade77f59f8787b071739901cd1a843 (patch)
tree632ca04f16bcf6ad64614b3cf86b278181591099 /src/gallium/state_trackers/vega/shader.c
parent0ee73edeccd21034e03e9e43dd0d09fa6fbf7842 (diff)
st/vega: Fix pipe blend state for various blend modes.
rgb_src_factor and rgb_dst_factor should be PIPE_BLENDFACTOR_ONE for VG_BLEND_SRC_IN and VG_BLEND_DST_IN respectively. VG_BLEND_SRC_OVER can be supported only when the fb has no alpha channel. VG_BLEND_DST_OVER and VG_BLEND_ADDITIVE have to be supported with a shader. Note that Porter-Duff blending rules assume premultiplied alpha.
Diffstat (limited to 'src/gallium/state_trackers/vega/shader.c')
-rw-r--r--src/gallium/state_trackers/vega/shader.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gallium/state_trackers/vega/shader.c b/src/gallium/state_trackers/vega/shader.c
index 92d3f5549e9..0ed721376cf 100644
--- a/src/gallium/state_trackers/vega/shader.c
+++ b/src/gallium/state_trackers/vega/shader.c
@@ -39,6 +39,7 @@
#include "util/u_inlines.h"
#include "util/u_memory.h"
#include "util/u_math.h"
+#include "util/u_format.h"
#define MAX_CONSTANTS 28
@@ -133,10 +134,16 @@ static VGboolean blend_use_shader(struct vg_context *ctx)
VGboolean advanced_blending;
switch (ctx->state.vg.blend_mode) {
+ case VG_BLEND_SRC_OVER:
+ advanced_blending =
+ util_format_has_alpha(ctx->draw_buffer->strb->format);
+ break;
+ case VG_BLEND_DST_OVER:
case VG_BLEND_MULTIPLY:
case VG_BLEND_SCREEN:
case VG_BLEND_DARKEN:
case VG_BLEND_LIGHTEN:
+ case VG_BLEND_ADDITIVE:
advanced_blending = VG_TRUE;
break;
default: