summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/main/extensions.c4
-rw-r--r--src/mesa/main/mtypes.h3
-rw-r--r--src/mesa/main/texstate.c20
-rw-r--r--src/mesa/swrast/s_texture.c52
4 files changed, 71 insertions, 8 deletions
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index ec4422daa2..f37c07d33d 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -1,4 +1,4 @@
-/* $Id: extensions.c,v 1.82 2002/10/16 17:57:52 brianp Exp $ */
+/* $Id: extensions.c,v 1.83 2002/10/21 15:52:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -73,6 +73,7 @@ static struct {
{ OFF, "GL_ARB_texture_mirrored_repeat", F(ARB_texture_mirrored_repeat)},
{ ON, "GL_ARB_transpose_matrix", 0 },
{ ON, "GL_ARB_window_pos", F(ARB_window_pos) },
+ { OFF, "GL_ATI_texture_mirror_once", F(ATI_texture_mirror_once)},
{ ON, "GL_EXT_abgr", 0 },
{ ON, "GL_EXT_bgra", 0 },
{ OFF, "GL_EXT_blend_color", F(EXT_blend_color) },
@@ -160,6 +161,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx)
"GL_ARB_texture_env_crossbar",
"GL_ARB_texture_env_dot3",
"GL_ARB_texture_mirrored_repeat",
+ "GL_ATI_texture_mirror_once",
"GL_EXT_blend_color",
"GL_EXT_blend_func_separate",
"GL_EXT_blend_logic_op",
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 10f8e2bf57..fde7e3fab2 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1,4 +1,4 @@
-/* $Id: mtypes.h,v 1.96 2002/10/11 17:41:04 brianp Exp $ */
+/* $Id: mtypes.h,v 1.97 2002/10/21 15:52:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1367,6 +1367,7 @@ struct gl_extensions {
GLboolean ARB_texture_env_dot3;
GLboolean ARB_texture_mirrored_repeat;
GLboolean ARB_window_pos;
+ GLboolean ATI_texture_mirror_once;
GLboolean EXT_blend_color;
GLboolean EXT_blend_func_separate;
GLboolean EXT_blend_logic_op;
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 0da213404b..ce40c56f13 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -1,4 +1,4 @@
-/* $Id: texstate.c,v 1.81 2002/10/17 22:26:06 kschultz Exp $ */
+/* $Id: texstate.c,v 1.82 2002/10/21 15:52:34 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -1093,7 +1093,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_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 */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapS = eparam;
@@ -1116,7 +1120,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_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 */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapT = eparam;
@@ -1139,7 +1147,11 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
else if (texObj->Target != GL_TEXTURE_RECTANGLE_NV &&
(eparam == GL_REPEAT ||
(eparam == GL_MIRRORED_REPEAT_ARB &&
- ctx->Extensions.ARB_texture_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 */
FLUSH_VERTICES(ctx, _NEW_TEXTURE);
texObj->WrapR = eparam;
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index db2e9e0df9..6929a3cf3a 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -1,4 +1,4 @@
-/* $Id: s_texture.c,v 1.71 2002/10/18 17:02:01 kschultz Exp $ */
+/* $Id: s_texture.c,v 1.72 2002/10/21 15:52:35 brianp Exp $ */
/*
* Mesa 3-D graphics library
@@ -97,7 +97,31 @@
U = 1.0F - (S - (GLfloat) flr); /* flr is odd */ \
else \
U = S - (GLfloat) flr; /* flr is even */ \
- U = (U * SIZE) - 0.5F; \
+ U = (U * SIZE) - 0.5; \
+ I0 = IFLOOR(U); \
+ I1 = I0 + 1; \
+ if (I0 < 0) \
+ I0 = 0; \
+ if (I1 >= (GLint) SIZE) \
+ I1 = SIZE - 1; \
+ } \
+ else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \
+ U = fabs(S); \
+ if (U >= 1.0F) \
+ U = (GLfloat) SIZE; \
+ else \
+ U *= SIZE; \
+ U -= 0.5F; \
+ I0 = IFLOOR(U); \
+ I1 = I0 + 1; \
+ } \
+ else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \
+ U = fabs(S); \
+ if (U >= 1.0F) \
+ U = (GLfloat) SIZE; \
+ else \
+ U *= SIZE; \
+ U -= 0.5F; \
I0 = IFLOOR(U); \
I1 = I0 + 1; \
if (I0 < 0) \
@@ -171,6 +195,30 @@
else \
I = IFLOOR(u * SIZE); \
} \
+ else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \
+ /* s limited to [0,1] */ \
+ /* i limited to [0,size-1] */ \
+ const GLfloat u = fabs(S); \
+ if (u <= 0.0F) \
+ I = 0; \
+ else if (u >= 1.0F) \
+ I = SIZE - 1; \
+ else \
+ I = IFLOOR(u * SIZE); \
+ } \
+ else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \
+ /* s limited to [min,max] */ \
+ /* i limited to [0, size-1] */ \
+ const GLfloat min = 1.0F / (2.0F * SIZE); \
+ const GLfloat max = 1.0F - min; \
+ const GLfloat u = fabs(S); \
+ if (u < min) \
+ I = 0; \
+ else if (u > max) \
+ I = SIZE - 1; \
+ else \
+ I = IFLOOR(u * SIZE); \
+ } \
else { \
ASSERT(wrapMode == GL_CLAMP); \
/* s limited to [0,1] */ \