summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-10-24 11:33:58 -0600
committerBrian Paul <brianp@vmware.com>2009-10-24 11:33:58 -0600
commitd255aaf54f9a4398247698408bd45698b1cefe58 (patch)
treeb288160cc0ae9734e6e63631882de837920c3153 /src/mesa/main
parent7b16c43e436715bef9118fdb28ca8a9ad91b1e66 (diff)
mesa: remove hard-coded block sizes
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/texstore.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index d0d4250352..ff6931156e 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3670,14 +3670,18 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
GLubyte *dest;
const GLubyte *src;
const gl_format texFormat = texImage->TexFormat;
+ GLuint bw, bh;
+ _mesa_get_format_block_size(texFormat, &bw, &bh);
+
+ (void) level;
(void) format;
/* these should have been caught sooner */
- ASSERT((width & 3) == 0 || width == 2 || width == 1);
- ASSERT((height & 3) == 0 || height == 2 || height == 1);
- ASSERT((xoffset & 3) == 0);
- ASSERT((yoffset & 3) == 0);
+ ASSERT((width % bw) == 0 || width == 2 || width == 1);
+ ASSERT((height % bh) == 0 || height == 2 || height == 1);
+ ASSERT((xoffset % bw) == 0);
+ ASSERT((yoffset % bh) == 0);
/* get pointer to src pixels (may be in a pbo which we'll map here) */
data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data,
@@ -3696,7 +3700,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target,
(GLubyte *) texImage->Data);
bytesPerRow = srcRowStride;
- rows = height / 4;
+ rows = height / bh; /* rows in blocks */
for (i = 0; i < rows; i++) {
MEMCPY(dest, src, bytesPerRow);