Mesa (master): intel: Add the MESA_FORMAT as a field of the miptree.

Eric Anholt anholt at kemper.freedesktop.org
Tue Jun 14 11:24:18 PDT 2011


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jun  9 09:16:47 2011 -0700

intel: Add the MESA_FORMAT as a field of the miptree.

We only had internal_format before, which is way more irritating to
work with.

---

 src/mesa/drivers/dri/intel/intel_fbo.c          |    1 +
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |    8 ++++++--
 src/mesa/drivers/dri/intel/intel_mipmap_tree.h  |    3 +++
 src/mesa/drivers/dri/intel/intel_tex_image.c    |    5 +++--
 src/mesa/drivers/dri/intel/intel_tex_validate.c |    1 +
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 591df41..e53dd8a 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -641,6 +641,7 @@ intel_render_texture(struct gl_context * ctx,
       texel_bytes = _mesa_get_format_bytes(intel_image->base.TexFormat);
 
       new_mt = intel_miptree_create(intel, image->TexObject->Target,
+				    intel_image->base.TexFormat,
 				    intel_image->base._BaseFormat,
 				    intel_image->base.InternalFormat,
 				    intel_image->level,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 55eb9a1..a96398c 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -55,6 +55,7 @@ target_to_target(GLenum target)
 static struct intel_mipmap_tree *
 intel_miptree_create_internal(struct intel_context *intel,
 			      GLenum target,
+			      gl_format format,
 			      GLenum internal_format,
 			      GLuint first_level,
 			      GLuint last_level,
@@ -72,6 +73,7 @@ intel_miptree_create_internal(struct intel_context *intel,
        first_level, last_level, mt);
 
    mt->target = target_to_target(target);
+   mt->format = format;
    mt->internal_format = internal_format;
    mt->first_level = first_level;
    mt->last_level = last_level;
@@ -104,6 +106,7 @@ intel_miptree_create_internal(struct intel_context *intel,
 struct intel_mipmap_tree *
 intel_miptree_create(struct intel_context *intel,
 		     GLenum target,
+		     gl_format format,
 		     GLenum base_format,
 		     GLenum internal_format,
 		     GLuint first_level,
@@ -125,7 +128,7 @@ intel_miptree_create(struct intel_context *intel,
 	 tiling = I915_TILING_X;
    }
 
-   mt = intel_miptree_create_internal(intel, target, internal_format,
+   mt = intel_miptree_create_internal(intel, target, format, internal_format,
 				      first_level, last_level, width0,
 				      height0, depth0, cpp, compress_byte,
 				      tiling);
@@ -156,6 +159,7 @@ intel_miptree_create(struct intel_context *intel,
 struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
 				GLenum target,
+				gl_format format,
 				GLenum internal_format,
 				struct intel_region *region,
 				GLuint depth0,
@@ -163,7 +167,7 @@ intel_miptree_create_for_region(struct intel_context *intel,
 {
    struct intel_mipmap_tree *mt;
 
-   mt = intel_miptree_create_internal(intel, target, internal_format,
+   mt = intel_miptree_create_internal(intel, target, format, internal_format,
 				      0, 0,
 				      region->width, region->height, 1,
 				      region->cpp, compress_byte,
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 325e391..0ce8c09 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -91,6 +91,7 @@ struct intel_mipmap_tree
    /* Effectively the key:
     */
    GLenum target;
+   gl_format format;
    GLenum internal_format;
 
    GLuint first_level;
@@ -136,6 +137,7 @@ struct intel_mipmap_tree
 
 struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,
                                                GLenum target,
+					       gl_format format,
                                                GLenum base_format,
                                                GLenum internal_format,
                                                GLuint first_level,
@@ -150,6 +152,7 @@ struct intel_mipmap_tree *intel_miptree_create(struct intel_context *intel,
 struct intel_mipmap_tree *
 intel_miptree_create_for_region(struct intel_context *intel,
 				GLenum target,
+				gl_format format,
 				GLenum internal_format,
 				struct intel_region *region,
 				GLuint depth0,
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index bc39f4a..b5084e8 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -115,6 +115,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
 
    return intel_miptree_create(intel,
 			       intelObj->base.Target,
+			       intelImage->base.TexFormat,
 			       intelImage->base._BaseFormat,
 			       intelImage->base.InternalFormat,
 			       firstLevel,
@@ -692,7 +693,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
       texFormat = MESA_FORMAT_ARGB8888;
    }
 
-   mt = intel_miptree_create_for_region(intel, target,
+   mt = intel_miptree_create_for_region(intel, target, texFormat,
 					internalFormat, rb->region, 1, 0);
    if (mt == NULL)
        return;
@@ -756,7 +757,7 @@ intel_image_target_texture_2d(struct gl_context *ctx, GLenum target,
    if (image == NULL)
       return;
 
-   mt = intel_miptree_create_for_region(intel, target,
+   mt = intel_miptree_create_for_region(intel, target, image->format,
 					image->internal_format,
 					image->region, 1, 0);
    if (mt == NULL)
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 27f2646..fea6162 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -135,6 +135,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
    if (!intelObj->mt) {
       intelObj->mt = intel_miptree_create(intel,
                                           intelObj->base.Target,
+					  firstImage->base.TexFormat,
                                           firstImage->base._BaseFormat,
                                           firstImage->base.InternalFormat,
                                           tObj->BaseLevel,



More information about the mesa-commit mailing list