aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/mipmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/mipmap.c')
-rw-r--r--src/mesa/main/mipmap.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c
index f6d6ce33c86..e24e7285c36 100644
--- a/src/mesa/main/mipmap.c
+++ b/src/mesa/main/mipmap.c
@@ -1614,24 +1614,19 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
dstImage->TexFormat = srcImage->TexFormat;
dstImage->FetchTexelc = srcImage->FetchTexelc;
dstImage->FetchTexelf = srcImage->FetchTexelf;
+
+ /* Alloc new teximage data buffer.
+ * Setup src and dest data pointers.
+ */
if (_mesa_is_format_compressed(dstImage->TexFormat)) {
- dstImage->CompressedSize
+ GLuint dstCompressedSize
= ctx->Driver.CompressedTextureSize(ctx, dstImage->Width,
dstImage->Height,
dstImage->Depth,
dstImage->TexFormat);
- ASSERT(dstImage->CompressedSize > 0);
- }
-
- ASSERT(dstImage->TexFormat);
- ASSERT(dstImage->FetchTexelc);
- ASSERT(dstImage->FetchTexelf);
+ ASSERT(dstCompressedSize > 0);
- /* Alloc new teximage data buffer.
- * Setup src and dest data pointers.
- */
- if (_mesa_is_format_compressed(dstImage->TexFormat)) {
- dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize);
+ dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize);
if (!dstImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps");
return;
@@ -1653,6 +1648,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
dstData = (GLubyte *) dstImage->Data;
}
+ ASSERT(dstImage->TexFormat);
+ ASSERT(dstImage->FetchTexelc);
+ ASSERT(dstImage->FetchTexelf);
+
_mesa_generate_mipmap_level(target, datatype, comps, border,
srcWidth, srcHeight, srcDepth,
srcData, srcImage->RowStride,