From 1e0b6a90d78ed78eb9e22c65abd5af314142a844 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Dec 2011 14:35:18 -0800 Subject: [PATCH] mesa: Fix glCompressedTexSubImage (and non-Sub) for height == 2 or 1. Generally this code works with width and height aligned to compressed blocks, but at the 2x2 and 1x1 levels of a square texture (or height < bh in general), we were skipping uploading our single row of blocks. Fixes piglit compressedteximage GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. Reviewed-by: Brian Paul --- src/mesa/main/texstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 237f920793b..99adf799f62 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -5139,7 +5139,7 @@ _mesa_store_compressed_texsubimage2d(struct gl_context *ctx, GLenum target, if (dstMap) { bytesPerRow = srcRowStride; /* bytes per row of blocks */ - rows = height / bh; /* rows in blocks */ + rows = (height + bh - 1) / bh; /* rows in blocks */ /* copy rows of blocks */ for (i = 0; i < rows; i++) { -- 2.30.2