diff options
author | Brian Paul <[email protected]> | 2006-05-08 23:59:38 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2006-05-08 23:59:38 +0000 |
commit | a5467697336f201abee19cba1521be80e5c87d3b (patch) | |
tree | 7382871740719aa765ad8066b780bb19b4b2e7b7 | |
parent | c3c19be8e0d0b13916cc128cf3c8e839935c912a (diff) |
two more texture compression fixes
-rw-r--r-- | src/mesa/main/texstore.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index b9a1925be02..4868b806ea7 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2963,9 +2963,9 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, destRowStride = _mesa_compressed_row_stride(mesaFormat, texImage->Width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->InternalFormat, + texImage->TexFormat->MesaFormat, texImage->Width, - (GLubyte*) texImage->Data); + (GLubyte *) texImage->Data); bytesPerRow = srcRowStride; rows = height / 4; @@ -4255,6 +4255,8 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, const struct gl_texture_object *texObj, const struct gl_texture_image *texImage) { + GLuint size; + if (ctx->Pack.BufferObj->Name) { /* pack texture image into a PBO */ GLubyte *buf; @@ -4280,8 +4282,13 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, return; } + /* don't use texImage->CompressedSize since that may be padded out */ + size = _mesa_compressed_texture_size(ctx, texImage->Width, texImage->Height, + texImage->Depth, + texImage->TexFormat->MesaFormat); + /* just memcpy, no pixelstore or pixel transfer */ - MEMCPY(img, texImage->Data, texImage->CompressedSize); + _mesa_memcpy(img, texImage->Data, size); if (ctx->Pack.BufferObj->Name) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, |