Ian Romanick wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> In _mesa_GetTexLevelParameteriv there are checks in all the
> GL_TEXTURE_*_BITS queries that the base format has the specified component:
> 
>       case GL_TEXTURE_RED_SIZE:
>       case GL_TEXTURE_GREEN_SIZE:
>       case GL_TEXTURE_BLUE_SIZE:
>          if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA)
>             *params = _mesa_get_format_bits(texFormat, pname);
>          else
>             *params = 0;
>          break;
>       case GL_TEXTURE_ALPHA_SIZE:
>          if (img->_BaseFormat == GL_ALPHA ||
>              img->_BaseFormat == GL_LUMINANCE_ALPHA ||
>              img->_BaseFormat == GL_RGBA)
>             *params = _mesa_get_format_bits(texFormat, pname);
>          else
>             *params = 0;
>          break;
> 
> Since the values are stored in a big table in formats.c, are these
> checks really necessary?  If the base format is GL_INTENSITY, the
> redBits entry in the table is already 0.
> 
> Am I missing something?

Remember that texFormat is the _actual_ format used to store the 
texture, not the user-requested format.  We need to return values 
pertinent to the requested format, not the actual format.

For example, suppose the user requests a GL_LUMINANCE internal format 
but the driver actually chooses an RGBA888 format because a true 
luminance format is not available.  If the user queries 
GL_TEXTURE_RED_SIZE we're supposed to return 0, not 8.

That's why we do the extra checks.


> I'm reviving the texture_rg branch (actually a new branch), and I'd like
> to clean this up, if possible, before adding more if-checks for GL_RED
> and GL_RG textures when querying GL_TEXTURE_RED_SIZE and
> GL_TEXTURE_BLUE_SIZE.

If you find a cleaner way to implement this, go for it.

-Brian


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to