[Mesa-dev] [PATCH 3/3] intel: Drop texture border support code.

Eric Anholt eric at anholt.net
Mon Oct 24 16:15:59 PDT 2011


---
 src/mesa/drivers/dri/i965/brw_fallback.c        |   16 +---------
 src/mesa/drivers/dri/intel/intel_mipmap_tree.c  |    4 --
 src/mesa/drivers/dri/intel/intel_tex.c          |   12 ++-----
 src/mesa/drivers/dri/intel/intel_tex_image.c    |   36 +++++-----------------
 src/mesa/drivers/dri/intel/intel_tex_validate.c |    7 ----
 5 files changed, 13 insertions(+), 62 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c
index ae08cf5..fbaf418 100644
--- a/src/mesa/drivers/dri/i965/brw_fallback.c
+++ b/src/mesa/drivers/dri/i965/brw_fallback.c
@@ -56,20 +56,6 @@ static bool do_check_fallback(struct brw_context *brw)
       return true;
    }
 
-   /* _NEW_TEXTURE:
-    */
-   for (i = 0; i < BRW_MAX_TEX_UNIT; i++) {
-      struct gl_texture_unit *texUnit = &ctx->Texture.Unit[i];
-      if (texUnit->_ReallyEnabled) {
-	 struct gl_texture_object *tex_obj = texUnit->_Current;
-	 struct gl_texture_image *texImage = tex_obj->Image[0][tex_obj->BaseLevel];
-	 if (texImage->Border) {
-	    DBG("FALLBACK: texture border\n");
-	    return true;
-	 }
-      }
-   }
-
    return false;
 }
 
@@ -80,7 +66,7 @@ static void check_fallback(struct brw_context *brw)
 
 const struct brw_tracked_state brw_check_fallback = {
    .dirty = {
-      .mesa = _NEW_RENDERMODE | _NEW_TEXTURE | _NEW_STENCIL,
+      .mesa = _NEW_RENDERMODE | _NEW_STENCIL,
       .brw  = 0,
       .cache = 0
    },
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 9eb81de..045de33 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -246,10 +246,6 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt,
    GLuint level = intelImage->base.Base.Level;
    int width, height, depth;
 
-   /* Images with borders are never pulled into mipmap trees. */
-   if (image->Border)
-      return false;
-
    if (image->TexFormat != mt->format)
       return false;
 
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 5806659..bed93e6 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -61,6 +61,8 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
    struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
    GLuint slices;
 
+   assert(image->Border == 0);
+
    /* Because the driver uses AllocTextureImageBuffer() internally, it may end
     * up mismatched with FreeTextureImageBuffer(), but that is safe to call
     * multiple times.
@@ -93,8 +95,7 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
       DBG("%s: alloc obj %p level %d %dx%dx%d using object's miptree %p\n",
           __FUNCTION__, texobj, image->Level,
           width, height, depth, intel_texobj->mt);
-      return true;
-   } else if (image->Border == 0) {
+   } else {
       intel_image->mt = intel_miptree_create_for_teximage(intel, intel_texobj,
                                                           intel_image,
                                                           false);
@@ -114,14 +115,9 @@ intel_alloc_texture_image_buffer(struct gl_context *ctx,
       DBG("%s: alloc obj %p level %d %dx%dx%d using new miptree %p\n",
           __FUNCTION__, texobj, image->Level,
           width, height, depth, intel_image->mt);
-      return true;
    }
 
-   DBG("%s: alloc obj %p level %d %dx%dx%d using swrast\n",
-       __FUNCTION__, texobj, image->Level, width, height, depth);
-
-   return _swrast_alloc_texture_image_buffer(ctx, image, format,
-					     width, height, depth);
+   return true;
 }
 
 static void
diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c
index d052684..eaf034a 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_image.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_image.c
@@ -26,24 +26,8 @@
 
 #define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
-/* Functions to store texture images.  Where possible, mipmap_tree's
- * will be created or further instantiated with image data, otherwise
- * images will be stored in malloc'd memory.  A validation step is
- * required to pull those images into a mipmap tree, or otherwise
- * decide a fallback is required.
- */
-
-
-
-/* Otherwise, store it in memory if (Border != 0) or (any dimension ==
- * 1).
- *    
- * Otherwise, if max_level >= level >= min_level, create tree with
- * space for textures from min_level down to max_level.
- *
- * Otherwise, create tree with space for textures from (level
- * 0)..(1x1).  Consider pruning this tree at a validation if the
- * saving is worth it.
+/* Work back from the specified level of the image to the baselevel and create a
+ * miptree of that size.
  */
 struct intel_mipmap_tree *
 intel_miptree_create_for_teximage(struct intel_context *intel,
@@ -61,9 +45,6 @@ intel_miptree_create_for_teximage(struct intel_context *intel,
 
    DBG("%s\n", __FUNCTION__);
 
-   if (intelImage->base.Base.Border)
-      return NULL;
-
    if (intelImage->base.Base.Level > intelObj->base.BaseLevel &&
        (width == 1 ||
         (intelObj->base.Target != GL_TEXTURE_1D && height == 1) ||
@@ -350,14 +331,13 @@ intelTexImage(struct gl_context * ctx,
               GLenum target, GLint level,
               GLint internalFormat,
               GLint width, GLint height, GLint depth,
-              GLint border,
               GLenum format, GLenum type, const void *pixels,
               const struct gl_pixelstore_attrib *unpack,
               struct gl_texture_object *texObj,
               struct gl_texture_image *texImage, GLsizei imageSize)
 {
-   DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__,
-       _mesa_lookup_enum_by_nr(target), level, width, height, depth, border);
+   DBG("%s target %s level %d %dx%dx%d\n", __FUNCTION__,
+       _mesa_lookup_enum_by_nr(target), level, width, height, depth);
 
    /* Attempt to use the blitter for PBO image uploads.
     */
@@ -371,7 +351,7 @@ intelTexImage(struct gl_context * ctx,
        __FUNCTION__, width, height, depth, pixels);
 
    _mesa_store_teximage3d(ctx, target, level, internalFormat,
-			  width, height, depth, border,
+			  width, height, depth, 0,
 			  format, type, pixels,
 			  unpack, texObj, texImage);
 }
@@ -389,7 +369,7 @@ intelTexImage3D(struct gl_context * ctx,
                 struct gl_texture_image *texImage)
 {
    intelTexImage(ctx, 3, target, level,
-                 internalFormat, width, height, depth, border,
+                 internalFormat, width, height, depth,
                  format, type, pixels, unpack, texObj, texImage, 0);
 }
 
@@ -405,7 +385,7 @@ intelTexImage2D(struct gl_context * ctx,
                 struct gl_texture_image *texImage)
 {
    intelTexImage(ctx, 2, target, level,
-                 internalFormat, width, height, 1, border,
+                 internalFormat, width, height, 1,
                  format, type, pixels, unpack, texObj, texImage, 0);
 }
 
@@ -421,7 +401,7 @@ intelTexImage1D(struct gl_context * ctx,
                 struct gl_texture_image *texImage)
 {
    intelTexImage(ctx, 1, target, level,
-                 internalFormat, width, 1, 1, border,
+                 internalFormat, width, 1, 1,
                  format, type, pixels, unpack, texObj, texImage, 0);
 }
 
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 6639de9..a657732 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -52,13 +52,6 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
    intel_update_max_level(intelObj, sampler);
    firstImage = intel_texture_image(tObj->Image[0][tObj->BaseLevel]);
 
-   /* Fallback case:
-    */
-   if (firstImage->base.Base.Border) {
-      intel_miptree_release(&intelObj->mt);
-      return false;
-   }
-
    intel_miptree_get_dimensions_for_image(&firstImage->base.Base,
                                           &width, &height, &depth);
 
-- 
1.7.7



More information about the mesa-dev mailing list