summaryrefslogtreecommitdiff
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-05-08 23:59:38 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-05-08 23:59:38 +0000
commita5467697336f201abee19cba1521be80e5c87d3b (patch)
tree7382871740719aa765ad8066b780bb19b4b2e7b7 /src/mesa/main/texstore.c
parentc3c19be8e0d0b13916cc128cf3c8e839935c912a (diff)
two more texture compression fixes
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index b9a1925be0..4868b806ea 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,