diff options
Diffstat (limited to 'src/mesa/swrast/s_texture.c')
-rw-r--r-- | src/mesa/swrast/s_texture.c | 35 |
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] */ \ |