Mesa (master): st/mesa: treat 1D ARRAY upload like a depth or 2D array upload.

Dave Airlie airlied at kemper.freedesktop.org
Thu Feb 24 03:21:30 UTC 2011


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Feb 18 14:51:58 2011 +1000

st/mesa: treat 1D ARRAY upload like a depth or 2D array upload.

This is because the HW doesn't always store a 1D array like a
2D texture, it more likely stores it like 2D texture (i.e.
alignments etc).

This means we upload each slice separately and let the driver
work out where to put it.

this might break nvc0 as I can't test it, I have only nv50 here.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/mesa/state_tracker/st_cb_texture.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index a40a79b..08c498b 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -579,6 +579,12 @@ st_TexImage(struct gl_context * ctx,
 					   pixels, unpack, "glTexImage");
    }
 
+   /* for a 1D array upload the image as a series of layer with height = 1 */
+   if (target == GL_TEXTURE_1D_ARRAY) {
+      depth = height;
+      height = 1;
+   }
+
    /*
     * Prepare to store the texture data.  Either map the gallium texture buffer
     * memory or malloc space for it.
@@ -986,6 +992,12 @@ st_TexSubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
    if (!pixels)
       return;
 
+   /* for a 1D array upload the image as a series of layer with height = 1 */
+   if (target == GL_TEXTURE_1D_ARRAY) {
+      depth = height;
+      height = 1;
+   }
+
    /* Map buffer if necessary.  Need to lock to prevent other contexts
     * from uploading the buffer under us.
     */




More information about the mesa-commit mailing list