mesa: Don't report types for 0-sized components of textures.
authorEric Anholt <eric@anholt.net>
Fri, 4 Nov 2011 22:28:58 +0000 (15:28 -0700)
committerEric Anholt <eric@anholt.net>
Tue, 22 Nov 2011 21:58:37 +0000 (13:58 -0800)
commit250a9c8e7eabd38e38f39898b117f26533609d07
tree39fe413700b02c7b4a2563b1d7f7348553f4b450
parent034e63b9f8ee23cfac769b1a2c431bdd2307a6c4
mesa: Don't report types for 0-sized components of textures.

The GL_TEXTURE_WHATEVER_SIZE entrypoints were checking if the
specified base type of the texture allowed that channel to be present
before reporting the size of the channel, so that GL_RGB didn't end up
with an alpha size if the hardware driver had to store it that way.

The GL_TEXTURE_WHATEVER_TYPE entrypoints weren't checking it, so you
would end up with strange responses from the GL involving 0-bit
floating-point alpha components in GL_RGB32F, even though it says
GL_NONE as expected for other 0-sized channels.

Make _TYPE check _BaseFormat the same as _SIZE, which results in
fixing most of the GL_RGB* testcases of gl-3.0-required-sized-formats
pass on i965.

v2: Add a default case with a warning (suggestion by Brian Paul)

Reviewed-by: Brian Paul <brianp@vmware.com> (v1)
src/mesa/main/texparam.c