softpipe: Calculate slice_stride field in get_transfer().
authorMichal Krol <michal@vmware.com>
Tue, 18 May 2010 10:39:01 +0000 (12:39 +0200)
committerMichal Krol <michal@vmware.com>
Wed, 19 May 2010 06:23:33 +0000 (08:23 +0200)
src/gallium/drivers/softpipe/sp_texture.c

index 7aa85559b236d0d3a8dfa6f79782b8e0a5752c53..4e6123fbd07834303e2cc9ed07265f0c45c2b37f 100644 (file)
@@ -343,11 +343,15 @@ softpipe_get_transfer(struct pipe_context *pipe,
    if (spt) {
       struct pipe_transfer *pt = &spt->base;
       enum pipe_format format = resource->format;
+      const unsigned hgt = u_minify(spr->base.height0, sr.level);
+      const unsigned nblocksy = util_format_get_nblocksy(format, hgt);
+
       pipe_resource_reference(&pt->resource, resource);
       pt->sr = sr;
       pt->usage = usage;
       pt->box = *box;
       pt->stride = spr->stride[sr.level];
+      pt->slice_stride = pt->stride * nblocksy;
 
       spt->offset = sp_get_tex_image_offset(spr, sr.level, sr.face, box->z);