Mesa (master): st/mesa: completely stop using gl_texture_image::Data

Brian Paul brianp at kemper.freedesktop.org
Wed Oct 5 20:17:05 PDT 2011


Module: Mesa
Branch: master
Commit: aff65241c8bf6206c6dfcbe774b87991f965d46f
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=aff65241c8bf6206c6dfcbe774b87991f965d46f

Author: Brian Paul <brianp at vmware.com>
Date:   Tue Oct  4 18:26:39 2011 -0600

st/mesa: completely stop using gl_texture_image::Data

Instead, use the new st_texture_image::TexData field to hold texture
images that don't fit the parent object's mipmap buffer.

---

 src/mesa/state_tracker/st_cb_texture.c |   26 +++++++++++++-------------
 src/mesa/state_tracker/st_texture.h    |    7 ++++++-
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index ce10350..de3b972 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -162,9 +162,9 @@ st_FreeTextureImageBuffer(struct gl_context * ctx, struct gl_texture_image *texI
       pipe_resource_reference(&stImage->pt, NULL);
    }
 
-   if (texImage->Data) {
-      _mesa_align_free(texImage->Data);
-      texImage->Data = NULL;
+   if (stImage->TexData) {
+      _mesa_align_free(stImage->TexData);
+      stImage->TexData = NULL;
    }
 }
 
@@ -482,7 +482,7 @@ st_AllocTextureImageBuffer(struct gl_context *ctx,
    assert(width > 0);
    assert(height > 0);
    assert(depth > 0);
-   assert(!texImage->Data);
+   assert(!stImage->TexData);
    assert(!stImage->pt); /* xxx this might be wrong */
 
    /* Look if the parent texture object has space for this image */
@@ -651,10 +651,10 @@ st_TexImage(struct gl_context * ctx,
     */
    if (stImage->pt) {
       pipe_resource_reference(&stImage->pt, NULL);
-      assert(!texImage->Data);
+      assert(!stImage->TexData);
    }
-   else if (texImage->Data) {
-      _mesa_align_free(texImage->Data);
+   else if (stImage->TexData) {
+      _mesa_align_free(stImage->TexData);
    }
 
    /*
@@ -756,8 +756,8 @@ st_TexImage(struct gl_context * ctx,
                                                  width, height, depth);
       dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width);
 
-      texImage->Data = _mesa_align_malloc(imageSize, 16);
-      dstMap = texImage->Data;
+      stImage->TexData = _mesa_align_malloc(imageSize, 16);
+      dstMap = stImage->TexData;
    }
 
    if (!dstMap) {
@@ -1684,19 +1684,19 @@ copy_image_data_to_texture(struct st_context *st,
 
       pipe_resource_reference(&stImage->pt, NULL);
    }
-   else if (stImage->base.Data) {
+   else if (stImage->TexData) {
       st_texture_image_data(st,
                             stObj->pt,
                             stImage->base.Face,
                             dstLevel,
-                            stImage->base.Data,
+                            stImage->TexData,
                             stImage->base.RowStride * 
                             util_format_get_blocksize(stObj->pt->format),
                             stImage->base.RowStride *
                             stImage->base.Height *
                             util_format_get_blocksize(stObj->pt->format));
-      _mesa_align_free(stImage->base.Data);
-      stImage->base.Data = NULL;
+      _mesa_align_free(stImage->TexData);
+      stImage->TexData = NULL;
    }
 
    pipe_resource_reference(&stImage->pt, stObj->pt);
diff --git a/src/mesa/state_tracker/st_texture.h b/src/mesa/state_tracker/st_texture.h
index dd3bc73..3d2a636 100644
--- a/src/mesa/state_tracker/st_texture.h
+++ b/src/mesa/state_tracker/st_texture.h
@@ -45,8 +45,13 @@ struct st_texture_image
 {
    struct gl_texture_image base;
 
+   /** Used to store texture data that doesn't fit in the patent
+    * object's mipmap buffer.
+    */
+   GLubyte *TexData;
+
    /* If stImage->pt != NULL, image data is stored here.
-    * Else if stImage->base.Data != NULL, image is stored there.
+    * Else if stImage->TexData != NULL, image is stored there.
     * Else there is no image data.
     */
    struct pipe_resource *pt;



More information about the mesa-commit mailing list