minor simplification in glGetTexLevelParameter
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: texstate.c,v 1.47 2001/04/24 16:11:35 brianp Exp $ */
|
/* $Id: texstate.c,v 1.48 2001/04/25 15:41:22 brianp Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mesa 3-D graphics library
|
* Mesa 3-D graphics library
|
||||||
@@ -1124,7 +1124,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||||||
const struct gl_texture_image *img = NULL;
|
const struct gl_texture_image *img = NULL;
|
||||||
GLuint dimensions;
|
GLuint dimensions;
|
||||||
GLboolean isProxy;
|
GLboolean isProxy;
|
||||||
GLenum baseIntFormat;
|
|
||||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||||
|
|
||||||
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
|
if (level < 0 || level >= ctx->Const.MaxTextureLevels) {
|
||||||
@@ -1148,8 +1147,6 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
baseIntFormat = _mesa_base_tex_format(ctx, img->IntFormat);
|
|
||||||
|
|
||||||
isProxy = (target == GL_PROXY_TEXTURE_1D) ||
|
isProxy = (target == GL_PROXY_TEXTURE_1D) ||
|
||||||
(target == GL_PROXY_TEXTURE_2D) ||
|
(target == GL_PROXY_TEXTURE_2D) ||
|
||||||
(target == GL_PROXY_TEXTURE_3D) ||
|
(target == GL_PROXY_TEXTURE_3D) ||
|
||||||
@@ -1172,36 +1169,32 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||||||
*params = img->Border;
|
*params = img->Border;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_RED_SIZE:
|
case GL_TEXTURE_RED_SIZE:
|
||||||
if (baseIntFormat == GL_RGB ||
|
if (img->Format == GL_RGB || img->Format == GL_RGBA)
|
||||||
baseIntFormat == GL_RGBA)
|
|
||||||
*params = img->TexFormat->RedBits;
|
*params = img->TexFormat->RedBits;
|
||||||
else
|
else
|
||||||
*params = 0;
|
*params = 0;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_GREEN_SIZE:
|
case GL_TEXTURE_GREEN_SIZE:
|
||||||
if (baseIntFormat == GL_RGB ||
|
if (img->Format == GL_RGB || img->Format == GL_RGBA)
|
||||||
baseIntFormat == GL_RGBA)
|
|
||||||
*params = img->TexFormat->GreenBits;
|
*params = img->TexFormat->GreenBits;
|
||||||
else
|
else
|
||||||
*params = 0;
|
*params = 0;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_BLUE_SIZE:
|
case GL_TEXTURE_BLUE_SIZE:
|
||||||
if (baseIntFormat == GL_RGB ||
|
if (img->Format == GL_RGB || img->Format == GL_RGBA)
|
||||||
baseIntFormat == GL_RGBA)
|
|
||||||
*params = img->TexFormat->BlueBits;
|
*params = img->TexFormat->BlueBits;
|
||||||
else
|
else
|
||||||
*params = 0;
|
*params = 0;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_ALPHA_SIZE:
|
case GL_TEXTURE_ALPHA_SIZE:
|
||||||
if (baseIntFormat == GL_ALPHA ||
|
if (img->Format == GL_ALPHA || img->Format == GL_LUMINANCE_ALPHA ||
|
||||||
baseIntFormat == GL_LUMINANCE_ALPHA ||
|
img->Format == GL_RGBA)
|
||||||
baseIntFormat == GL_RGBA)
|
|
||||||
*params = img->TexFormat->AlphaBits;
|
*params = img->TexFormat->AlphaBits;
|
||||||
else
|
else
|
||||||
*params = 0;
|
*params = 0;
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_INTENSITY_SIZE:
|
case GL_TEXTURE_INTENSITY_SIZE:
|
||||||
if (baseIntFormat != GL_INTENSITY)
|
if (img->Format != GL_INTENSITY)
|
||||||
*params = 0;
|
*params = 0;
|
||||||
else if (img->TexFormat->IntensityBits > 0)
|
else if (img->TexFormat->IntensityBits > 0)
|
||||||
*params = img->TexFormat->IntensityBits;
|
*params = img->TexFormat->IntensityBits;
|
||||||
@@ -1209,8 +1202,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||||||
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
|
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_LUMINANCE_SIZE:
|
case GL_TEXTURE_LUMINANCE_SIZE:
|
||||||
if (baseIntFormat != GL_LUMINANCE &&
|
if (img->Format != GL_LUMINANCE &&
|
||||||
baseIntFormat != GL_LUMINANCE_ALPHA)
|
img->Format != GL_LUMINANCE_ALPHA)
|
||||||
*params = 0;
|
*params = 0;
|
||||||
else if (img->TexFormat->LuminanceBits > 0)
|
else if (img->TexFormat->LuminanceBits > 0)
|
||||||
*params = img->TexFormat->LuminanceBits;
|
*params = img->TexFormat->LuminanceBits;
|
||||||
@@ -1218,7 +1211,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level,
|
|||||||
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
|
*params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits);
|
||||||
return;
|
return;
|
||||||
case GL_TEXTURE_INDEX_SIZE_EXT:
|
case GL_TEXTURE_INDEX_SIZE_EXT:
|
||||||
if (baseIntFormat == GL_COLOR_INDEX)
|
if (img->Format == GL_COLOR_INDEX)
|
||||||
*params = img->TexFormat->IndexBits;
|
*params = img->TexFormat->IndexBits;
|
||||||
else
|
else
|
||||||
*params = 0;
|
*params = 0;
|
||||||
|
Reference in New Issue
Block a user