Add support for GL_ARB_texture_border_clamp and GL_ARB_texture_mirrored_repeat,
authorEric Anholt <anholt@FreeBSD.org>
Mon, 24 Oct 2005 08:02:44 +0000 (08:02 +0000)
committerEric Anholt <anholt@FreeBSD.org>
Mon, 24 Oct 2005 08:02:44 +0000 (08:02 +0000)
tested using texwrap, fixing the sourcing of border constant values (use the
bytes, not the floats!).  Remove the fallback on GL_CLAMP_TO_EDGE, which acts
properly, and add a note to GL_CLAMP about nonconformance (whcih is what the
fallback for CLAMP_TO_EDGE was probably targeting).

src/mesa/drivers/dri/sis/sis_context.c
src/mesa/drivers/dri/sis/sis_texstate.c

index 22ced964af68b16fe2eb67262b48ea74dc716e25..fab3847496504c9256680c9d09b017ac17bfecf7 100644 (file)
@@ -73,6 +73,8 @@ struct dri_extension card_extensions[] =
 {
     { "GL_ARB_multisample",                GL_ARB_multisample_functions },
     { "GL_ARB_multitexture",               NULL },
+    { "GL_ARB_texture_border_clamp",       NULL },
+    { "GL_ARB_texture_mirrored_repeat",    NULL },
     { "GL_EXT_texture_lod_bias",           NULL },
     { "GL_EXT_stencil_wrap",               NULL },
     { "GL_NV_blend_square",                NULL },
index b5da62cd7c50a6f94e14e1b51e2cc9b3acb4ded6..021919b0a42ad0d9a0e6f4aedd78a6bc42ca44fb 100644 (file)
@@ -383,14 +383,21 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
    case GL_REPEAT:
       current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapU;
       break;
+   case GL_MIRRORED_REPEAT:
+      current->texture[hw_unit].hwTextureSet |= MASK_TextureMirrorU;
+      break;
    case GL_CLAMP:
       current->texture[hw_unit].hwTextureSet |= MASK_TextureClampU;
+       /* XXX: GL_CLAMP isn't conformant, but falling back makes the situation
+        * worse in other programs at the moment.
+        */
+      /*ok = 0;*/
       break;
    case GL_CLAMP_TO_EDGE:
-      /* 
-      * ?? not support yet 
-      */
-      ok = 0;
+      current->texture[hw_unit].hwTextureSet |= MASK_TextureClampU;
+      break;
+   case GL_CLAMP_TO_BORDER:
+      current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderU;
       break;
    }
 
@@ -399,34 +406,30 @@ sis_set_texobj_parm( GLcontext *ctx, struct gl_texture_object *texObj,
    case GL_REPEAT:
       current->texture[hw_unit].hwTextureSet |= MASK_TextureWrapV;
       break;
+   case GL_MIRRORED_REPEAT:
+      current->texture[hw_unit].hwTextureSet |= MASK_TextureMirrorV;
+      break;
    case GL_CLAMP:
       current->texture[hw_unit].hwTextureSet |= MASK_TextureClampV;
+       /* XXX: GL_CLAMP isn't conformant, but falling back makes the situation
+        * worse in other programs at the moment.
+        */
+      /*ok = 0;*/
       break;
    case GL_CLAMP_TO_EDGE:
-      /* 
-      * ?? not support yet 
-      */
-      ok = 0;
+      current->texture[hw_unit].hwTextureSet |= MASK_TextureClampV;
       break;
-   }
-
-/*
-   if (current->texture[hw_unit].hwTextureSet & MASK_TextureClampU) {
-      current->texture[hw_unit].hwTextureSet &= ~MASK_TextureClampU;
-      current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderU;
-   }
-   
-   if (current->texture[hw_unit].hwTextureSet & MASK_TextureClampV) {
-      current->texture[hw_unit].hwTextureSet &= ~MASK_TextureClampV;
+   case GL_CLAMP_TO_BORDER:
       current->texture[hw_unit].hwTextureSet |= MASK_TextureBorderV;
+      break;
    }
-*/
+
    current->texture[hw_unit].hwTextureBorderColor = 
-      ((GLuint) texObj->BorderColor[3] << 24) + 
-      ((GLuint) texObj->BorderColor[0] << 16) + 
-      ((GLuint) texObj->BorderColor[1] << 8) + 
-      ((GLuint) texObj->BorderColor[2]);
-   
+      ((GLuint) texObj->_BorderChan[3] << 24) + 
+      ((GLuint) texObj->_BorderChan[0] << 16) + 
+      ((GLuint) texObj->_BorderChan[1] << 8) + 
+      ((GLuint) texObj->_BorderChan[2]);
+
    if (current->texture[hw_unit].hwTextureBorderColor !=
        prev->texture[hw_unit].hwTextureBorderColor) 
    {