[Mesa-dev] [PATCH 06/14] swr: fix texture layout for compressed formats
Cherniak, Bruce
bruce.cherniak at intel.com
Tue Nov 15 01:46:03 UTC 2016
Reviewed-by: Bruce Cherniak <bruce.cherniak at intel.com>
> On Nov 12, 2016, at 5:00 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
>
> Fixes the texsubimage piglit and lets the copyteximage one get further.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
> src/gallium/drivers/swr/swr_context.cpp | 5 +++--
> src/gallium/drivers/swr/swr_screen.cpp | 5 +++--
> 2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/drivers/swr/swr_context.cpp b/src/gallium/drivers/swr/swr_context.cpp
> index cbc60e0..6bc6de4 100644
> --- a/src/gallium/drivers/swr/swr_context.cpp
> +++ b/src/gallium/drivers/swr/swr_context.cpp
> @@ -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;
>
> diff --git a/src/gallium/drivers/swr/swr_screen.cpp b/src/gallium/drivers/swr/swr_screen.cpp
> index fa16edd..16a8bcf 100644
> --- a/src/gallium/drivers/swr/swr_screen.cpp
> +++ b/src/gallium/drivers/swr/swr_screen.cpp
> @@ -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)
> --
> 2.7.3
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list