intel: Drop our custom glGetTexImage() code.
authorEric Anholt <eric@anholt.net>
Mon, 1 Aug 2011 04:02:46 +0000 (21:02 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 27 Sep 2011 19:12:07 +0000 (12:12 -0700)
The mesa core code uses MapTextureImage() like we need now.

v2: Drop mapping around _mesa_generate_mipmap for compressed, since
    the whole path ends up going through MapTextureImage(), and the
    meta decompression code ended up causing us to lose track of the
    region that was originally mapped and assertion fail.

src/mesa/drivers/dri/intel/intel_tex.c
src/mesa/drivers/dri/intel/intel_tex_image.c

index 61e705c7d25789c9024a7c53d05f30774107c923..55b3e349b4cfd91b83e31e5ca132c4254aba1f18 100644 (file)
@@ -170,9 +170,13 @@ intelGenerateMipmap(struct gl_context *ctx, GLenum target,
 
       fallback_debug("%s - fallback to swrast\n", __FUNCTION__);
 
-      intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel);
-      _mesa_generate_mipmap(ctx, target, texObj);
-      intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel);
+      if (_mesa_is_format_compressed(first_image->TexFormat)) {
+         _mesa_generate_mipmap(ctx, target, texObj);
+      } else {
+         intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel);
+         _mesa_generate_mipmap(ctx, target, texObj);
+         intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel);
+      }
 
       if (!_mesa_is_format_compressed(first_image->TexFormat)) {
          GLuint nr_faces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
index 96717d31717ff094713d7845a3cbaa704455527f..fb91e40a6d61f1da4dd8f9bb86e178f558b3fe92 100644 (file)
@@ -510,65 +510,6 @@ intelTexImage1D(struct gl_context * ctx,
                  format, type, pixels, unpack, texObj, texImage, 0);
 }
 
-static void
-intelGetTexImage(struct gl_context * ctx, GLenum target, GLint level,
-                 GLenum format, GLenum type, GLvoid * pixels,
-                 struct gl_texture_object *texObj,
-                 struct gl_texture_image *texImage)
-{
-   struct intel_context *intel = intel_context(ctx);
-   struct intel_texture_image *intelImage = intel_texture_image(texImage);
-
-   /* If we're reading from a texture that has been rendered to, need to
-    * make sure rendering is complete.
-    * We could probably predicate this on texObj->_RenderToTexture
-    */
-   intel_flush(ctx);
-
-   /* Map */
-   if (intelImage->mt) {
-      /* Image is stored in hardware format in a buffer managed by the
-       * kernel.  Need to explicitly map and unmap it.
-       */
-      intelImage->base.Base.Data =
-         intel_miptree_image_map(intel,
-                                 intelImage->mt,
-                                 intelImage->base.Base.Face,
-                                 intelImage->base.Base.Level,
-                                 &intelImage->base.Base.RowStride,
-                                 intelImage->base.Base.ImageOffsets);
-      intelImage->base.Base.RowStride /= intelImage->mt->cpp;
-   }
-   else {
-      /* Otherwise, the image should actually be stored in
-       * intelImage->base.Base.Data.  This is pretty confusing for
-       * everybody, I'd much prefer to separate the two functions of
-       * texImage->Data - storage for texture images in main memory
-       * and access (ie mappings) of images.  In other words, we'd
-       * create a new texImage->Map field and leave Data simply for
-       * storage.
-       */
-      assert(intelImage->base.Base.Data);
-   }
-
-   if (intelImage->stencil_rb) {
-      /*
-       * The texture has packed depth/stencil format, but uses separate
-       * stencil. The texture's embedded stencil buffer contains the real
-       * stencil data, so copy that into the miptree.
-       */
-      intel_tex_image_s8z24_gather(intel, intelImage);
-   }
-
-   _mesa_get_teximage(ctx, target, level, format, type, pixels,
-                     texObj, texImage);
-
-   /* Unmap */
-   if (intelImage->mt) {
-      intel_miptree_image_unmap(intel, intelImage->mt);
-      intelImage->base.Base.Data = NULL;
-   }
-}
 
 /**
  * Binds a region to a texture image, like it was uploaded by glTexImage2D().
@@ -686,7 +627,6 @@ intelInitTextureImageFuncs(struct dd_function_table *functions)
    functions->TexImage1D = intelTexImage1D;
    functions->TexImage2D = intelTexImage2D;
    functions->TexImage3D = intelTexImage3D;
-   functions->GetTexImage = intelGetTexImage;
 
 #if FEATURE_OES_EGL_image
    functions->EGLImageTargetTexture2D = intel_image_target_texture_2d;