diff options
author | Brian Paul <[email protected]> | 2001-06-13 14:56:14 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2001-06-13 14:56:14 +0000 |
commit | cd1cefae9146fc14b35ee93a04bdb1b1590fba7b (patch) | |
tree | 01f74b0349d478ed65822a3271ce7cdf8384a304 /src/mesa/main/texstate.c | |
parent | cc22179cd855dad85a28c40416873a07e8b7cc0c (diff) |
Allow different max texture sizes for 1/2D, 3D and cube maps.
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r-- | src/mesa/main/texstate.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 9615684a013..09bf872fe48 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.52 2001/06/12 22:08:41 brianp Exp $ */ +/* $Id: texstate.c,v 1.53 2001/06/13 14:56:14 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1133,19 +1133,36 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, const struct gl_texture_image *img = NULL; GLuint dimensions; GLboolean isProxy; + GLint maxLevels; ASSERT_OUTSIDE_BEGIN_END(ctx); - if (level < 0 || level >= ctx->Const.MaxTextureLevels) { - _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); - return; - } - dimensions = tex_image_dimensions(ctx, target); /* 1, 2 or 3 */ if (dimensions == 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(target)"); return; } + switch (target) { + case GL_TEXTURE_1D: + case GL_PROXY_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_PROXY_TEXTURE_2D: + maxLevels = ctx->Const.MaxTextureLevels; + break; + case GL_TEXTURE_3D: + case GL_PROXY_TEXTURE_3D: + maxLevels = ctx->Const.Max3DTextureLevels; + break; + default: + maxLevels = ctx->Const.MaxCubeTextureLevels; + break; + } + + if (level < 0 || level >= maxLevels) { + _mesa_error( ctx, GL_INVALID_VALUE, "glGetTexLevelParameter[if]v" ); + return; + } + img = _mesa_select_tex_image(ctx, texUnit, target, level); if (!img || !img->TexFormat) { /* undefined texture image */ |