Added ctx->Driver.GenerateMipmap() driver hook
authorDave Airlie <airlied@linux.ie>
Fri, 9 May 2008 03:33:06 +0000 (13:33 +1000)
committerDave Airlie <airlied@linux.ie>
Fri, 9 May 2008 03:33:06 +0000 (13:33 +1000)
(cherry picked from commit 4c2f3dbca940f289e67248682b84a3516d5a3031)

Conflicts:

src/mesa/drivers/common/driverfuncs.c

src/mesa/drivers/common/driverfuncs.c
src/mesa/main/dd.h
src/mesa/main/fbobject.c
src/mesa/main/texstore.c

index 03fbab69e3982dfd0794b229c379b27ccd963028..7fe116285c4445869d2772de506e798c9712b7ed 100644 (file)
@@ -29,6 +29,7 @@
 #include "buffers.h"
 #include "context.h"
 #include "framebuffer.h"
+#include "mipmap.h"
 #include "queryobj.h"
 #include "renderbuffer.h"
 #include "texcompress.h"
@@ -98,6 +99,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d;
    driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d;
    driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d;
+   driver->GenerateMipmap = _mesa_generate_mipmap;
    driver->TestProxyTexImage = _mesa_test_proxy_teximage;
    driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d;
    driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d;
index ce33905af132c225f12de9d817f2289e8b16282c..bfbb96aebb77b628068c6be539d4f12a6137fb82 100644 (file)
@@ -327,6 +327,13 @@ struct dd_function_table {
                               GLint x, GLint y,
                               GLsizei width, GLsizei height );
 
+   /**
+    * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled.
+    */
+   void (*GenerateMipmap)(GLcontext *ctx,  GLenum target,
+                          const struct gl_texture_unit *texUnit,
+                          struct gl_texture_object *texObj);
+
    /**
     * Called by glTexImage[123]D when user specifies a proxy texture
     * target.  
index b015ca6c5e6dfbcb01a23af8ba848c64d80569e7..6cda7de953f02018113315b8fdeb2c0542a56b9b 100644 (file)
@@ -1547,7 +1547,7 @@ _mesa_GenerateMipmapEXT(GLenum target)
 
    /* XXX this might not handle cube maps correctly */
    _mesa_lock_texture(ctx, texObj);
-   _mesa_generate_mipmap(ctx, target, texUnit, texObj);
+   ctx->Driver.GenerateMipmap(ctx, target, texUnit, texObj);
    _mesa_unlock_texture(ctx, texObj);
 
    if (ctx->Driver.UnmapTexture)
index 90edca86e8398b656d1f08aefdd52f9d307434d3..35ef7b1ec116e2558d7f30c518286f4fbd40400d 100644 (file)
@@ -2918,9 +2918,9 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, packing);
@@ -3004,9 +3004,9 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, packing);
@@ -3080,9 +3080,9 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, packing);
@@ -3128,9 +3128,9 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, packing);
@@ -3183,9 +3183,9 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, packing);
@@ -3238,9 +3238,9 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, packing);
@@ -3314,9 +3314,9 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);
@@ -3426,9 +3426,9 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
 
    /* GL_SGIS_generate_mipmap */
    if (level == texObj->BaseLevel && texObj->GenerateMipmap) {
-      _mesa_generate_mipmap(ctx, target,
-                            &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
-                            texObj);
+      ctx->Driver.GenerateMipmap(ctx, target,
+                                 &ctx->Texture.Unit[ctx->Texture.CurrentUnit],
+                                 texObj);
    }
 
    _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack);