diff options
author | Ian Romanick <[email protected]> | 2003-09-02 19:25:17 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2003-09-02 19:25:17 +0000 |
commit | c8363a31cfcd8e3c60387df31525158847ab1457 (patch) | |
tree | 9fd1fe501ec1edfa2412bfbcae8bb815c39824fc /src/mesa/main | |
parent | 886bc6f36c698df17cc8bcab0717ff0a039f3dd6 (diff) |
Added support for EXT_texture_mirror_clamp and the single wrap mode
that it addes to ATI_texture_mirror_once. This includes updating the
texwrap test to exercise the new mode.
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/extensions.c | 4 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 | ||||
-rw-r--r-- | src/mesa/main/texstate.c | 84 |
3 files changed, 37 insertions, 52 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 886311e0f1c..9928a5244e6 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -100,8 +100,9 @@ static const struct { { OFF, "GL_EXT_texture_env_combine", F(EXT_texture_env_combine) }, { OFF, "GL_EXT_texture_env_dot3", F(EXT_texture_env_dot3) }, { OFF, "GL_EXT_texture_filter_anisotropic", F(EXT_texture_filter_anisotropic) }, - { ON, "GL_EXT_texture_object", 0 }, { OFF, "GL_EXT_texture_lod_bias", F(EXT_texture_lod_bias) }, + { OFF, "GL_EXT_texture_mirror_clamp", F(EXT_texture_mirror_clamp) }, + { ON, "GL_EXT_texture_object", 0 }, { OFF, "GL_EXT_texture_rectangle", F(NV_texture_rectangle) }, { ON, "GL_EXT_vertex_array", 0 }, { OFF, "GL_EXT_vertex_array_set", F(EXT_vertex_array_set) }, @@ -196,6 +197,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.EXT_texture_env_add = GL_TRUE; ctx->Extensions.EXT_texture_env_combine = GL_TRUE; ctx->Extensions.EXT_texture_env_dot3 = GL_TRUE; + ctx->Extensions.EXT_texture_mirror_clamp = GL_TRUE; ctx->Extensions.EXT_texture_lod_bias = GL_TRUE; ctx->Extensions.HP_occlusion_test = GL_TRUE; ctx->Extensions.IBM_multimode_draw_arrays = GL_TRUE; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 47cb19b6259..a51a463602c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1770,6 +1770,7 @@ struct gl_extensions GLboolean EXT_texture_env_dot3; GLboolean EXT_texture_filter_anisotropic; GLboolean EXT_texture_lod_bias; + GLboolean EXT_texture_mirror_clamp; GLboolean EXT_vertex_array_set; GLboolean HP_occlusion_test; GLboolean IBM_rasterpos_clip; diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index a62106aa491..133b957aa56 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -1048,6 +1048,35 @@ _mesa_GetTexEnviv( GLenum target, GLenum pname, GLint *params ) /* Texture Parameters */ /**********************************************************************/ +static GLboolean +_mesa_validate_texture_wrap_mode(GLcontext * ctx, + GLenum target, GLenum eparam) +{ + 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)) { + /* any texture target */ + return GL_TRUE; + } + else if (target != GL_TEXTURE_RECTANGLE_NV && + (eparam == GL_REPEAT || + (eparam == GL_MIRRORED_REPEAT && + e->ARB_texture_mirrored_repeat) || + (eparam == GL_MIRROR_CLAMP_EXT && + (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || + (eparam == GL_MIRROR_CLAMP_TO_EDGE_EXT && + (e->ATI_texture_mirror_once || e->EXT_texture_mirror_clamp)) || + (eparam == GL_MIRROR_CLAMP_TO_BORDER_EXT && + (e->EXT_texture_mirror_clamp)))) { + /* non-rectangle texture */ + return GL_TRUE; + } + + _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return GL_FALSE; +} + void _mesa_TexParameterf( GLenum target, GLenum pname, GLfloat param ) @@ -1141,81 +1170,34 @@ _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_CLAMP_TO_EDGE || - (eparam == GL_CLAMP_TO_BORDER && - 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 && - ctx->Extensions.ARB_texture_mirrored_repeat) || - (eparam == GL_MIRROR_CLAMP_ATI && - ctx->Extensions.ATI_texture_mirror_once) || - (eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && - ctx->Extensions.ATI_texture_mirror_once))) { - /* non-rectangle texture */ + if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapS = eparam; } else { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } break; case GL_TEXTURE_WRAP_T: if (texObj->WrapT == eparam) return; - if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || - (eparam == GL_CLAMP_TO_BORDER && - 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 && - ctx->Extensions.ARB_texture_mirrored_repeat) || - (eparam == GL_MIRROR_CLAMP_ATI && - ctx->Extensions.ATI_texture_mirror_once) || - (eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && - ctx->Extensions.ATI_texture_mirror_once))) { - /* non-rectangle texture */ + if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapT = eparam; } else { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); return; } break; case GL_TEXTURE_WRAP_R: if (texObj->WrapR == eparam) return; - if (eparam == GL_CLAMP || eparam == GL_CLAMP_TO_EDGE || - (eparam == GL_CLAMP_TO_BORDER && - 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 && - ctx->Extensions.ARB_texture_mirrored_repeat) || - (eparam == GL_MIRROR_CLAMP_ATI && - ctx->Extensions.ATI_texture_mirror_once) || - (eparam == GL_MIRROR_CLAMP_TO_EDGE_ATI && - ctx->Extensions.ATI_texture_mirror_once))) { - /* non-rectangle texture */ + if (_mesa_validate_texture_wrap_mode(ctx, texObj->Target, eparam)) { FLUSH_VERTICES(ctx, _NEW_TEXTURE); texObj->WrapR = eparam; } else { - _mesa_error( ctx, GL_INVALID_VALUE, "glTexParameter(param)" ); + return; } break; case GL_TEXTURE_BORDER_COLOR: |