[Mesa-dev] [PATCH 1/2] _meta_GenerateMipmap: Set MaxLevel before allocating level

Eric Anholt eric at anholt.net
Fri May 28 14:30:56 PDT 2010


On Fri, 28 May 2010 13:35:46 -0400, Will Dyson <will.dyson at gmail.com> wrote:
> The radeon driver will fail to allocate miptree space for a new level
> that is outside of BaseLevel..MaxLevel. Then it fails later, trying to
> migrate the level to a miptree. Set MaxLevel to dstLevel before
> allocating the level, and avoid triggering the problem.
> 
> Signed-off-by: Will Dyson <will.dyson at gmail.com>
> ---
>  src/mesa/drivers/common/meta.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
> index fc28685..3525583 100644
> --- a/src/mesa/drivers/common/meta.c
> +++ b/src/mesa/drivers/common/meta.c
> @@ -2400,6 +2400,9 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target,
>           break;
>        }
>  
> +      /* Set MaxLevel large enough to hold the new level when we allocate it  */
> +      _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, dstLevel);
> +
>        /* Create empty dest image */
>        if (target == GL_TEXTURE_1D) {
>           _mesa_TexImage1D(target, dstLevel, srcImage->InternalFormat,
> -- 
> 1.7.1

I'm pretty sure the value of MAX_LEVEL shouldn't impact whether teximage
storage is successfully allocated or not.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20100528/3a6977bd/attachment.pgp>


More information about the mesa-dev mailing list