i965: Use {} to initialize GENX_* structs.
[mesa.git] / src / mesa / drivers / dri / i965 / intel_tex.c
index e98e9bbfc4678eadbf66709f9305d0a6a937f340..7ce2ceb9a2f7f72e555d34a5ccd5adccaa7284d3 100644 (file)
-/**************************************************************************
- * 
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
- * All Rights Reserved.
- * 
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sub license, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- * 
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- * 
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
- * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
- * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- * 
- **************************************************************************/
-
-#include "mtypes.h"
-#include "image.h"
-#include "texstore.h"
-#include "texformat.h"
-#include "teximage.h"
-#include "texobj.h"
 #include "swrast/swrast.h"
-
-
-#include "intel_context.h"
-#include "intel_tex.h"
+#include "main/renderbuffer.h"
+#include "main/texobj.h"
+#include "main/teximage.h"
+#include "main/mipmap.h"
+#include "drivers/common/meta.h"
+#include "brw_context.h"
+#include "brw_defines.h"
+#include "intel_buffer_objects.h"
 #include "intel_mipmap_tree.h"
+#include "intel_tex.h"
+#include "intel_fbo.h"
 
+#define FILE_DEBUG_FLAG DEBUG_TEXTURE
 
-static GLuint target_to_face( GLenum target )
+static struct gl_texture_image *
+intelNewTextureImage(struct gl_context * ctx)
 {
-   switch (target) {
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
-   case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
-   case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
-      return ((GLuint) target - 
-             (GLuint) GL_TEXTURE_CUBE_MAP_POSITIVE_X);
-   default:
-      return 0;
-   }
+   DBG("%s\n", __func__);
+   (void) ctx;
+   return (struct gl_texture_image *) CALLOC_STRUCT(intel_texture_image);
 }
 
-static void intelTexImage1D( GLcontext *ctx, GLenum target, GLint level,
-                           GLint internalFormat,
-                           GLint width, GLint border,
-                           GLenum format, GLenum type, const GLvoid *pixels,
-                           const struct gl_pixelstore_attrib *packing,
-                           struct gl_texture_object *texObj,
-                           struct gl_texture_image *texImage )
+static void
+intelDeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img)
 {
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-
-   _mesa_store_teximage1d( ctx, target, level, internalFormat,
-                          width, border, format, type,
-                          pixels, packing, texObj, texImage );
-
-   intelObj->dirty_images[0] |= (1 << level);
-   intelObj->dirty |= 1;
+   /* nothing special (yet) for intel_texture_image */
+   _mesa_delete_texture_image(ctx, img);
 }
 
-static void intelTexSubImage1D( GLcontext *ctx, 
-                              GLenum target,
-                              GLint level,     
-                              GLint xoffset,
-                               GLsizei width,
-                              GLenum format, GLenum type,
-                              const GLvoid *pixels,
-                              const struct gl_pixelstore_attrib *packing,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage )
+
+static struct gl_texture_object *
+intelNewTextureObject(struct gl_context * ctx, GLuint name, GLenum target)
 {
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
+   struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object);
 
-   _mesa_store_texsubimage1d(ctx, target, level, xoffset, width, 
-                            format, type, pixels, packing, texObj,
-                            texImage);
+   (void) ctx;
 
-   intelObj->dirty_images[0] |= (1 << level);
-   intelObj->dirty |= 1;
-}
+   DBG("%s\n", __func__);
 
+   if (obj == NULL)
+      return NULL;
 
-/* Handles 2D, CUBE, RECT:
- */
-static void intelTexImage2D( GLcontext *ctx, GLenum target, GLint level,
-                           GLint internalFormat,
-                           GLint width, GLint height, GLint border,
-                           GLenum format, GLenum type, const GLvoid *pixels,
-                           const struct gl_pixelstore_attrib *packing,
-                           struct gl_texture_object *texObj,
-                           struct gl_texture_image *texImage )
-{
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-   GLuint face = target_to_face(target);
+   _mesa_initialize_texture_object(ctx, &obj->base, name, target);
 
-   _mesa_store_teximage2d( ctx, target, level, internalFormat,
-                          width, height, border, format, type,
-                          pixels, packing, texObj, texImage );
+   obj->needs_validate = true;
 
-   intelObj->dirty_images[face] |= (1 << level);
-   intelObj->dirty |= 1 << face;
+   return &obj->base;
 }
 
-static void intelTexSubImage2D( GLcontext *ctx, 
-                              GLenum target,
-                              GLint level,     
-                              GLint xoffset, GLint yoffset,
-                              GLsizei width, GLsizei height,
-                              GLenum format, GLenum type,
-                              const GLvoid *pixels,
-                              const struct gl_pixelstore_attrib *packing,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage )
+static void
+intelDeleteTextureObject(struct gl_context *ctx,
+                        struct gl_texture_object *texObj)
 {
    struct intel_texture_object *intelObj = intel_texture_object(texObj);
-   GLuint face = target_to_face(target);
-
-   _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width, 
-                            height, format, type, pixels, packing, texObj,
-                            texImage);
 
-   intelObj->dirty_images[face] |= (1 << level);
-   intelObj->dirty |= 1 << face;
+   intel_miptree_release(&intelObj->mt);
+   _mesa_delete_texture_object(ctx, texObj);
 }
 
-static void intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level,
-                              GLint internalFormat,
-                              GLint width, GLint height, GLint border,
-                              GLsizei imageSize, const GLvoid *data,
-                              struct gl_texture_object *texObj,
-                              struct gl_texture_image *texImage )
+static GLboolean
+intel_alloc_texture_image_buffer(struct gl_context *ctx,
+                                struct gl_texture_image *image)
 {
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-   GLuint face = target_to_face(target);
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_texture_image *intel_image = intel_texture_image(image);
+   struct gl_texture_object *texobj = image->TexObject;
+   struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
+
+   assert(image->Border == 0);
+
+   /* Quantize sample count */
+   if (image->NumSamples) {
+      image->NumSamples = intel_quantize_num_samples(brw->screen, image->NumSamples);
+      if (!image->NumSamples)
+         return false;
+   }
 
-   _mesa_store_compressed_teximage2d(ctx, target, level, internalFormat, width,
-                                    height, border, imageSize, data, texObj, texImage);
-   
-   intelObj->dirty_images[face] |= (1 << level);
-   intelObj->dirty |= 1 << face;
-}
+   /* Because the driver uses AllocTextureImageBuffer() internally, it may end
+    * up mismatched with FreeTextureImageBuffer(), but that is safe to call
+    * multiple times.
+    */
+   ctx->Driver.FreeTextureImageBuffer(ctx, image);
+
+   if (!_swrast_init_texture_image(image))
+      return false;
+
+   if (intel_texobj->mt &&
+       intel_miptree_match_image(intel_texobj->mt, image)) {
+      intel_miptree_reference(&intel_image->mt, intel_texobj->mt);
+      DBG("%s: alloc obj %p level %d %dx%dx%d using object's miptree %p\n",
+          __func__, texobj, image->Level,
+          image->Width, image->Height, image->Depth, intel_texobj->mt);
+   } else {
+      intel_image->mt = intel_miptree_create_for_teximage(brw, intel_texobj,
+                                                          intel_image,
+                                                          1 /* samples */);
+      if (!intel_image->mt)
+         return false;
+
+      /* Even if the object currently has a mipmap tree associated
+       * with it, this one is a more likely candidate to represent the
+       * whole object since our level didn't fit what was there
+       * before, and any lower levels would fit into our miptree.
+       */
+      intel_miptree_reference(&intel_texobj->mt, intel_image->mt);
 
+      DBG("%s: alloc obj %p level %d %dx%dx%d using new miptree %p\n",
+          __func__, texobj, image->Level,
+          image->Width, image->Height, image->Depth, intel_image->mt);
+   }
 
-static void intelCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
-                                 GLint xoffset, GLint yoffset,
-                                 GLsizei width, GLsizei height,
-                                 GLenum format,
-                                 GLsizei imageSize, const GLvoid *data,
-                                 struct gl_texture_object *texObj,
-                                 struct gl_texture_image *texImage )
-{
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-   GLuint face = target_to_face(target);
+   intel_texobj->needs_validate = true;
 
-   _mesa_store_compressed_texsubimage2d(ctx, target, level, xoffset, yoffset, width,
-                                       height, format, imageSize, data, texObj, texImage);
-   
-   intelObj->dirty_images[face] |= (1 << level);
-   intelObj->dirty |= 1 << face;
+   return true;
 }
 
-
-static void intelTexImage3D( GLcontext *ctx, GLenum target, GLint level,
-                            GLint internalFormat,
-                            GLint width, GLint height, GLint depth,
-                            GLint border,
-                            GLenum format, GLenum type, const GLvoid *pixels,
-                            const struct gl_pixelstore_attrib *packing,
-                            struct gl_texture_object *texObj,
-                            struct gl_texture_image *texImage )
+/**
+ * ctx->Driver.AllocTextureStorage() handler.
+ *
+ * Compare this to _mesa_AllocTextureStorage_sw, which would call into
+ * intel_alloc_texture_image_buffer() above.
+ */
+static GLboolean
+intel_alloc_texture_storage(struct gl_context *ctx,
+                            struct gl_texture_object *texobj,
+                            GLsizei levels, GLsizei width,
+                            GLsizei height, GLsizei depth)
 {
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_texture_object *intel_texobj = intel_texture_object(texobj);
+   struct gl_texture_image *first_image = texobj->Image[0][0];
+   int num_samples = intel_quantize_num_samples(brw->screen,
+                                                first_image->NumSamples);
+   const int numFaces = _mesa_num_tex_faces(texobj->Target);
+   int face;
+   int level;
+
+   /* If the object's current miptree doesn't match what we need, make a new
+    * one.
+    */
+   if (!intel_texobj->mt ||
+       !intel_miptree_match_image(intel_texobj->mt, first_image) ||
+       intel_texobj->mt->last_level != levels - 1) {
+      intel_miptree_release(&intel_texobj->mt);
+
+      intel_get_image_dims(first_image, &width, &height, &depth);
+      intel_texobj->mt = intel_miptree_create(brw, texobj->Target,
+                                              first_image->TexFormat,
+                                              0, levels - 1,
+                                              width, height, depth,
+                                              MAX2(num_samples, 1),
+                                              MIPTREE_LAYOUT_TILING_ANY);
+
+      if (intel_texobj->mt == NULL) {
+         return false;
+      }
+   }
+
+   for (face = 0; face < numFaces; face++) {
+      for (level = 0; level < levels; level++) {
+         struct gl_texture_image *image = texobj->Image[face][level];
+         struct intel_texture_image *intel_image = intel_texture_image(image);
+
+         image->NumSamples = num_samples;
+
+         _swrast_free_texture_image_buffer(ctx, image);
+         if (!_swrast_init_texture_image(image))
+            return false;
 
-   _mesa_store_teximage3d(ctx, target, level, internalFormat,
-                         width, height, depth, border,
-                         format, type, pixels,
-                         &ctx->Unpack, texObj, texImage);
-   
-   intelObj->dirty_images[0] |= (1 << level);
-   intelObj->dirty |= 1 << 0;
+         intel_miptree_reference(&intel_image->mt, intel_texobj->mt);
+      }
+   }
+
+   /* The miptree is in a validated state, so no need to check later. */
+   intel_texobj->needs_validate = false;
+   intel_texobj->validated_first_level = 0;
+   intel_texobj->validated_last_level = levels - 1;
+   intel_texobj->_Format = intel_texobj->mt->format;
+
+   return true;
 }
 
 
 static void
-intelTexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
-                   GLint xoffset, GLint yoffset, GLint zoffset,
-                   GLsizei width, GLsizei height, GLsizei depth,
-                   GLenum format, GLenum type,
-                   const GLvoid *pixels,
-                   const struct gl_pixelstore_attrib *packing,
-                   struct gl_texture_object *texObj,
-                   struct gl_texture_image *texImage )
+intel_free_texture_image_buffer(struct gl_context * ctx,
+                               struct gl_texture_image *texImage)
 {
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
+   struct intel_texture_image *intelImage = intel_texture_image(texImage);
 
-   _mesa_store_texsubimage3d(ctx, target, level, xoffset, yoffset, zoffset,
-                             width, height, depth,
-                             format, type, pixels, packing, texObj, texImage);
-
-   intelObj->dirty_images[0] |= (1 << level);
-   intelObj->dirty |= 1 << 0;
-}
+   DBG("%s\n", __func__);
 
+   intel_miptree_release(&intelImage->mt);
 
+   _swrast_free_texture_image_buffer(ctx, texImage);
+}
 
+/**
+ * Map texture memory/buffer into user space.
+ * Note: the region of interest parameters are ignored here.
+ * \param mode  bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT
+ * \param mapOut  returns start of mapping of region of interest
+ * \param rowStrideOut  returns row stride in bytes
+ */
+static void
+intel_map_texture_image(struct gl_context *ctx,
+                       struct gl_texture_image *tex_image,
+                       GLuint slice,
+                       GLuint x, GLuint y, GLuint w, GLuint h,
+                       GLbitfield mode,
+                       GLubyte **map,
+                       GLint *out_stride)
+{
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_texture_image *intel_image = intel_texture_image(tex_image);
+   struct intel_mipmap_tree *mt = intel_image->mt;
+   ptrdiff_t stride;
+
+   /* Our texture data is always stored in a miptree. */
+   assert(mt);
+
+   /* Check that our caller wasn't confused about how to map a 1D texture. */
+   assert(tex_image->TexObject->Target != GL_TEXTURE_1D_ARRAY ||
+         h == 1);
+
+   /* intel_miptree_map operates on a unified "slice" number that references the
+    * cube face, since it's all just slices to the miptree code.
+    */
+   if (tex_image->TexObject->Target == GL_TEXTURE_CUBE_MAP)
+      slice = tex_image->Face;
+
+   intel_miptree_map(brw, mt,
+                     tex_image->Level + tex_image->TexObject->MinLevel,
+                     slice + tex_image->TexObject->MinLayer,
+                     x, y, w, h, mode,
+                     (void **)map, &stride);
+
+   *out_stride = stride;
+}
 
-static struct gl_texture_object *intelNewTextureObject( GLcontext *ctx, 
-                                                       GLuint name, 
-                                                       GLenum target )
+static void
+intel_unmap_texture_image(struct gl_context *ctx,
+                         struct gl_texture_image *tex_image, GLuint slice)
 {
-   struct intel_texture_object *obj = CALLOC_STRUCT(intel_texture_object);
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_texture_image *intel_image = intel_texture_image(tex_image);
+   struct intel_mipmap_tree *mt = intel_image->mt;
 
-   _mesa_initialize_texture_object(&obj->base, name, target);
+   if (tex_image->TexObject->Target == GL_TEXTURE_CUBE_MAP)
+      slice = tex_image->Face;
 
-   return &obj->base;
+   intel_miptree_unmap(brw, mt,
+         tex_image->Level + tex_image->TexObject->MinLevel,
+         slice + tex_image->TexObject->MinLayer);
 }
 
-static GLboolean intelIsTextureResident(GLcontext *ctx,
-                                      struct gl_texture_object *texObj)
+static GLboolean
+intel_texture_view(struct gl_context *ctx,
+                   struct gl_texture_object *texObj,
+                   struct gl_texture_object *origTexObj)
 {
-#if 0
-   struct intel_context *intel = intel_context(ctx);
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-   
-   return 
-      intelObj->mt && 
-      intelObj->mt->region && 
-      intel_is_region_resident(intel, intelObj->mt->region);
-#endif
-   return 1;
-}
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_texture_object *intel_tex = intel_texture_object(texObj);
+   struct intel_texture_object *intel_orig_tex = intel_texture_object(origTexObj);
+
+   assert(intel_orig_tex->mt);
+   intel_miptree_reference(&intel_tex->mt, intel_orig_tex->mt);
+
+   /* Since we can only make views of immutable-format textures,
+    * we can assume that everything is in origTexObj's miptree.
+    *
+    * Mesa core has already made us a copy of all the teximage objects,
+    * except it hasn't copied our mt pointers, etc.
+    */
+   const int numFaces = _mesa_num_tex_faces(texObj->Target);
+   const int numLevels = texObj->NumLevels;
+
+   int face;
+   int level;
+
+   for (face = 0; face < numFaces; face++) {
+      for (level = 0; level < numLevels; level++) {
+         struct gl_texture_image *image = texObj->Image[face][level];
+         struct intel_texture_image *intel_image = intel_texture_image(image);
+
+         intel_miptree_reference(&intel_image->mt, intel_orig_tex->mt);
+      }
+   }
 
+   /* The miptree is in a validated state, so no need to check later. */
+   intel_tex->needs_validate = false;
+   intel_tex->validated_first_level = 0;
+   intel_tex->validated_last_level = numLevels - 1;
 
+   /* Set the validated texture format, with the same adjustments that
+    * would have been applied to determine the underlying texture's
+    * mt->format.
+    */
+   intel_tex->_Format = intel_depth_format_for_depthstencil_format(
+         intel_lower_compressed_format(brw, texObj->Image[0][0]->TexFormat));
+
+   return GL_TRUE;
+}
 
-static void intelTexParameter( GLcontext *ctx, 
-                              GLenum target,
-                              struct gl_texture_object *texObj,
-                              GLenum pname, 
-                              const GLfloat *params )
+static bool
+intel_set_texture_storage_for_buffer_object(struct gl_context *ctx,
+                                            struct gl_texture_object *tex_obj,
+                                            struct gl_buffer_object *buffer_obj,
+                                            uint32_t buffer_offset,
+                                            uint32_t row_stride,
+                                            bool read_only)
 {
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-   switch (pname) {
-      /* Anything which can affect the calculation of firstLevel and
-       * lastLevel, as changes to these may invalidate the miptree.
+   struct brw_context *brw = brw_context(ctx);
+   struct intel_texture_object *intel_texobj = intel_texture_object(tex_obj);
+   struct gl_texture_image *image = tex_obj->Image[0][0];
+   struct intel_texture_image *intel_image = intel_texture_image(image);
+   struct intel_buffer_object *intel_buffer_obj = intel_buffer_object(buffer_obj);
+
+   if (!read_only) {
+      /* Renderbuffers have the restriction that the buffer offset and
+       * surface pitch must be a multiple of the element size.  If it's
+       * not, we have to fail and fall back to software.
        */
-   case GL_TEXTURE_MIN_FILTER:
-   case GL_TEXTURE_MAG_FILTER:
-   case GL_TEXTURE_BASE_LEVEL:
-   case GL_TEXTURE_MAX_LEVEL:
-   case GL_TEXTURE_MIN_LOD:
-   case GL_TEXTURE_MAX_LOD:
-      intelObj->dirty |= 1;
-      break;
-
-   default:
-      break;
+      int cpp = _mesa_get_format_bytes(image->TexFormat);
+      if (buffer_offset % cpp || row_stride % cpp) {
+         perf_debug("Bad PBO alignment; fallback to CPU mapping\n");
+         return false;
+      }
+
+      if (!brw->mesa_format_supports_render[image->TexFormat]) {
+         perf_debug("Non-renderable PBO format; fallback to CPU mapping\n");
+         return false;
+      }
    }
-}
 
+   assert(intel_texobj->mt == NULL);
+
+   struct brw_bo *bo = intel_bufferobj_buffer(brw, intel_buffer_obj,
+                                             buffer_offset,
+                                             row_stride * image->Height,
+                                             !read_only);
+   intel_texobj->mt =
+      intel_miptree_create_for_bo(brw, bo,
+                                  image->TexFormat,
+                                  buffer_offset,
+                                  image->Width, image->Height, image->Depth,
+                                  row_stride,
+                                  0);
+   if (!intel_texobj->mt)
+      return false;
+
+   if (!_swrast_init_texture_image(image))
+      return false;
+
+   intel_miptree_reference(&intel_image->mt, intel_texobj->mt);
+
+   /* The miptree is in a validated state, so no need to check later. */
+   intel_texobj->needs_validate = false;
+   intel_texobj->validated_first_level = 0;
+   intel_texobj->validated_last_level = 0;
+   intel_texobj->_Format = intel_texobj->mt->format;
+
+   return true;
+}
 
 static void
-intel_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
+intel_texture_barrier(struct gl_context *ctx)
 {
-   struct intel_context *intel = intel_context(ctx);
-   struct intel_texture_object *intelObj = intel_texture_object(texObj);
-
-   if (intelObj->mt)
-      intel_miptree_destroy(intel, intelObj->mt);
-
-   _mesa_delete_texture_object( ctx, texObj );
+   struct brw_context *brw = brw_context(ctx);
+
+   if (brw->gen >= 6) {
+      brw_emit_pipe_control_flush(brw,
+                                  PIPE_CONTROL_DEPTH_CACHE_FLUSH |
+                                  PIPE_CONTROL_RENDER_TARGET_FLUSH |
+                                  PIPE_CONTROL_CS_STALL);
+
+      brw_emit_pipe_control_flush(brw,
+                                  PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE);
+   } else {
+      brw_emit_mi_flush(brw);
+   }
 }
 
-void intelInitTextureFuncs( struct dd_function_table *functions )
+void
+intelInitTextureFuncs(struct dd_function_table *functions)
 {
-   functions->NewTextureObject          = intelNewTextureObject;
-   functions->ChooseTextureFormat = intelChooseTextureFormat;
-   functions->TexImage1D                = intelTexImage1D;
-   functions->TexImage2D                = intelTexImage2D;
-   functions->TexImage3D                = intelTexImage3D;
-   functions->TexSubImage1D             = intelTexSubImage1D;
-   functions->TexSubImage2D             = intelTexSubImage2D;
-   functions->TexSubImage3D             = intelTexSubImage3D;
-   functions->CopyTexImage1D            = _swrast_copy_teximage1d;
-   functions->CopyTexImage2D            = _swrast_copy_teximage2d;
-   functions->CopyTexSubImage1D         = _swrast_copy_texsubimage1d;
-   functions->CopyTexSubImage2D         = _swrast_copy_texsubimage2d;
-   functions->CopyTexSubImage3D         = _swrast_copy_texsubimage3d;
-   functions->DeleteTexture             = intel_delete_texture_object;
-   functions->UpdateTexturePalette      = NULL;
-   functions->IsTextureResident = intelIsTextureResident;
-   functions->TestProxyTexImage         = _mesa_test_proxy_teximage;
-   functions->CompressedTexImage2D      = intelCompressedTexImage2D;
-   functions->CompressedTexSubImage2D   = intelCompressedTexSubImage2D;
-   functions->TexParameter              = intelTexParameter;
+   functions->NewTextureObject = intelNewTextureObject;
+   functions->NewTextureImage = intelNewTextureImage;
+   functions->DeleteTextureImage = intelDeleteTextureImage;
+   functions->DeleteTexture = intelDeleteTextureObject;
+   functions->AllocTextureImageBuffer = intel_alloc_texture_image_buffer;
+   functions->FreeTextureImageBuffer = intel_free_texture_image_buffer;
+   functions->AllocTextureStorage = intel_alloc_texture_storage;
+   functions->MapTextureImage = intel_map_texture_image;
+   functions->UnmapTextureImage = intel_unmap_texture_image;
+   functions->TextureView = intel_texture_view;
+   functions->SetTextureStorageForBufferObject =
+      intel_set_texture_storage_for_buffer_object;
+   functions->TextureBarrier = intel_texture_barrier;
 }
-
-
-
-
-