From 3f0a966807f03a364edea0272ddf45f08ab7ce4f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 30 Jan 2011 22:54:40 +0800 Subject: st/vega: Disable blending when the paint is opaque. When the paint is opaque (currently, solid color with alpha 1.0f), no blending is needed for VG_BLEND_SRC_OVER. This eliminates the serious performance hit introduced by 859106f196ade77f59f8787b071739901cd1a843 for a common scenario. --- src/gallium/state_trackers/vega/renderer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/gallium/state_trackers/vega/renderer.c') diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index e42bad76492..936bf2e4e03 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -28,6 +28,7 @@ #include "renderer.h" #include "vg_context.h" +#include "paint.h" /* for paint_is_opaque */ #include "pipe/p_context.h" #include "pipe/p_state.h" @@ -1289,7 +1290,11 @@ static void renderer_validate_blend(struct renderer *renderer, blend.rt[0].alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; break; case VG_BLEND_SRC_OVER: - if (!util_format_has_alpha(fb_format)) { + if (paint_is_opaque(state->fill_paint) && + paint_is_opaque(state->stroke_paint)) { + /* no blending */ + } + else if (!util_format_has_alpha(fb_format)) { blend.rt[0].rgb_src_factor = PIPE_BLENDFACTOR_SRC_ALPHA; blend.rt[0].alpha_src_factor = PIPE_BLENDFACTOR_ONE; blend.rt[0].rgb_dst_factor = PIPE_BLENDFACTOR_INV_SRC_ALPHA; -- cgit v1.2.3