summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2002-10-18 18:03:04 +0000
committerBrian Paul <[email protected]>2002-10-18 18:03:04 +0000
commitef31f60b12abc2109568fb8d9a2aaa70ec5c71cc (patch)
tree7f35cbee92127a0e1b06b9a95656bf8cfcb46550 /src/mesa/main/texstore.c
parent53d30c56eb1a0865a6a88cf05c4c74673d41b2a4 (diff)
new _mesa_max_texture_levels() helper function - not used everywhere yet
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c28
1 files changed, 4 insertions, 24 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index 91bd6357549..2be6e476458 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -1,4 +1,4 @@
-/* $Id: texstore.c,v 1.43 2002/10/18 17:41:45 brianp Exp $ */
+/* $Id: texstore.c,v 1.44 2002/10/18 18:03:08 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1897,34 +1897,14 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
const struct gl_texture_format *convertFormat;
const GLubyte *srcData;
GLubyte *dstData;
- GLint level;
- GLint maxLevels = 0;
+ GLint level, maxLevels;
ASSERT(texObj);
srcImage = texObj->Image[texObj->BaseLevel];
ASSERT(srcImage);
- switch (texObj->Target) {
- case GL_TEXTURE_1D:
- maxLevels = ctx->Const.MaxTextureLevels;
- break;
- case GL_TEXTURE_2D:
- maxLevels = ctx->Const.MaxTextureLevels;
- break;
- case GL_TEXTURE_3D:
- maxLevels = ctx->Const.Max3DTextureLevels;
- break;
- case GL_TEXTURE_CUBE_MAP_ARB:
- maxLevels = ctx->Const.MaxCubeTextureLevels;
- break;
- case GL_TEXTURE_RECTANGLE_NV:
- maxLevels = 1;
- break;
- default:
- _mesa_problem(ctx,
- "Bad texture object dimension in _mesa_generate_mipmaps");
- return;
- }
+ maxLevels = _mesa_max_texture_levels(ctx, texObj->Target);
+ ASSERT(maxLevels > 0); /* bad target */
/* Find convertFormat - the format that do_row() will process */
if (srcImage->IsCompressed) {