[Mesa-dev] [PATCH 06/11] mesa: replace Driver.GetCompressedTexImage() w/ GetCompressedTexSubImage()

Brian Paul brianp at vmware.com
Sat Dec 13 06:42:49 PST 2014


So that we can implement glGetCompressedTextureSubImage().
---
 src/mesa/drivers/common/driverfuncs.c  |  2 +-
 src/mesa/main/dd.h                     |  9 ++++++---
 src/mesa/main/texgetimage.c            | 16 +++++++++++-----
 src/mesa/main/texgetimage.h            |  9 ++++++---
 src/mesa/state_tracker/st_cb_texture.c |  2 +-
 5 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
index 27b3e6f..66aced9 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -101,7 +101,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
    driver->TestProxyTexImage = _mesa_test_proxy_teximage;
    driver->CompressedTexImage = _mesa_store_compressed_teximage;
    driver->CompressedTexSubImage = _mesa_store_compressed_texsubimage;
-   driver->GetCompressedTexImage = _mesa_get_compressed_teximage;
+   driver->GetCompressedTexSubImage = _mesa_get_compressed_texsubimage;
    driver->BindTexture = NULL;
    driver->NewTextureObject = _mesa_new_texture_object;
    driver->DeleteTexture = _mesa_delete_texture_object;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 34f8d86..ed31bc3 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -335,9 +335,12 @@ struct dd_function_table {
    /**
     * Called by glGetCompressedTexImage.
     */
-   void (*GetCompressedTexImage)(struct gl_context *ctx,
-                                 struct gl_texture_image *texImage,
-                                 GLvoid *data);
+   void (*GetCompressedTexSubImage)(struct gl_context *ctx,
+                                    struct gl_texture_image *texImage,
+                                    GLint xoffset, GLint yoffset,
+                                    GLint zoffset, GLsizei width,
+                                    GLint height, GLint depth,
+                                    GLvoid *data);
    /*@}*/
 
    /**
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index e1f238b..ced6a34 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -699,13 +699,16 @@ _mesa_get_texsubimage(struct gl_context *ctx,
 
 
 /**
- * This is the software fallback for Driver.GetCompressedTexImage().
+ * This is the software fallback for Driver.GetCompressedTexSubImage().
  * All error checking will have been done before this routine is called.
  */
 void
-_mesa_get_compressed_teximage(struct gl_context *ctx,
-                              struct gl_texture_image *texImage,
-                              GLvoid *img)
+_mesa_get_compressed_texsubimage(struct gl_context *ctx,
+                                 struct gl_texture_image *texImage,
+                                 GLint xoffset, GLint yoffset,
+                                 GLint zoffset, GLsizei width,
+                                 GLint height, GLint depth,
+                                 GLvoid *img)
 {
    const GLuint dimensions =
       _mesa_get_texture_dimensions(texImage->TexObject->Target);
@@ -1126,7 +1129,10 @@ _mesa_GetnCompressedTexImageARB(GLenum target, GLint level, GLsizei bufSize,
 
    _mesa_lock_texture(ctx, texObj);
    {
-      ctx->Driver.GetCompressedTexImage(ctx, texImage, img);
+      ctx->Driver.GetCompressedTexSubImage(ctx, texImage,
+                                           0, 0, 0,
+                                           texImage->Width, texImage->Height,
+                                           texImage->Depth, img);
    }
    _mesa_unlock_texture(ctx, texObj);
 }
diff --git a/src/mesa/main/texgetimage.h b/src/mesa/main/texgetimage.h
index 40f152c..593d5b0 100644
--- a/src/mesa/main/texgetimage.h
+++ b/src/mesa/main/texgetimage.h
@@ -45,9 +45,12 @@ _mesa_get_texsubimage(struct gl_context *ctx,
 
 
 extern void
-_mesa_get_compressed_teximage(struct gl_context *ctx,
-                              struct gl_texture_image *texImage,
-                              GLvoid *data);
+_mesa_get_compressed_texsubimage(struct gl_context *ctx,
+                                 struct gl_texture_image *texImage,
+                                 GLint xoffset, GLint yoffset,
+                                 GLint zoffset, GLsizei width,
+                                 GLint height, GLint depth,
+                                 GLvoid *data);
 
 
 
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 8c5cbf1..3d3562b 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1893,7 +1893,7 @@ st_init_texture_functions(struct dd_function_table *functions)
 
    /* compressed texture functions */
    functions->CompressedTexImage = st_CompressedTexImage;
-   functions->GetCompressedTexImage = _mesa_get_compressed_teximage;
+   functions->GetCompressedTexSubImage = _mesa_get_compressed_texsubimage;
 
    functions->NewTextureObject = st_NewTextureObject;
    functions->NewTextureImage = st_NewTextureImage;
-- 
1.9.1



More information about the mesa-dev mailing list