[Mesa-dev] [PATCH 09/11] mesa: Compute proper strides for compressed texture pixel storage.

Ian Romanick idr at freedesktop.org
Mon Jun 2 15:26:56 PDT 2014


I really had to stare at this for a long time.  Hopefully someone else
can look at it too.  Either way, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 06/01/2014 11:29 PM, Chris Forbes wrote:
> Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
> ---
>  src/mesa/main/texstore.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
> index b5b7254..cb81f3f 100644
> --- a/src/mesa/main/texstore.c
> +++ b/src/mesa/main/texstore.c
> @@ -4212,6 +4212,41 @@ _mesa_compute_compressed_pixelstore(GLuint dims, struct gl_texture_image *texIma
>     store->TotalRowsPerSlice = store->CopyRowsPerSlice =
>           (height + bh - 1) / bh;
>     store->CopySlices = depth;
> +
> +   if (packing->CompressedBlockWidth &&
> +       packing->CompressedBlockSize) {
> +
> +      bw = packing->CompressedBlockWidth;
> +
> +      if (packing->RowLength) {
> +         store->TotalBytesPerRow = packing->CompressedBlockSize *
> +            (packing->RowLength + bw - 1) / bw;
> +      }
> +
> +      store->SkipBytes += packing->SkipPixels * packing->CompressedBlockSize / bw;
> +   }
> +
> +   if (dims > 1 && packing->CompressedBlockHeight &&
> +       packing->CompressedBlockSize) {
> +
> +      bh = packing->CompressedBlockHeight;
> +
> +      store->SkipBytes += packing->SkipRows * store->TotalBytesPerRow / bh;
> +      store->CopyRowsPerSlice = (height + bh - 1) / bh;  /* rows in blocks */
> +
> +      if (packing->ImageHeight) {
> +         store->TotalRowsPerSlice = (packing->ImageHeight + bh - 1) / bh;
> +      }
> +   }
> +
> +   if (dims > 2 && packing->CompressedBlockDepth &&
> +       packing->CompressedBlockSize) {
> +
> +      int bd = packing->CompressedBlockDepth;
> +
> +      store->SkipBytes += packing->SkipImages * store->TotalBytesPerRow *
> +            store->TotalRowsPerSlice / bd;
> +   }
>  }
>  
>  
> 



More information about the mesa-dev mailing list