Mesa (master): intel: Fallback to meta if we' re asked to CopyTexImage2D from RGB to RGBA

Kristian Høgsberg krh at
Tue Jun 1 11:36:30 PDT 2010

Module: Mesa
Branch: master
Commit: c7c64d97836c71eaf2ee3fc6d384877170b8c844

Author: Kristian Høgsberg <krh at>
Date:   Tue Jun  1 14:33:43 2010 -0400

intel: Fallback to meta if we're asked to CopyTexImage2D from RGB to RGBA

The pixel transfer rules state that we must set alpha to 1.0 in this case
which we can't easily do with the blitter.  We can do to passes: one that
sets the alpha to 0xff and one that copies the RGB bits or we can just
use the 3D engine.  Neither approach seems worth it for this case.


 src/mesa/drivers/dri/intel/intel_tex_copy.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c
index 549a4ac..ddc2c33 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_copy.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c
@@ -74,6 +74,14 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat)
       return NULL;
    case GL_RGBA:
    case GL_RGBA8:
+      irb = intel_renderbuffer(intel->ctx.ReadBuffer->_ColorReadBuffer);
+      /* We're required to set alpha to 1.0 in this case, but we can't
+       * do that with the blitter, so fall back.  We could use the 3D
+       * engine or do two passes with the blitter, but it doesn't seem
+       * worth it for this case. */
+      if (irb->Base._BaseFormat == GL_RGB)
+	 return NULL;
+      return irb->region;
    case GL_RGB:
    case GL_RGB8:
       return intel_readbuf_region(intel);

More information about the mesa-commit mailing list