intel: Add the MESA_FORMAT as a field of the miptree.
authorEric Anholt <eric@anholt.net>
Thu, 9 Jun 2011 16:16:47 +0000 (09:16 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 14 Jun 2011 18:15:43 +0000 (11:15 -0700)
We only had internal_format before, which is way more irritating to
work with.

src/mesa/drivers/dri/intel/intel_fbo.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.c
src/mesa/drivers/dri/intel/intel_mipmap_tree.h
src/mesa/drivers/dri/intel/intel_tex_image.c
src/mesa/drivers/dri/intel/intel_tex_validate.c

index 591df410201b9c4adc548f3889e11a0475fae769..e53dd8a073adac872d730349c6c40d5a8f74d78f 100644 (file)
@@ -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,
index 55eb9a124a3ec5875b283587d77c9967ea237bfe..a96398cc5deb420647a5e354f820a40bf8b483c5 100644 (file)
@@ -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,
index 325e3916981bfb70cee5aa034f129aa2a5755a55..0ce8c091295323e09de824c21893f5d5f374c4f1 100644 (file)
@@ -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,
index bc39f4ad83f412539af5630bd9eb758950454769..b5084e8b4fec49af813cdbf2b84389d1e98cc649 100644 (file)
@@ -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)
index 27f2646ebf595e4fb5602b308b1c205cf69e6464..fea61621dd0cf961a81b2e37cc4d41df17458618 100644 (file)
@@ -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,