Mesa (master): intel: Clean up check_pbo_format to ignore internalFormat.

Eric Anholt anholt at kemper.freedesktop.org
Thu Sep 22 18:48:03 UTC 2011


Module: Mesa
Branch: master
Commit: 3bb536e4c7b7fb0c0a9b18f5ca2d111996b0ddeb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3bb536e4c7b7fb0c0a9b18f5ca2d111996b0ddeb

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Sep 21 09:37:51 2011 -0700

intel: Clean up check_pbo_format to ignore internalFormat.

All that matters here is the format of the texture, not the
internalformat (which might mean various different pixel formats).  In
one case, the pbo upload for MESA_FORMAT_YCBCR would have swapped the
channels for MESA_FORMAT_YCBCR_REV.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/intel/intel_tex_image.c |   38 +++++++++-----------------
 1 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index 9a12495..595eeb0 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -123,33 +123,22 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
 /* There are actually quite a few combinations this will work for,
  * more than what I've listed here.
  */
-static GLboolean
-check_pbo_format(GLint internalFormat,
-                 GLenum format, GLenum type,
+static bool
+check_pbo_format(GLenum format, GLenum type,
                  gl_format mesa_format)
 {
-   switch (internalFormat) {
-   case 4:
-   case GL_RGBA:
-   case GL_RGBA8:
-      return (format == GL_BGRA &&
-              (type == GL_UNSIGNED_BYTE ||
-               type == GL_UNSIGNED_INT_8_8_8_8_REV) &&
-              mesa_format == MESA_FORMAT_ARGB8888);
-   case 3:
-   case GL_RGB:
-      return (format == GL_RGB &&
-              type == GL_UNSIGNED_SHORT_5_6_5 &&
-              mesa_format == MESA_FORMAT_RGB565);
-   case 1:
-   case GL_LUMINANCE:
-      return (format == GL_LUMINANCE &&
-	      type == GL_UNSIGNED_BYTE &&
-	      mesa_format == MESA_FORMAT_L8);
-   case GL_YCBCR_MESA:
+   switch (mesa_format) {
+   case MESA_FORMAT_ARGB8888:
+      return (format == GL_BGRA && (type == GL_UNSIGNED_BYTE ||
+				    type == GL_UNSIGNED_INT_8_8_8_8_REV));
+   case MESA_FORMAT_RGB565:
+      return (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5);
+   case MESA_FORMAT_L8:
+      return (format == GL_LUMINANCE && type == GL_UNSIGNED_BYTE);
+   case MESA_FORMAT_YCBCR:
       return (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE);
    default:
-      return GL_FALSE;
+      return false;
    }
 }
 
@@ -184,8 +173,7 @@ try_pbo_upload(struct intel_context *intel,
       return false;
    }
 
-   if (!check_pbo_format(intelImage->base.Base.InternalFormat, format,
-			 type, intelImage->base.Base.TexFormat)) {
+   if (!check_pbo_format(format, type, intelImage->base.Base.TexFormat)) {
       DBG("%s: format mismatch (upload to %s with format 0x%x, type 0x%x)\n",
 	  __FUNCTION__, _mesa_get_format_name(intelImage->base.Base.TexFormat),
 	  format, type);




More information about the mesa-commit mailing list