diff options
author | Chris Forbes <[email protected]> | 2014-06-02 15:50:09 +1200 |
---|---|---|
committer | Chris Forbes <[email protected]> | 2014-06-10 07:42:45 +1200 |
commit | be30766f5675cd1b6528a1a0b839c69aa894419d (patch) | |
tree | adca7dcbe1899176e7a31eb47171e5726f82f831 | |
parent | 8d29569c254c4697fdf6bffd52510ba114461ad6 (diff) |
mesa: Compute proper strides for compressed texture pixel storage.
Signed-off-by: Chris Forbes <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
-rw-r--r-- | src/mesa/main/texstore.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index b5b725405e5..cb81f3fde8d 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; + } } |