diff options
author | Brian Paul <[email protected]> | 2011-11-23 15:33:46 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2011-11-28 08:07:26 -0700 |
commit | d45c9b239fdc2a2e06e14fc94c118f27d4011024 (patch) | |
tree | b870c65edb91598e66dcca03b57c8af8cf0a0398 /src/mesa | |
parent | f0b6e9a729d14740fc607c1148032d688f3c5c2c (diff) |
mesa: combine GL_TEXTURE_INTENSITY/LUMINANCE_SIZE queries
Use the _mesa_base_format_has_channel() helper as we do for the
other texture format component queries.
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/texparam.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 4c30a36f412..99a4b432b41 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -1071,28 +1071,19 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = 0; break; case GL_TEXTURE_INTENSITY_SIZE: - if (img->_BaseFormat != GL_INTENSITY) - *params = 0; - else { + case GL_TEXTURE_LUMINANCE_SIZE: + if (_mesa_base_format_has_channel(img->_BaseFormat, pname)) { *params = _mesa_get_format_bits(texFormat, pname); if (*params == 0) { - /* intensity probably stored as rgb texture */ - *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE), - _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE)); + /* intensity or luminance is probably stored as RGB[A] */ + *params = MIN2(_mesa_get_format_bits(texFormat, + GL_TEXTURE_RED_SIZE), + _mesa_get_format_bits(texFormat, + GL_TEXTURE_GREEN_SIZE)); } } - break; - case GL_TEXTURE_LUMINANCE_SIZE: - if (img->_BaseFormat != GL_LUMINANCE && - img->_BaseFormat != GL_LUMINANCE_ALPHA) - *params = 0; else { - *params = _mesa_get_format_bits(texFormat, pname); - if (*params == 0) { - /* luminance probably stored as rgb texture */ - *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE), - _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE)); - } + *params = 0; } break; case GL_TEXTURE_DEPTH_SIZE_ARB: |