X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fmipmap.c;h=4d3e62572d5149304147eaf50efbfe2cecba63f8;hb=167ffa9e035befd12143db909af424e5de8f64e4;hp=47db2acdf0689af7f71e13d5ed742241b79951b6;hpb=ca327b1688a8f70a4d01bf80d11508c90aafe64f;p=mesa.git diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 47db2acdf06..4d3e62572d5 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1370,6 +1370,9 @@ make_2d_stack_mipmap(GLenum datatype, GLuint comps, GLint border, /** * Down-sample a texture image to produce the next lower mipmap level. + * \param comps components per texel (1, 2, 3 or 4) + * \param srcRowStride stride between source rows, in texels + * \param dstRowStride stride between destination rows, in texels */ void _mesa_generate_mipmap_level(GLenum target, @@ -1507,7 +1510,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* Find convertFormat - the format that do_row() will process */ if (srcImage->IsCompressed) { - /* setup for compressed textures */ + /* setup for compressed textures - need to allocate temporary + * image buffers to hold uncompressed images. + */ GLuint row; GLint components, size; GLchan *dst; @@ -1584,11 +1589,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, &dstWidth, &dstHeight, &dstDepth); if (!nextLevel) { /* all done */ - if (srcImage->IsCompressed) { - _mesa_free((void *) srcData); - _mesa_free(dstData); - } - return; + break; } /* get dest gl_texture_image */ @@ -1598,9 +1599,6 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, return; } - if (dstImage->ImageOffsets) - _mesa_free(dstImage->ImageOffsets); - /* Free old image data */ if (dstImage->Data) ctx->Driver.FreeTexImageData(ctx, dstImage); @@ -1682,6 +1680,12 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } } /* loop over mipmap levels */ + + if (srcImage->IsCompressed) { + /* free uncompressed image buffers */ + _mesa_free((void *) srcData); + _mesa_free(dstData); + } }