aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2003-09-02 19:25:17 +0000
committerIan Romanick <[email protected]>2003-09-02 19:25:17 +0000
commitc8363a31cfcd8e3c60387df31525158847ab1457 (patch)
tree9fd1fe501ec1edfa2412bfbcae8bb815c39824fc /src/mesa/swrast
parent886bc6f36c698df17cc8bcab0717ff0a039f3dd6 (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/swrast')
-rw-r--r--src/mesa/swrast/s_texture.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c
index 6f38aab7f0a..a196f34c275 100644
--- a/src/mesa/swrast/s_texture.c
+++ b/src/mesa/swrast/s_texture.c
@@ -122,7 +122,7 @@ repeat_remainder(GLint a, GLint b)
if (I1 >= (GLint) SIZE) \
I1 = SIZE - 1; \
} \
- else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \
+ else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \
U = (GLfloat) fabs(S); \
if (U >= 1.0F) \
U = (GLfloat) SIZE; \
@@ -132,7 +132,7 @@ repeat_remainder(GLint a, GLint b)
I0 = IFLOOR(U); \
I1 = I0 + 1; \
} \
- else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \
+ else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \
U = (GLfloat) fabs(S); \
if (U >= 1.0F) \
U = (GLfloat) SIZE; \
@@ -146,6 +146,20 @@ repeat_remainder(GLint a, GLint b)
if (I1 >= (GLint) SIZE) \
I1 = SIZE - 1; \
} \
+ else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \
+ const GLfloat min = -1.0F / (2.0F * SIZE); \
+ const GLfloat max = 1.0F - min; \
+ U = (GLfloat) fabs(S); \
+ if (U <= min) \
+ U = min * SIZE; \
+ else if (U >= max) \
+ U = max * SIZE; \
+ else \
+ U *= SIZE; \
+ U -= 0.5F; \
+ I0 = IFLOOR(U); \
+ I1 = I0 + 1; \
+ } \
else { \
ASSERT(wrapMode == GL_CLAMP); \
if (S <= 0.0F) \
@@ -215,7 +229,7 @@ repeat_remainder(GLint a, GLint b)
else \
I = IFLOOR(u * SIZE); \
} \
- else if (wrapMode == GL_MIRROR_CLAMP_ATI) { \
+ else if (wrapMode == GL_MIRROR_CLAMP_EXT) { \
/* s limited to [0,1] */ \
/* i limited to [0,size-1] */ \
const GLfloat u = (GLfloat) fabs(S); \
@@ -226,7 +240,7 @@ repeat_remainder(GLint a, GLint b)
else \
I = IFLOOR(u * SIZE); \
} \
- else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_ATI) { \
+ else if (wrapMode == GL_MIRROR_CLAMP_TO_EDGE_EXT) { \
/* s limited to [min,max] */ \
/* i limited to [0, size-1] */ \
const GLfloat min = 1.0F / (2.0F * SIZE); \
@@ -239,6 +253,19 @@ repeat_remainder(GLint a, GLint b)
else \
I = IFLOOR(u * SIZE); \
} \
+ else if (wrapMode == GL_MIRROR_CLAMP_TO_BORDER_EXT) { \
+ /* 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 = (GLfloat) fabs(S); \
+ if (u < min) \
+ I = -1; \
+ else if (u > max) \
+ I = SIZE; \
+ else \
+ I = IFLOOR(u * SIZE); \
+ } \
else { \
ASSERT(wrapMode == GL_CLAMP); \
/* s limited to [0,1] */ \