[Mesa-dev] Bug in _mesa_meta_GenerateMipmap

Maciej Cencora m.cencora at gmail.com
Mon Jul 12 12:41:08 PDT 2010


Dnia poniedziałek 12 lipca 2010 o 20:31:42 Brian Paul napisał(a):
> Maciej Cencora wrote:
> > Hi,
> > 
> > while working on failing piglit tests I've stumbled on a problem with
> > _mesa_meta_GenerateMipmap. The function creates new texture images for
> > lower mipmap levels, but during call to glTexImage the format and type
> > are hardcoded to GL_RGBA and GL_UNSIGNED_BYTE respectivily. And that's
> > where the problem arise because base image (the one that other levels
> > are generated from) could have other format and type specified (in
> > failing test texturing/gen-teximage these are GL_RGBA, GL_FLOAT).
> > The result is that for base image MESA_FORMAT_ARGB8888 is chosen and for
> > next levels it's MESA_FORMAT_RGBA8888_REV. Of course such texture with
> > images of different formats is invalid and will be missampled by GPU.
> > 
> > As the fix is not straightforward for me (not sure where to get format
> > and type from, since the gl_texture_image doesn't hold them) could
> > someone more familiar with core mesa take a look at this?
> 
> Which driver are you using?
> 
> I suspect the problem is the driver's ChooseTextureFormat() callback
> is using more than the 'internalFormat' parameter to choose the actual
> hardware format (i.e. it's also using the format/type params).  Later,
> when we're building the mipmap we don't know the format/type params
> used for creating the base image so we just use GL_RGBA/GL_UNSIGNED_BYTE.
> 
> We could save those original params when glTexImage2D() is called to
> create the base image, but that would be of no use if the base image
> was created with glCopyTexImage2D().
> 
> We might just be able to "poke" in the actual format for the new image
> to override whatever was chosen.  I'll try to write a patch later...
> 
> -Brian

I'm using r300 driver. As you suspect the radeonChooseTextureFormat 
(radeon_texture.c) function takes into account format and type to avoid 
unnecessary conversions in TexImage callback.

Regards,
Maciej


More information about the mesa-dev mailing list