intel: Partially fix fallback detection for glCopyTexSubImage.
authorEric Anholt <eric@anholt.net>
Fri, 10 Jul 2009 01:02:42 +0000 (18:02 -0700)
committerEric Anholt <eric@anholt.net>
Mon, 13 Jul 2009 17:57:12 +0000 (10:57 -0700)
Really, we should be checking that the MesaTexFormat for the read buffer
and the texture match, but the previous code wasn't even doing that, so
matching the cpp should be an improvement (and potentially fix some hangs!).
The previous code also rejected GL_RGB even though blitting the alpha
channel to the ignored channel of an x8r8g8b8 texture should be fine, which
tripped up compiz's blur plugin.

src/mesa/drivers/dri/intel/intel_tex_copy.c

index 0335c13..028b49c 100644 (file)
@@ -73,11 +73,8 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat)
       return NULL;
    case GL_RGBA:
    case GL_RGBA8:
-      return intel_readbuf_region(intel);
    case GL_RGB:
-      if (intel->ctx.Visual.rgbBits == 16)
-         return intel_readbuf_region(intel);
-      return NULL;
+      return intel_readbuf_region(intel);
    default:
       return NULL;
    }
@@ -99,8 +96,15 @@ do_copy_texsubimage(struct intel_context *intel,
 
    if (!intelImage->mt || !src) {
       if (INTEL_DEBUG & DEBUG_FALLBACKS)
-        fprintf(stderr, "%s fail %p %p\n",
-                __FUNCTION__, intelImage->mt, src);
+        fprintf(stderr, "%s fail %p %p (0x%08x)\n",
+                __FUNCTION__, intelImage->mt, src, internalFormat);
+      return GL_FALSE;
+   }
+
+   if (intelImage->mt->cpp != src->cpp) {
+      if (INTEL_DEBUG & DEBUG_FALLBACKS)
+        fprintf(stderr, "%s fail %d vs %d cpp\n",
+                __FUNCTION__, intelImage->mt->cpp, src->cpp);
       return GL_FALSE;
    }