swr: fix texture layout for compressed formats

Fixes the texsubimage piglit and lets the copyteximage one get further.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
Ilia Mirkin 2016-11-09 16:41:16 -05:00
parent 00efbbc38c
commit 8c0f76e961
2 changed files with 6 additions and 4 deletions

View File

@ -157,8 +157,9 @@ swr_transfer_map(struct pipe_context *pipe,
}
}
unsigned offset = box->z * pt->layer_stride + box->y * pt->stride
+ box->x * util_format_get_blocksize(format);
unsigned offset = box->z * pt->layer_stride +
util_format_get_nblocksy(format, box->y) * pt->stride +
util_format_get_stride(format, box->x);
*transfer = pt;

View File

@ -796,8 +796,9 @@ swr_texture_layout(struct swr_screen *screen,
res->alignedHeight = alignedHeight;
}
res->row_stride[level] = alignedWidth * finfo.Bpp;
res->img_stride[level] = res->row_stride[level] * alignedHeight;
res->row_stride[level] = util_format_get_stride(fmt, alignedWidth);
res->img_stride[level] =
res->row_stride[level] * util_format_get_nblocksy(fmt, alignedHeight);
res->mip_offsets[level] = total_size;
if (pt->target == PIPE_TEXTURE_3D)