rename/clean-up _mesa_validate_texture_wrap_mode

This commit is contained in:
Brian 2007-06-11 16:42:35 -06:00
parent 84e051b6a0
commit 495e2c8327

View file

@ -1141,26 +1141,29 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params )
/* Texture Parameters */
/**********************************************************************/
/**
* Check if a coordinate wrap mode is supported for the texture target.
* \return GL_TRUE if legal, GL_FALSE otherwise
*/
static GLboolean
_mesa_validate_texture_wrap_mode(GLcontext * ctx,
GLenum target, GLenum eparam)
validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap)
{
const struct gl_extensions * const e = & ctx->Extensions;
if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE ||
(eparam == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
if (wrap == GL_CLAMP || wrap == GL_CLAMP_TO_EDGE ||
(wrap == GL_CLAMP_TO_BORDER && e->ARB_texture_border_clamp)) {
/* any texture target */
return GL_TRUE;
}
else if (target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT &&
(wrap == GL_REPEAT ||
(wrap == GL_MIRRORED_REPEAT &&
e->ARB_texture_mirrored_repeat) ||
(eparam == GL_MIRROR_CLAMP_EXT &&
(wrap == GL_MIRROR_CLAMP_EXT &&
(e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
(eparam == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
(wrap == GL_MIRROR_CLAMP_TO_EDGE_EXT &&
(e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) ||
(eparam == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
(wrap == GL_MIRROR_CLAMP_TO_BORDER_EXT &&
(e->EXT_texture_mirror_clamp)))) {
/* non-rectangle texture */
return GL_TRUE;
@ -1316,7 +1319,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_S:
if (texObj->WrapS == eparam)
return;
if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapS = eparam;
}
@ -1327,7 +1330,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_T:
if (texObj->WrapT == eparam)
return;
if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapT = eparam;
}
@ -1338,7 +1341,7 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
case GL_TEXTURE_WRAP_R:
if (texObj->WrapR == eparam)
return;
if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
if (validate_texture_wrap_mode(ctx, texObj->Target, eparam)) {
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapR = eparam;
}