Mesa (gallium-array-textures): gallium: adapt code to interface changes...

Roland Scheidegger sroland at kemper.freedesktop.org
Wed Jun 16 11:42:38 PDT 2010


Module: Mesa
Branch: gallium-array-textures
Commit: 2303ec32143d363b46e59e4b7c91b0ebd34a16b2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2303ec32143d363b46e59e4b7c91b0ebd34a16b2

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Wed Jun 16 19:42:32 2010 +0100

gallium: adapt code to interface changes...

---

 src/gallium/auxiliary/draw/draw_pipe_aaline.c      |    1 +
 src/gallium/auxiliary/draw/draw_pipe_pstipple.c    |    1 +
 src/gallium/auxiliary/util/u_blit.c                |    1 +
 src/gallium/auxiliary/util/u_dump_state.c          |    4 ++++
 src/gallium/auxiliary/util/u_inlines.h             |    1 +
 src/gallium/auxiliary/util/u_sampler.c             |    3 ++-
 src/gallium/auxiliary/util/u_surface.c             |    1 +
 src/gallium/docs/d3d11ddi.txt                      |    1 -
 src/gallium/docs/source/screen.rst                 |    8 +++++---
 src/gallium/drivers/cell/ppu/cell_texture.c        |    4 ++--
 src/gallium/drivers/i915/i915_resource_buffer.c    |    1 +
 src/gallium/drivers/i965/brw_resource_buffer.c     |    1 +
 src/gallium/drivers/llvmpipe/lp_texture.c          |    5 +++--
 src/gallium/drivers/nv50/nv50_buffer.c             |    1 +
 src/gallium/drivers/nv50/nv50_miptree.c            |   15 +++------------
 src/gallium/drivers/nvfx/nv04_surface_2d.c         |    1 +
 src/gallium/drivers/nvfx/nvfx_buffer.c             |    1 +
 src/gallium/drivers/nvfx/nvfx_miptree.c            |   10 +++++++---
 src/gallium/drivers/nvfx/nvfx_transfer.c           |    1 +
 src/gallium/drivers/r300/r300_screen_buffer.c      |    1 +
 src/gallium/drivers/r300/r300_transfer.c           |    4 +++-
 src/gallium/drivers/r600/r600_buffer.c             |    1 +
 src/gallium/drivers/r600/r600_texture.c            |    1 +
 src/gallium/drivers/softpipe/sp_texture.c          |    4 ++--
 src/gallium/drivers/svga/svga_resource_buffer.c    |    1 +
 src/gallium/drivers/svga/svga_resource_texture.c   |    5 +----
 src/gallium/drivers/trace/tr_dump_state.c          |    4 ++++
 src/gallium/state_trackers/dri/drm/dri2.c          |    2 ++
 src/gallium/state_trackers/dri/sw/drisw.c          |    1 +
 .../state_trackers/egl/common/egl_g3d_image.c      |    2 +-
 src/gallium/state_trackers/egl/common/egl_g3d_st.c |    1 +
 .../state_trackers/egl/common/native_helper.c      |    1 +
 src/gallium/state_trackers/egl/x11/native_dri2.c   |    1 +
 src/gallium/state_trackers/glx/xlib/xm_st.c        |    1 +
 src/gallium/state_trackers/python/st_device.c      |    1 +
 src/gallium/state_trackers/vega/api_filters.c      |    1 +
 src/gallium/state_trackers/vega/image.c            |    1 +
 src/gallium/state_trackers/vega/paint.c            |    1 +
 src/gallium/state_trackers/vega/renderer.c         |    1 +
 src/gallium/state_trackers/vega/vg_manager.c       |    1 +
 src/gallium/state_trackers/wgl/stw_st.c            |    1 +
 src/gallium/state_trackers/xorg/xorg_crtc.c        |    1 +
 src/gallium/state_trackers/xorg/xorg_dri2.c        |    1 +
 src/gallium/state_trackers/xorg/xorg_exa.c         |    2 ++
 src/gallium/state_trackers/xorg/xorg_renderer.c    |    1 +
 src/gallium/state_trackers/xorg/xorg_xv.c          |    1 +
 src/gallium/tests/graw/clear.c                     |    1 +
 src/gallium/tests/graw/fs-test.c                   |    3 +++
 src/gallium/tests/graw/gs-test.c                   |    3 +++
 src/gallium/tests/graw/quad-tex.c                  |    2 ++
 src/gallium/tests/graw/tri-gs.c                    |    1 +
 src/gallium/tests/graw/tri.c                       |    1 +
 src/gallium/tests/graw/vs-test.c                   |    3 +++
 src/gallium/tests/trivial/quad-tex.c               |    2 ++
 src/gallium/tests/trivial/tri.c                    |    1 +
 src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c  |    2 ++
 src/mesa/state_tracker/st_cb_fbo.c                 |    1 +
 src/mesa/state_tracker/st_cb_texture.c             |    1 +
 src/mesa/state_tracker/st_gen_mipmap.c             |    6 ++----
 src/mesa/state_tracker/st_texture.c                |   12 +++++-------
 60 files changed, 100 insertions(+), 43 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
index bddf30f..b196aa2 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c
@@ -407,6 +407,7 @@ aaline_create_texture(struct aaline_stage *aaline)
    texTemp.width0 = 1 << MAX_TEXTURE_LEVEL;
    texTemp.height0 = 1 << MAX_TEXTURE_LEVEL;
    texTemp.depth0 = 1;
+   texTemp.array_size = 1;
    texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    aaline->texture = screen->resource_create(screen, &texTemp);
diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
index dafc389..2c19fcd 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c
@@ -436,6 +436,7 @@ pstip_create_texture(struct pstip_stage *pstip)
    texTemp.width0 = 32;
    texTemp.height0 = 32;
    texTemp.depth0 = 1;
+   texTemp.array_size = 1;
    texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pstip->texture = screen->resource_create(screen, &texTemp);
diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c
index b08f86b..7e6947b 100644
--- a/src/gallium/auxiliary/util/u_blit.c
+++ b/src/gallium/auxiliary/util/u_blit.c
@@ -379,6 +379,7 @@ util_blit_pixels_writemask(struct blit_state *ctx,
       texTemp.width0 = srcW;
       texTemp.height0 = srcH;
       texTemp.depth0 = 1;
+      texTemp.array_size = 1;
       texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
       tex = screen->resource_create(screen, &texTemp);
diff --git a/src/gallium/auxiliary/util/u_dump_state.c b/src/gallium/auxiliary/util/u_dump_state.c
index 4a26646..b471d59 100644
--- a/src/gallium/auxiliary/util/u_dump_state.c
+++ b/src/gallium/auxiliary/util/u_dump_state.c
@@ -279,6 +279,10 @@ util_dump_template(struct os_stream *stream, const struct pipe_resource *templat
    util_dump_uint(stream, templat->depth0);
    util_dump_member_end(stream);
 
+   util_dump_member_begin(stream, "array_size");
+   util_dump_uint(stream, templat->array_size);
+   util_dump_member_end(stream);
+
    util_dump_member(stream, uint, templat, last_level);
    util_dump_member(stream, uint, templat, usage);
    util_dump_member(stream, uint, templat, bind);
diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h
index c0f68f9..6666058 100644
--- a/src/gallium/auxiliary/util/u_inlines.h
+++ b/src/gallium/auxiliary/util/u_inlines.h
@@ -163,6 +163,7 @@ pipe_buffer_create( struct pipe_screen *screen,
    buffer.width0 = size;
    buffer.height0 = 1;
    buffer.depth0 = 1;
+   buffer.array_size = 1;
    return screen->resource_create(screen, &buffer);
 }
 
diff --git a/src/gallium/auxiliary/util/u_sampler.c b/src/gallium/auxiliary/util/u_sampler.c
index 1bfa0ba..bb26099 100644
--- a/src/gallium/auxiliary/util/u_sampler.c
+++ b/src/gallium/auxiliary/util/u_sampler.c
@@ -43,7 +43,8 @@ default_template(struct pipe_sampler_view *view,
    view->u.tex.first_level = 0;
    view->u.tex.last_level = texture->last_level;
    view->u.tex.first_layer = 0;
-   view->u.tex.last_layer = texture->depth0 - 1;
+   view->u.tex.last_layer = texture->target == PIPE_TEXTURE_3D ?
+                               texture->depth0 - 1 : texture->array_size - 1;
    view->swizzle_r = PIPE_SWIZZLE_RED;
    view->swizzle_g = PIPE_SWIZZLE_GREEN;
    view->swizzle_b = PIPE_SWIZZLE_BLUE;
diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c
index f34b33f..95242e0 100644
--- a/src/gallium/auxiliary/util/u_surface.c
+++ b/src/gallium/auxiliary/util/u_surface.c
@@ -100,6 +100,7 @@ util_create_rgba_surface(struct pipe_context *pipe,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = bind;
 
    *textureOut = screen->resource_create(screen, &templ);
diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt
index 4722b75..f4d2e57 100644
--- a/src/gallium/docs/d3d11ddi.txt
+++ b/src/gallium/docs/d3d11ddi.txt
@@ -224,7 +224,6 @@ CreateResource -> texture_create or buffer_create
 	! D3D11 specifies mapping flags (i.e. read/write/discard);:it's unclear what they are used for here
 	- D3D11 supports odd things in the D3D10_DDI_RESOURCE_MISC_FLAG enum (D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT, D3D11_DDI_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS, D3D11_DDI_RESOURCE_MISC_BUFFER_STRUCTURED)
 	- Gallium does not support indirect draw call parameter buffers
-	- Gallium lacks array textures
 	! D3D11 supports specifying hardware modes and other stuff here for scanout resources
 	+ Gallium allows specifying minimum buffer alignment
 	! D3D11 implements cube maps as 2D array textures
diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst
index e318244..eaf9f58 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -261,9 +261,11 @@ Modern APIs allow using buffers as shader resources.
 **height0** the height of the base mip level of the texture
 (1 for 1D or 1D array textures).
 
-**depth0** the depth of the base mip level of the texture.
-1 for 1D or 2D textures, 6 for cube map textures, and depth for 3d textures.
-For array textures (both 1D and 2D) this specifies the array size.
+**depth0** the depth of the base mip level of the texture
+(1 for everything else).
+
+**array_size the array size for 1D and 2D array textures.
+For cube maps this must be 6, for other textures 1.
 
 **last_level** the last mip map level present.
 
diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c
index 4c5747b..946a705 100644
--- a/src/gallium/drivers/cell/ppu/cell_texture.c
+++ b/src/gallium/drivers/cell/ppu/cell_texture.c
@@ -360,8 +360,7 @@ cell_get_transfer(struct pipe_context *ctx,
    /* make sure the requested region is in the image bounds */
    assert(box->x + box->width <= u_minify(resource->width0, level));
    assert(box->y + box->height <= u_minify(resource->height0, level));
-   assert(box->z + box->depth <= (resource->target == PIPE_TEXTURE_3D ?
-                                  u_minify(resource->depth0, level) : resource->depth0));
+   assert(box->z + box->depth <= (u_minify(resource->depth0, level) + resource->array_size - 1));
 
    ctrans = CALLOC_STRUCT(cell_transfer);
    if (ctrans) {
@@ -589,6 +588,7 @@ cell_user_buffer_create(struct pipe_screen *screen,
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
+   buffer->base.array_size = 1;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
 
diff --git a/src/gallium/drivers/i915/i915_resource_buffer.c b/src/gallium/drivers/i915/i915_resource_buffer.c
index 8da9d3d..450203d 100644
--- a/src/gallium/drivers/i915/i915_resource_buffer.c
+++ b/src/gallium/drivers/i915/i915_resource_buffer.c
@@ -152,6 +152,7 @@ i915_user_buffer_create(struct pipe_screen *screen,
    buf->b.b.width0 = bytes;
    buf->b.b.height0 = 1;
    buf->b.b.depth0 = 1;
+   buf->b.b.array_size = 1;
 
    buf->data = ptr;
    buf->free_on_destroy = FALSE;
diff --git a/src/gallium/drivers/i965/brw_resource_buffer.c b/src/gallium/drivers/i965/brw_resource_buffer.c
index 910bbdf..afb96ee 100644
--- a/src/gallium/drivers/i965/brw_resource_buffer.c
+++ b/src/gallium/drivers/i965/brw_resource_buffer.c
@@ -194,6 +194,7 @@ brw_user_buffer_create(struct pipe_screen *screen,
    buf->b.b.width0 = bytes;
    buf->b.b.height0 = 1;
    buf->b.b.depth0 = 1;
+   buf->b.b.array_size = 1;
 
    buf->user_buffer = ptr;
    
diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c
index 26734be..5b75af1 100644
--- a/src/gallium/drivers/llvmpipe/lp_texture.c
+++ b/src/gallium/drivers/llvmpipe/lp_texture.c
@@ -240,6 +240,7 @@ llvmpipe_resource_create(struct pipe_screen *_screen,
       /* other data (vertex buffer, const buffer, etc) */
       const enum pipe_format format = templat->format;
       const uint w = templat->width0 / util_format_get_blockheight(format);
+      /* XXX buffers should only have one dimension, those values should be 1 */
       const uint h = templat->height0 / util_format_get_blockwidth(format);
       const uint d = templat->depth0;
       const uint bpp = util_format_get_blocksize(format);
@@ -336,8 +337,7 @@ llvmpipe_resource_map(struct pipe_resource *resource,
    uint8_t *map;
 
    assert(level < LP_MAX_TEXTURE_LEVELS);
-   assert(resource->target == PIPE_TEXTURE_3D ?
-      layer < u_minify(resource->depth0, level) : layer < resource->depth0);
+   assert(layer < (u_minify(resource->depth0, level) + resource->array_size - 1));
 
    assert(tex_usage == LP_TEX_USAGE_READ ||
           tex_usage == LP_TEX_USAGE_READ_WRITE ||
@@ -693,6 +693,7 @@ llvmpipe_user_buffer_create(struct pipe_screen *screen,
    buffer->base.width0 = bytes;
    buffer->base.height0 = 1;
    buffer->base.depth0 = 1;
+   buffer->base.array_size = 1;
    buffer->userBuffer = TRUE;
    buffer->data = ptr;
 
diff --git a/src/gallium/drivers/nv50/nv50_buffer.c b/src/gallium/drivers/nv50/nv50_buffer.c
index dacfee9..45356f9 100644
--- a/src/gallium/drivers/nv50/nv50_buffer.c
+++ b/src/gallium/drivers/nv50/nv50_buffer.c
@@ -136,6 +136,7 @@ nv50_user_buffer_create(struct pipe_screen *pscreen,
 	buffer->base.width0 = bytes;
 	buffer->base.height0 = 1;
 	buffer->base.depth0 = 1;
+	buffer->base.array_size = 1;
 
 	buffer->bo = nouveau_screen_bo_user(pscreen, ptr, bytes);
 	if (!buffer->bo)
diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c
index 445f3be..d000b19 100644
--- a/src/gallium/drivers/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nv50/nv50_miptree.c
@@ -133,7 +133,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *tmp
 	struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree);
 	struct pipe_resource *pt = &mt->base.base;
 	unsigned width = tmp->width0, height = tmp->height0;
-	unsigned depth_fix = tmp->depth0, image_alignment, depth;
+	unsigned depth = tmp->depth0, image_alignment;
 	uint32_t tile_flags;
 	int ret, i, l;
 
@@ -173,16 +173,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *tmp
 	}
 
 	/* XXX: texture arrays */
-	if (pt->target == PIPE_TEXTURE_3D)
-		mt->image_nr = 1;
-	else {
-		/* should handle both array and cube textures */
-		if (pt->target == PIPE_TEXTURE_CUBE)
-			assert(depth_fix == 6);
-		mt->image_nr = depth_fix;
-		depth_fix = 1;
-	}
-	depth = depth_fix;
+	mt->image_nr = (pt->target == PIPE_TEXTURE_CUBE) ? 6 : 1;
 
 	for (l = 0; l <= pt->last_level; l++) {
 		struct nv50_miptree_level *lvl = &mt->level[l];
@@ -212,7 +203,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_resource *tmp
 
 			size  = lvl->pitch;
 			size *= align(util_format_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h);
-			size *= align(u_minify(depth_fix, l), tile_d);
+			size *= align(u_minify(pt->depth0, l), tile_d);
 
 			lvl->image_offset[i] = mt->total_size;
 
diff --git a/src/gallium/drivers/nvfx/nv04_surface_2d.c b/src/gallium/drivers/nvfx/nv04_surface_2d.c
index 9b288e9..cfebab0 100644
--- a/src/gallium/drivers/nvfx/nv04_surface_2d.c
+++ b/src/gallium/drivers/nvfx/nv04_surface_2d.c
@@ -518,6 +518,7 @@ nv04_surface_wrap_for_render(struct pipe_context *pipe,
 	templ.width0 = ns->base.width;
 	templ.height0 = ns->base.height;
 	templ.depth0 = 1;
+	templ.array_size = 1;
 	templ.last_level = 0;
 
 	// TODO: this is probably wrong and we should specifically handle multisampling somehow once it is implemented
diff --git a/src/gallium/drivers/nvfx/nvfx_buffer.c b/src/gallium/drivers/nvfx/nvfx_buffer.c
index 05b824b..d77b08a 100644
--- a/src/gallium/drivers/nvfx/nvfx_buffer.c
+++ b/src/gallium/drivers/nvfx/nvfx_buffer.c
@@ -139,6 +139,7 @@ nvfx_user_buffer_create(struct pipe_screen *pscreen,
 	buffer->base.width0 = bytes;
 	buffer->base.height0 = 1;
 	buffer->base.depth0 = 1;
+	buffer->base.array_size = 1;
 
 	buffer->bo = nouveau_screen_bo_user(pscreen, ptr, bytes);
 	if (!buffer->bo)
diff --git a/src/gallium/drivers/nvfx/nvfx_miptree.c b/src/gallium/drivers/nvfx/nvfx_miptree.c
index 73fa464..b2be0ed 100644
--- a/src/gallium/drivers/nvfx/nvfx_miptree.c
+++ b/src/gallium/drivers/nvfx/nvfx_miptree.c
@@ -29,12 +29,16 @@ nvfx_miptree_layout(struct nvfx_miptree *mt)
 				      PIPE_BIND_SCANOUT);
 
 	if (pt->target == PIPE_TEXTURE_CUBE) {
-		assert(pt->depth0 == 6);
+		assert(pt->array_size == 6);
+		assert(pt->depth0 == 1);
 	} else
-	if (pt->target != PIPE_TEXTURE_3D) {
+	if (pt->target == PIPE_TEXTURE_3D) {
+		assert(pt->array_size == 1);
+	} else {
+		assert(pt->array_size == 1);
 		assert(pt->depth0 == 1);
 	}
-	nr_faces = pt->depth0;
+	nr_faces = pt->depth0 + pt->array_size - 1;
 
 	for (l = 0; l <= pt->last_level; l++) {
 		if (wide_pitch && (pt->flags & NVFX_RESOURCE_FLAG_LINEAR))
diff --git a/src/gallium/drivers/nvfx/nvfx_transfer.c b/src/gallium/drivers/nvfx/nvfx_transfer.c
index b7d9b98..cf47b41 100644
--- a/src/gallium/drivers/nvfx/nvfx_transfer.c
+++ b/src/gallium/drivers/nvfx/nvfx_transfer.c
@@ -29,6 +29,7 @@ nvfx_compatible_transfer_tex(struct pipe_resource *pt, unsigned width, unsigned
 	template->width0 = width;
 	template->height0 = height;
 	template->depth0 = 1;
+	template->array_size = 1;
 	template->last_level = 0;
 	template->nr_samples = pt->nr_samples;
 	template->bind = bind;
diff --git a/src/gallium/drivers/r300/r300_screen_buffer.c b/src/gallium/drivers/r300/r300_screen_buffer.c
index 4e7f763..0595288 100644
--- a/src/gallium/drivers/r300/r300_screen_buffer.c
+++ b/src/gallium/drivers/r300/r300_screen_buffer.c
@@ -304,6 +304,7 @@ struct pipe_resource *r300_user_buffer_create(struct pipe_screen *screen,
     rbuf->b.b.width0 = bytes;
     rbuf->b.b.height0 = 1;
     rbuf->b.b.depth0 = 1;
+    rbuf->b.b.array_size = 1;
     rbuf->domain = R300_DOMAIN_GTT;
 
     rbuf->user_buffer = ptr;
diff --git a/src/gallium/drivers/r300/r300_transfer.c b/src/gallium/drivers/r300/r300_transfer.c
index 4e9e574..d25acb2 100644
--- a/src/gallium/drivers/r300/r300_transfer.c
+++ b/src/gallium/drivers/r300/r300_transfer.c
@@ -130,7 +130,9 @@ r300_texture_get_transfer(struct pipe_context *ctx,
             base.format = texture->format;
             base.width0 = box->width;
             base.height0 = box->height;
-            base.depth0 = 0;
+            /* XXX: was depth0 = 0 */
+            base.depth0 = 1;
+            base.array_size = 1;
             base.last_level = 0;
             base.nr_samples = 0;
             base.usage = PIPE_USAGE_DYNAMIC;
diff --git a/src/gallium/drivers/r600/r600_buffer.c b/src/gallium/drivers/r600/r600_buffer.c
index 7efcdbc..c84f698 100644
--- a/src/gallium/drivers/r600/r600_buffer.c
+++ b/src/gallium/drivers/r600/r600_buffer.c
@@ -115,6 +115,7 @@ struct pipe_resource *r600_user_buffer_create(struct pipe_screen *screen,
 	templ.width0 = bytes;
 	templ.height0 = 1;
 	templ.depth0 = 1;
+	templ.array_size = 1;
 
 	rbuffer = (struct r600_buffer*)r600_buffer_create(screen, &templ);
 	if (rbuffer == NULL) {
diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index ead7094..633a547 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -97,6 +97,7 @@ struct pipe_resource *r600_texture_create(struct pipe_screen *screen,
 	templ_buf.width0 = rtex->size;
 	templ_buf.height0 = 1;
 	templ_buf.depth0 = 1;
+	templ_buf.array_size = 1;
 
 	rtex->buffer = screen->resource_create(screen, &templ_buf);
 	if (!rtex->buffer) {
diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c
index 2b1d84e..e1c2983 100644
--- a/src/gallium/drivers/softpipe/sp_texture.c
+++ b/src/gallium/drivers/softpipe/sp_texture.c
@@ -312,8 +312,7 @@ softpipe_get_transfer(struct pipe_context *pipe,
    /* make sure the requested region is in the image bounds */
    assert(box->x + box->width <= u_minify(resource->width0, level));
    assert(box->y + box->height <= u_minify(resource->height0, level));
-   assert(box->z + box->depth <= (resource->target == PIPE_TEXTURE_3D ?
-                                  u_minify(resource->depth0, level) : resource->depth0));
+   assert(box->z + box->depth <= (u_minify(resource->depth0, level) + resource->array_size - 1));
 
    /*
     * Transfers, like other pipe operations, must happen in order, so flush the
@@ -451,6 +450,7 @@ softpipe_user_buffer_create(struct pipe_screen *screen,
    spr->base.width0 = bytes;
    spr->base.height0 = 1;
    spr->base.depth0 = 1;
+   spr->base.array_size = 1;
    spr->userBuffer = TRUE;
    spr->data = ptr;
 
diff --git a/src/gallium/drivers/svga/svga_resource_buffer.c b/src/gallium/drivers/svga/svga_resource_buffer.c
index 19a2ee8..f12e2b6 100644
--- a/src/gallium/drivers/svga/svga_resource_buffer.c
+++ b/src/gallium/drivers/svga/svga_resource_buffer.c
@@ -337,6 +337,7 @@ svga_user_buffer_create(struct pipe_screen *screen,
    sbuf->b.b.width0 = bytes;
    sbuf->b.b.height0 = 1;
    sbuf->b.b.depth0 = 1;
+   sbuf->b.b.array_size = 1;
 
    sbuf->swbuf = ptr;
    sbuf->user = TRUE;
diff --git a/src/gallium/drivers/svga/svga_resource_texture.c b/src/gallium/drivers/svga/svga_resource_texture.c
index 94d0a8e..96ccb07 100644
--- a/src/gallium/drivers/svga/svga_resource_texture.c
+++ b/src/gallium/drivers/svga/svga_resource_texture.c
@@ -517,10 +517,7 @@ svga_texture_create(struct pipe_screen *screen,
    tex->key.flags = 0;
    tex->key.size.width = template->width0;
    tex->key.size.height = template->height0;
-   /* can't cope with new style depth which also serves as
-      array size, and is 6 for cube maps */
-   tex->key.size.depth = template->target == PIPE_TEXTURE_3D ?
-                                             template->depth0 : 1;
+   tex->key.size.depth = template->depth0;
 
    if(template->target == PIPE_TEXTURE_CUBE) {
       tex->key.flags |= SVGA3D_SURFACE_CUBEMAP;
diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c
index 7a13f68..296b760 100644
--- a/src/gallium/drivers/trace/tr_dump_state.c
+++ b/src/gallium/drivers/trace/tr_dump_state.c
@@ -71,6 +71,10 @@ void trace_dump_resource_template(const struct pipe_resource *templat)
    trace_dump_uint(templat->depth0);
    trace_dump_member_end();
 
+   trace_dump_member_begin("array_size");
+   trace_dump_uint(templat->array_size);
+   trace_dump_member_end();
+
    trace_dump_member(uint, templat, last_level);
    trace_dump_member(uint, templat, usage);
    trace_dump_member(uint, templat, bind);
diff --git a/src/gallium/state_trackers/dri/drm/dri2.c b/src/gallium/state_trackers/dri/drm/dri2.c
index 9b8d571..76c6003 100644
--- a/src/gallium/state_trackers/dri/drm/dri2.c
+++ b/src/gallium/state_trackers/dri/drm/dri2.c
@@ -283,6 +283,7 @@ dri2_drawable_process_buffers(struct dri_drawable *drawable,
    templ.width0 = dri_drawable->w;
    templ.height0 = dri_drawable->h;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    memset(&whandle, 0, sizeof(whandle));
 
@@ -429,6 +430,7 @@ dri2_create_image_from_name(__DRIcontext *context,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    memset(&whandle, 0, sizeof(whandle));
    whandle.handle = name;
diff --git a/src/gallium/state_trackers/dri/sw/drisw.c b/src/gallium/state_trackers/dri/sw/drisw.c
index 1d6874c..5b0b1ac 100644
--- a/src/gallium/state_trackers/dri/sw/drisw.c
+++ b/src/gallium/state_trackers/dri/sw/drisw.c
@@ -198,6 +198,7 @@ drisw_allocate_textures(struct dri_drawable *drawable,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_image.c b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
index 6965051..0a0b161 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_image.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_image.c
@@ -108,7 +108,7 @@ egl_g3d_create_image(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx,
       FREE(gimg);
       return NULL;
    }
-   if (layer > ptex->depth0) {
+   if (layer >= (u_minify(ptex->depth0, level) + ptex->array_size - 1)) {
       _eglError(EGL_BAD_PARAMETER, "eglCreateEGLImageKHR");
       pipe_resource_reference(&gimg->texture, NULL);
       FREE(gimg);
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d_st.c b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
index bf6930e..d8696c7 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d_st.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d_st.c
@@ -307,6 +307,7 @@ pbuffer_allocate_render_texture(struct egl_g3d_surface *gsurf)
    templ.width0 = gsurf->base.Width;
    templ.height0 = gsurf->base.Height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.format = gsurf->stvis.color_format;
    templ.bind = PIPE_BIND_RENDER_TARGET;
 
diff --git a/src/gallium/state_trackers/egl/common/native_helper.c b/src/gallium/state_trackers/egl/common/native_helper.c
index cf60eb8..018b052 100644
--- a/src/gallium/state_trackers/egl/common/native_helper.c
+++ b/src/gallium/state_trackers/egl/common/native_helper.c
@@ -130,6 +130,7 @@ resource_surface_add_resources(struct resource_surface *rsurf,
    templ.width0 = rsurf->width;
    templ.height0 = rsurf->height;
    templ.depth0 = 1;
+   templ.array_size = 1;
 
    for (i = 0; i < NUM_NATIVE_ATTACHMENTS; i++) {
       if (resource_mask & (1 <<i)) {
diff --git a/src/gallium/state_trackers/egl/x11/native_dri2.c b/src/gallium/state_trackers/egl/x11/native_dri2.c
index 3f802dd..c1be6a7 100644
--- a/src/gallium/state_trackers/egl/x11/native_dri2.c
+++ b/src/gallium/state_trackers/egl/x11/native_dri2.c
@@ -135,6 +135,7 @@ dri2_surface_process_drawable_buffers(struct native_surface *nsurf,
    templ.width0 = dri2surf->width;
    templ.height0 = dri2surf->height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.format = dri2surf->color_format;
    templ.bind = PIPE_BIND_RENDER_TARGET;
 
diff --git a/src/gallium/state_trackers/glx/xlib/xm_st.c b/src/gallium/state_trackers/glx/xlib/xm_st.c
index 6061470..e76c8ba 100644
--- a/src/gallium/state_trackers/glx/xlib/xm_st.c
+++ b/src/gallium/state_trackers/glx/xlib/xm_st.c
@@ -135,6 +135,7 @@ xmesa_st_framebuffer_validate_textures(struct st_framebuffer_iface *stfbi,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c
index 854618d..0a8a429 100644
--- a/src/gallium/state_trackers/python/st_device.c
+++ b/src/gallium/state_trackers/python/st_device.c
@@ -241,6 +241,7 @@ st_context_create(struct st_device *st_dev)
       templat.width0 = 1;
       templat.height0 = 1;
       templat.depth0 = 1;
+      templat.array_size = 1;
       templat.last_level = 0;
       templat.bind = PIPE_BIND_SAMPLER_VIEW;
    
diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c
index 7160f8e..869733e 100644
--- a/src/gallium/state_trackers/vega/api_filters.c
+++ b/src/gallium/state_trackers/vega/api_filters.c
@@ -76,6 +76,7 @@ static INLINE struct pipe_resource *create_texture_1d(struct vg_context *ctx,
    templ.width0 = color_data_len;
    templ.height0 = 1;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c
index d5d64c2..9b877d8 100644
--- a/src/gallium/state_trackers/vega/image.c
+++ b/src/gallium/state_trackers/vega/image.c
@@ -280,6 +280,7 @@ struct vg_image * image_create(VGImageFormat format,
    pt.width0 = width;
    pt.height0 = height;
    pt.depth0 = 1;
+   pt.array_size = 1;
    pt.bind = PIPE_BIND_SAMPLER_VIEW;
 
    newtex = screen->resource_create(screen, &pt);
diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c
index afbc53b..6fd79f6 100644
--- a/src/gallium/state_trackers/vega/paint.c
+++ b/src/gallium/state_trackers/vega/paint.c
@@ -157,6 +157,7 @@ static INLINE struct pipe_resource *create_gradient_texture(struct vg_paint *p)
    templ.width0 = 1024;
    templ.height0 = 1;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c
index a585ca3..4049632 100644
--- a/src/gallium/state_trackers/vega/renderer.c
+++ b/src/gallium/state_trackers/vega/renderer.c
@@ -464,6 +464,7 @@ void renderer_copy_surface(struct renderer *ctx,
    texTemp.width0 = srcW;
    texTemp.height0 = srcH;
    texTemp.depth0 = 1;
+   texTemp.array_size = 1;
    texTemp.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &texTemp);
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index d09a71c..d98f022 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -64,6 +64,7 @@ create_texture(struct pipe_context *pipe, enum pipe_format format,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1)) {
diff --git a/src/gallium/state_trackers/wgl/stw_st.c b/src/gallium/state_trackers/wgl/stw_st.c
index 10cc8cb..77bf304 100644
--- a/src/gallium/state_trackers/wgl/stw_st.c
+++ b/src/gallium/state_trackers/wgl/stw_st.c
@@ -80,6 +80,7 @@ stw_st_framebuffer_validate_locked(struct st_framebuffer_iface *stfb,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
 
    for (i = 0; i < ST_ATTACHMENT_COUNT; i++) {
diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c
index cc23a22..308ea71 100644
--- a/src/gallium/state_trackers/xorg/xorg_crtc.c
+++ b/src/gallium/state_trackers/xorg/xorg_crtc.c
@@ -208,6 +208,7 @@ crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image)
 	templat.target = PIPE_TEXTURE_2D;
 	templat.last_level = 0;
 	templat.depth0 = 1;
+	templat.array_size = 1;
 	templat.format = PIPE_FORMAT_B8G8R8A8_UNORM;
 	templat.width0 = 64;
 	templat.height0 = 64;
diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c
index 4e01bd1..234e3ee 100644
--- a/src/gallium/state_trackers/xorg/xorg_dri2.c
+++ b/src/gallium/state_trackers/xorg/xorg_dri2.c
@@ -127,6 +127,7 @@ dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int form
 	    template.width0 = pDraw->width;
 	    template.height0 = pDraw->height;
 	    template.depth0 = 1;
+	    template.array_size = 1;
 	    template.last_level = 0;
 	    template.bind = PIPE_BIND_DEPTH_STENCIL |
 		PIPE_BIND_SHARED;
diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c
index 2f9b43f..e65e38b 100644
--- a/src/gallium/state_trackers/xorg/xorg_exa.c
+++ b/src/gallium/state_trackers/xorg/xorg_exa.c
@@ -874,6 +874,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height,
         }
 
 	template.depth0 = 1;
+	template.array_size = 1;
 	template.last_level = 0;
 	template.bind = PIPE_BIND_RENDER_TARGET | priv->flags;
 	priv->tex_flags = priv->flags;
@@ -943,6 +944,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn,
     template.width0 = width;
     template.height0 = height;
     template.depth0 = 1;
+    template.array_size = 1;
     template.last_level = 0;
     template.bind |= PIPE_BIND_RENDER_TARGET;
     template.bind |= PIPE_BIND_SCANOUT;
diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c
index 111b43e..a3d7c5a 100644
--- a/src/gallium/state_trackers/xorg/xorg_renderer.c
+++ b/src/gallium/state_trackers/xorg/xorg_renderer.c
@@ -536,6 +536,7 @@ renderer_clone_texture(struct xorg_renderer *r,
    templ.width0 = src->width0;
    templ.height0 = src->height0;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    pt = screen->resource_create(screen, &templ);
diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c
index 24e9662..8320f2b 100644
--- a/src/gallium/state_trackers/xorg/xorg_xv.c
+++ b/src/gallium/state_trackers/xorg/xorg_xv.c
@@ -171,6 +171,7 @@ create_component_texture(struct pipe_context *pipe,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
 
    tex = screen->resource_create(screen, &templ);
diff --git a/src/gallium/tests/graw/clear.c b/src/gallium/tests/graw/clear.c
index 8a414fb..7232061 100644
--- a/src/gallium/tests/graw/clear.c
+++ b/src/gallium/tests/graw/clear.c
@@ -80,6 +80,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/graw/fs-test.c b/src/gallium/tests/graw/fs-test.c
index 759e562..70954fe 100644
--- a/src/gallium/tests/graw/fs-test.c
+++ b/src/gallium/tests/graw/fs-test.c
@@ -100,6 +100,7 @@ static void init_fs_constbuf( void )
    templat.width0 = sizeof(constants);
    templat.height0 = 1;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_CONSTANT_BUFFER;
@@ -307,6 +308,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -416,6 +418,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/graw/gs-test.c b/src/gallium/tests/graw/gs-test.c
index 810610c..cacd986 100644
--- a/src/gallium/tests/graw/gs-test.c
+++ b/src/gallium/tests/graw/gs-test.c
@@ -121,6 +121,7 @@ static void init_fs_constbuf( void )
    templat.width0 = sizeof(constants);
    templat.height0 = 1;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_CONSTANT_BUFFER;
@@ -355,6 +356,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -464,6 +466,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/graw/quad-tex.c b/src/gallium/tests/graw/quad-tex.c
index 86c0485..30c1bc9 100644
--- a/src/gallium/tests/graw/quad-tex.c
+++ b/src/gallium/tests/graw/quad-tex.c
@@ -221,6 +221,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -330,6 +331,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/graw/tri-gs.c b/src/gallium/tests/graw/tri-gs.c
index cb786f6..0d718c3 100644
--- a/src/gallium/tests/graw/tri-gs.c
+++ b/src/gallium/tests/graw/tri-gs.c
@@ -200,6 +200,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/graw/tri.c b/src/gallium/tests/graw/tri.c
index ffe6eef..9f2138e 100644
--- a/src/gallium/tests/graw/tri.c
+++ b/src/gallium/tests/graw/tri.c
@@ -185,6 +185,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/graw/vs-test.c b/src/gallium/tests/graw/vs-test.c
index 26fa223..c44ee0e 100644
--- a/src/gallium/tests/graw/vs-test.c
+++ b/src/gallium/tests/graw/vs-test.c
@@ -87,6 +87,7 @@ static void init_fs_constbuf( void )
    templat.width0 = sizeof(constants);
    templat.height0 = 1;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_CONSTANT_BUFFER;
@@ -301,6 +302,7 @@ static void init_tex( void )
    templat.width0 = SIZE;
    templat.height0 = SIZE;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = PIPE_BIND_SAMPLER_VIEW;
@@ -410,6 +412,7 @@ static void init( void )
    templat.width0 = WIDTH;
    templat.height0 = HEIGHT;
    templat.depth0 = 1;
+   templat.array_size = 1;
    templat.last_level = 0;
    templat.nr_samples = 1;
    templat.bind = (PIPE_BIND_RENDER_TARGET |
diff --git a/src/gallium/tests/trivial/quad-tex.c b/src/gallium/tests/trivial/quad-tex.c
index b5eedaf..c8b1e80 100644
--- a/src/gallium/tests/trivial/quad-tex.c
+++ b/src/gallium/tests/trivial/quad-tex.c
@@ -146,6 +146,7 @@ static void init_prog(struct program *p)
 		tmplt.width0 = WIDTH;
 		tmplt.height0 = HEIGHT;
 		tmplt.depth0 = 1;
+		tmplt.array_size = 1;
 		tmplt.last_level = 0;
 		tmplt.bind = PIPE_BIND_RENDER_TARGET;
 
@@ -166,6 +167,7 @@ static void init_prog(struct program *p)
 		t_tmplt.width0 = 2;
 		t_tmplt.height0 = 2;
 		t_tmplt.depth0 = 1;
+		t_tmplt.array_size = 1;
 		t_tmplt.last_level = 0;
 		t_tmplt.bind = PIPE_BIND_RENDER_TARGET;
 
diff --git a/src/gallium/tests/trivial/tri.c b/src/gallium/tests/trivial/tri.c
index 8c8900d..91390dd 100644
--- a/src/gallium/tests/trivial/tri.c
+++ b/src/gallium/tests/trivial/tri.c
@@ -137,6 +137,7 @@ static void init_prog(struct program *p)
 		tmplt.width0 = WIDTH;
 		tmplt.height0 = HEIGHT;
 		tmplt.depth0 = 1;
+		tmplt.array_size = 1;
 		tmplt.last_level = 0;
 		tmplt.bind = PIPE_BIND_RENDER_TARGET;
 
diff --git a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
index 9fc73d2..6936cb5 100644
--- a/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
+++ b/src/gallium/winsys/sw/wrapper/wrapper_sw_winsys.c
@@ -148,6 +148,8 @@ wsw_dt_create(struct sw_winsys *ws,
    templ.target = PIPE_TEXTURE_2D;
    templ.width0 = width;
    templ.height0 = height;
+   templ.depth0 = 1;
+   templ.array_size = 1;
    templ.format = format;
    templ.bind = bind;
 
diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
index b2d7dd1..05c0b31 100644
--- a/src/mesa/state_tracker/st_cb_fbo.c
+++ b/src/mesa/state_tracker/st_cb_fbo.c
@@ -116,6 +116,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
       template.width0 = width;
       template.height0 = height;
       template.depth0 = 1;
+      template.array_size = 1;
       template.last_level = 0;
       template.nr_samples = rb->NumSamples;
       if (util_format_is_depth_or_stencil(format)) {
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index cec6da3..cab390b 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -458,6 +458,7 @@ compress_with_blit(GLcontext * ctx,
    templ.width0 = width;
    templ.height0 = height;
    templ.depth0 = 1;
+   templ.array_size = 1;
    templ.last_level = 0;
    templ.usage = PIPE_USAGE_DEFAULT;
    templ.bind = PIPE_BIND_SAMPLER_VIEW;
diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c
index b06a8a3..733a87d 100644
--- a/src/mesa/state_tracker/st_gen_mipmap.c
+++ b/src/mesa/state_tracker/st_gen_mipmap.c
@@ -194,12 +194,10 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target,
       const uint srcLevel = dstLevel - 1;
       const uint srcWidth = u_minify(pt->width0, srcLevel);
       const uint srcHeight = u_minify(pt->height0, srcLevel);
-      const uint srcDepth = pt->target == PIPE_TEXTURE_3D ?
-                            u_minify(pt->depth0, srcLevel) : 1;
+      const uint srcDepth = u_minify(pt->depth0, srcLevel);
       const uint dstWidth = u_minify(pt->width0, dstLevel);
       const uint dstHeight = u_minify(pt->height0, dstLevel);
-      const uint dstDepth = pt->target == PIPE_TEXTURE_3D ?
-                            u_minify(pt->depth0, dstLevel) : 1;
+      const uint dstDepth = u_minify(pt->depth0, dstLevel);
       struct pipe_transfer *srcTrans, *dstTrans;
       const ubyte *srcData;
       ubyte *dstData;
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index 927d1be..74eca91 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -84,6 +84,7 @@ st_texture_create(struct st_context *st,
    pt.width0 = width0;
    pt.height0 = height0;
    pt.depth0 = depth0;
+   pt.array_size = (target == PIPE_TEXTURE_CUBE ? 6 : 1);
    pt.usage = PIPE_USAGE_DEFAULT;
    pt.bind = bind;
    pt.flags = 0;
@@ -211,8 +212,7 @@ st_texture_image_data(struct st_context *st,
                       GLuint src_row_stride, GLuint src_image_stride)
 {
    struct pipe_context *pipe = st->pipe;
-   GLuint depth = dst->target == PIPE_TEXTURE_3D ?
-                  u_minify(dst->depth0, level) : 1;
+   GLuint depth = u_minify(dst->depth0, level);
    GLuint i;
    const GLubyte *srcUB = src;
    struct pipe_transfer *dst_transfer;
@@ -231,7 +231,7 @@ st_texture_image_data(struct st_context *st,
 		      src_row_stride,
 		      0, 0,                             /* source x, y */
 		      u_minify(dst->width0, level),
-                      u_minify(dst->height0, level));      /* width, height */
+                      u_minify(dst->height0, level));    /* width, height */
 
       pipe->transfer_destroy(pipe, dst_transfer);
 
@@ -281,15 +281,13 @@ st_texture_image_copy(struct pipe_context *pipe,
 {
    GLuint width = u_minify(dst->width0, dstLevel);
    GLuint height = u_minify(dst->height0, dstLevel);
-   GLuint depth = dst->target == PIPE_TEXTURE_3D ?
-                  u_minify(dst->depth0, dstLevel) : 1;
+   GLuint depth = u_minify(dst->depth0, dstLevel);
    struct pipe_box src_box;
    GLuint i;
 
    assert(u_minify(src->width0, srcLevel) == width);
    assert(u_minify(src->height0, srcLevel) == height);
-   assert((src->target == PIPE_TEXTURE_3D ?
-          u_minify(src->depth0, srcLevel) : 1) == depth);
+   assert(u_minify(src->depth0, srcLevel) == depth);
 
    src_box.x = 0;
    src_box.y = 0;



More information about the mesa-commit mailing list