summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/intel/intel_pixel.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-06-24 11:44:42 -0700
committerEric Anholt <eric@anholt.net>2008-06-24 11:44:42 -0700
commitf5eb62a1161f050925c5c0b4839c437b29bdbc6b (patch)
tree146cb9c4ef12a274045c9748c807174ef1393c22 /src/mesa/drivers/dri/intel/intel_pixel.c
parentf23adc504d8202bbcc78121567a61c0b24819422 (diff)
intel: Avoid glBitmap software fallback for blending when no blending occurs.
Mesa demos tend to leave blending on but in GL_ONE/GL_ZERO, or GL_SRC_ALPHA/GL_ONE_MINUS_SRC_ALPHA with a source alpha of 1.0.
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_pixel.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_pixel.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c
index 72eb823bc4..6417866b20 100644
--- a/src/mesa/drivers/dri/intel/intel_pixel.c
+++ b/src/mesa/drivers/dri/intel/intel_pixel.c
@@ -35,12 +35,25 @@
#define FILE_DEBUG_FLAG DEBUG_PIXEL
+static GLenum
+effective_func(GLenum func, GLboolean src_alpha_is_one)
+{
+ if (src_alpha_is_one) {
+ if (func == GL_SRC_ALPHA)
+ return GL_ONE;
+ if (func == GL_ONE_MINUS_SRC_ALPHA)
+ return GL_ZERO;
+ }
+
+ return func;
+}
+
/**
* Check if any fragment operations are in effect which might effect
* glDraw/CopyPixels.
*/
GLboolean
-intel_check_blit_fragment_ops(GLcontext * ctx)
+intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one)
{
if (ctx->NewState)
_mesa_update_state(ctx);
@@ -50,7 +63,13 @@ intel_check_blit_fragment_ops(GLcontext * ctx)
return GL_FALSE;
}
- if (ctx->Color.BlendEnabled) {
+ if (ctx->Color.BlendEnabled &&
+ (effective_func(ctx->Color.BlendSrcRGB, src_alpha_is_one) != GL_ONE ||
+ effective_func(ctx->Color.BlendDstRGB, src_alpha_is_one) != GL_ZERO ||
+ ctx->Color.BlendEquationRGB != GL_FUNC_ADD ||
+ effective_func(ctx->Color.BlendSrcA, src_alpha_is_one) != GL_ONE ||
+ effective_func(ctx->Color.BlendDstA, src_alpha_is_one) != GL_ZERO ||
+ ctx->Color.BlendEquationA != GL_FUNC_ADD)) {
DBG("fallback due to blend\n");
return GL_FALSE;
}