diff options
Diffstat (limited to 'src/mesa/main/texstate.c')
-rw-r--r-- | src/mesa/main/texstate.c | 103 |
1 files changed, 73 insertions, 30 deletions
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 8319613804f..2284499bf3d 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1,4 +1,4 @@ -/* $Id: texstate.c,v 1.74 2002/06/15 02:38:16 brianp Exp $ */ +/* $Id: texstate.c,v 1.75 2002/06/15 03:03:09 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -967,11 +967,19 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) texObj = texUnit->Current3D; break; case GL_TEXTURE_CUBE_MAP_ARB: - if (ctx->Extensions.ARB_texture_cube_map) { - texObj = texUnit->CurrentCubeMap; - break; + if (!ctx->Extensions.ARB_texture_cube_map) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; } - /* fallthrough */ + texObj = texUnit->CurrentCubeMap; + break; + case GL_TEXTURE_RECTANGLE_NV: + if (!ctx->Extensions.NV_texture_rectangle) { + _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); + return; + } + texObj = texUnit->CurrentRect; + break; default: _mesa_error( ctx, GL_INVALID_ENUM, "glTexParameter(target)" ); return; @@ -983,11 +991,15 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) if (texObj->MinFilter == eparam) return; - if (eparam==GL_NEAREST || eparam==GL_LINEAR - || eparam==GL_NEAREST_MIPMAP_NEAREST - || eparam==GL_LINEAR_MIPMAP_NEAREST - || eparam==GL_NEAREST_MIPMAP_LINEAR - || eparam==GL_LINEAR_MIPMAP_LINEAR) { + if (eparam==GL_NEAREST || eparam==GL_LINEAR) { + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->MinFilter = eparam; + } + else if ((eparam==GL_NEAREST_MIPMAP_NEAREST || + eparam==GL_LINEAR_MIPMAP_NEAREST || + eparam==GL_NEAREST_MIPMAP_LINEAR || + eparam==GL_LINEAR_MIPMAP_LINEAR) && + texObj->Target != GL_TEXTURE_RECTANGLE_NV) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->MinFilter = eparam; } @@ -1013,13 +1025,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_WRAP_S: if (texObj->WrapS == eparam) return; - if (eparam==GL_CLAMP || - eparam==GL_REPEAT || - eparam==GL_CLAMP_TO_EDGE || + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER_ARB && - ctx->Extensions.ARB_texture_border_clamp) || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat)) { + ctx->Extensions.ARB_texture_border_clamp)) { + /* any texture target */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapS = eparam; + } + else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT_ARB && + ctx->Extensions.ARB_texture_mirrored_repeat))) { + /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapS = eparam; } @@ -1031,13 +1048,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_WRAP_T: if (texObj->WrapT == eparam) return; - if (eparam==GL_CLAMP || - eparam==GL_REPEAT || - eparam==GL_CLAMP_TO_EDGE || + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER_ARB && - ctx->Extensions.ARB_texture_border_clamp) || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat)) { + ctx->Extensions.ARB_texture_border_clamp)) { + /* any texture target */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapT = eparam; + } + else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT_ARB && + ctx->Extensions.ARB_texture_mirrored_repeat))) { + /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapT = eparam; } @@ -1049,13 +1071,18 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) case GL_TEXTURE_WRAP_R_EXT: if (texObj->WrapR == eparam) return; - if (eparam==GL_CLAMP || - eparam==GL_REPEAT || - eparam==GL_CLAMP_TO_EDGE || + if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || (eparam == GL_CLAMP_TO_BORDER_ARB && - ctx->Extensions.ARB_texture_border_clamp) || - (eparam == GL_MIRRORED_REPEAT_ARB && - ctx->Extensions.ARB_texture_mirrored_repeat)) { + ctx->Extensions.ARB_texture_border_clamp)) { + /* any texture target */ + FLUSH_VERTICES(ctx, _NEW_TEXTURE); + texObj->WrapR = eparam; + } + else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT_ARB && + ctx->Extensions.ARB_texture_mirrored_repeat))) { + /* non-rectangle texture */ FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapR = eparam; } @@ -1103,6 +1130,10 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params ) _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } + if (target == GL_TEXTURE_RECTANGLE_NV && params[0] != 0.0) { + _mesa_error(ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; + } FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->BaseLevel = (GLint) params[0]; break; @@ -1321,6 +1352,9 @@ tex_image_dimensions(GLcontext *ctx, GLenum target) case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: return ctx->Extensions.ARB_texture_cube_map ? 2 : 0; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + return ctx->Extensions.NV_texture_rectangle ? 2 : 0; default: _mesa_problem(ctx, "bad target in _mesa_tex_target_dimensions()"); return 0; @@ -1358,9 +1392,17 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_PROXY_TEXTURE_3D: maxLevels = ctx->Const.Max3DTextureLevels; break; - default: + case GL_TEXTURE_CUBE_MAP_ARB: + case GL_PROXY_TEXTURE_CUBE_MAP_ARB: maxLevels = ctx->Const.MaxCubeTextureLevels; break; + case GL_TEXTURE_RECTANGLE_NV: + case GL_PROXY_TEXTURE_RECTANGLE_NV: + maxLevels = 1; + break; + default: + _mesa_problem(ctx, "bad target in _mesa_GetTexLevelParameter"); + return; } if (level < 0 || level >= maxLevels) { @@ -1381,7 +1423,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, isProxy = (target == GL_PROXY_TEXTURE_1D) || (target == GL_PROXY_TEXTURE_2D) || (target == GL_PROXY_TEXTURE_3D) || - (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB); + (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB) || + (target == GL_PROXY_TEXTURE_RECTANGLE_NV); switch (pname) { case GL_TEXTURE_WIDTH: |