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

Brian Paul brianp at vmware.com
Fri May 28 14:03:33 PDT 2010


Will Dyson wrote:
> On Fri, May 28, 2010 at 1:57 PM, Brian Paul <brianp at vmware.com> wrote:
>>> @@ -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,
>>
>> I'm not sure I understand what's going on here.  The dstLevel should already
>> be <= the texture max level.  See the loop at line 2376.  If you step into
>> the new _mesa_TexParameteri() call with gdb, are you seeing dstLevel >
>> texObj->MaxLevel?
> 
> Yes, I am. After the first time through the loop, texObj->MaxLevel
> remains set to the srcLevel of the previous iteration.

Ah, right.

Still, the glTexImage() call should not be effected by the value of 
GL_TEXTURE_MAX_LEVEL.  I think there's a bug in the driver which this 
patch is just working around.

I wouldn't be suprised to find a GL app which calls 
glTexImage2D(level=X) when GL_TEXTURE_MAX_LEVEL < X.  Can you look 
into fixing the issue in the driver?  Other drivers seem OK in this 
regard.

-Brian



More information about the mesa-dev mailing list