/* Copypixels can be more than a straight copy. Ensure all the
* extra operations are disabled:
*/
- if (!intel_check_blit_fragment_ops(ctx) ||
+ if (!intel_check_blit_fragment_ops(ctx, GL_FALSE) ||
ctx->Pixel.ZoomX != 1.0F || ctx->Pixel.ZoomY != 1.0F)
return GL_FALSE;
#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);
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;
}
void intelInitPixelFuncs(struct dd_function_table *functions);
-GLboolean intel_check_blit_fragment_ops(GLcontext * ctx);
+GLboolean intel_check_blit_fragment_ops(GLcontext * ctx,
+ GLboolean src_alpha_is_one);
GLboolean intel_check_meta_tex_fragment_ops(GLcontext * ctx);
/* Does zoom apply to bitmaps?
*/
- if (!intel_check_blit_fragment_ops(ctx) ||
+ if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F) ||
ctx->Pixel.ZoomX != 1.0F ||
ctx->Pixel.ZoomY != 1.0F)
return GL_FALSE;
return GL_FALSE;
}
- if (!intel_check_blit_fragment_ops(ctx)) {
+ if (!intel_check_blit_fragment_ops(ctx, GL_FALSE)) {
if (INTEL_DEBUG & DEBUG_PIXEL)
_mesa_printf("%s - bad GL fragment state for blitter\n",
__FUNCTION__);