Factored out code for setting texture coordinate wrap bits. Added support
authorIan Romanick <idr@us.ibm.com>
Thu, 30 Sep 2004 21:18:23 +0000 (21:18 +0000)
committerIan Romanick <idr@us.ibm.com>
Thu, 30 Sep 2004 21:18:23 +0000 (21:18 +0000)
for GL_ARB_texture_mirrored_repeat.  Enabled GL_NV_blend_square.  It has
always actually been supported.  Removed redundant EXT versions of ARB
extension strings.

src/mesa/drivers/dri/unichrome/via_context.c
src/mesa/drivers/dri/unichrome/via_state.c

index a496380c79e137906f0aa18181f685b10b836481..4ebf393ac87cfb407bc44342d67b8bffd45c552a 100644 (file)
@@ -59,7 +59,7 @@
 #include <stdio.h>
 #include "macros.h"
 
-#define DRIVER_DATE    "20020221"
+#define DRIVER_DATE    "20040923"
 
 #include "utils.h"
 
@@ -263,12 +263,12 @@ static const char * const card_extensions[] =
    "GL_ARB_texture_env_add",
    "GL_ARB_texture_env_combine",     /* John Sheng [2003.7.18] tex combine */
    "GL_ARB_texture_env_dot3",        /* John Sheng [2003.7.18] tex dot3 */
-   "GL_EXT_point_parameters",        /* John Sheng [2003.7.18] point param. */
+   "GL_ARB_texture_mirrored_repeat",
    "GL_EXT_stencil_wrap",
-   "GL_EXT_texture_env_add",
    "GL_EXT_texture_env_combine",     /* John Sheng [2003.7.18] tex combine */
    "GL_EXT_texture_env_dot3",        /* John Sheng [2003.7.18] tex dot3 */
    "GL_EXT_texture_lod_bias",
+   "GL_NV_blend_square",
    NULL
 };
 
index 44858bd8e0b4208cbc3a3fc67d2b9252cc410f37..c8a3234c954c4ccac1315ce5c44d21dd49af3806 100644 (file)
@@ -506,6 +506,44 @@ void viaInitState(GLcontext *ctx)
     }
 }
 
+/**
+ * Convert S and T texture coordinate wrap modes to hardware bits.
+ */
+static uint32_t
+get_wrap_mode( GLenum sWrap, GLenum tWrap )
+{
+    uint32_t v = 0;
+
+
+    switch( sWrap ) {
+    case GL_REPEAT:
+       v |= HC_HTXnMPMD_Srepeat;
+       break;
+    case GL_CLAMP:
+    case GL_CLAMP_TO_EDGE:
+       v |= HC_HTXnMPMD_Sclamp;
+       break;
+    case GL_MIRRORED_REPEAT:
+       v |= HC_HTXnMPMD_Smirror;
+       break;
+    }
+
+    switch( tWrap ) {
+    case GL_REPEAT:
+       v |= HC_HTXnMPMD_Trepeat;
+       break;
+    case GL_CLAMP:
+    case GL_CLAMP_TO_EDGE:
+       v |= HC_HTXnMPMD_Tclamp;
+       break;
+    case GL_MIRRORED_REPEAT:
+       v |= HC_HTXnMPMD_Tmirror;
+       break;
+    }
+    
+    return v;
+}
+
 void viaChooseTextureState(GLcontext *ctx) 
 {
     viaContextPtr vmesa = VIA_CONTEXT(ctx);
@@ -580,17 +618,10 @@ void viaChooseTextureState(GLcontext *ctx)
                                       HC_HTXnFLTe_Nearest;
             }
 
-            if (texObj->WrapS == GL_REPEAT)
-                vmesa->regHTXnMPMD_0 = HC_HTXnMPMD_Srepeat;
-            else
-                vmesa->regHTXnMPMD_0 = HC_HTXnMPMD_Sclamp;
+           vmesa->regHTXnMPMD_0 &= ~(HC_HTXnMPMD_SMASK | HC_HTXnMPMD_TMASK);
+           vmesa->regHTXnMPMD_0 |= get_wrap_mode( texObj->WrapS,
+                                                  texObj->WrapT );
 
-            if (GL_TRUE) {
-                if (texObj->WrapT == GL_REPEAT)
-                    vmesa->regHTXnMPMD_0 |= HC_HTXnMPMD_Trepeat;
-                else
-                    vmesa->regHTXnMPMD_0 |= HC_HTXnMPMD_Tclamp;
-            }
 #ifdef DEBUG
            if (VIA_DEBUG) fprintf(stderr, "texUnit0->EnvMode %x\n",texUnit0->EnvMode);    
 #endif
@@ -3135,17 +3166,9 @@ void viaChooseTextureState(GLcontext *ctx)
                    break;
            }
            
-            if (texObj->WrapS == GL_REPEAT)
-                vmesa->regHTXnMPMD_1 = HC_HTXnMPMD_Srepeat;
-            else
-                vmesa->regHTXnMPMD_1 = HC_HTXnMPMD_Sclamp;
-
-            if (GL_TRUE) {
-                if (texObj->WrapT == GL_REPEAT)
-                    vmesa->regHTXnMPMD_1 |= HC_HTXnMPMD_Trepeat;
-                else
-                    vmesa->regHTXnMPMD_1 |= HC_HTXnMPMD_Tclamp;
-            }
+           vmesa->regHTXnMPMD_1 &= ~(HC_HTXnMPMD_SMASK | HC_HTXnMPMD_TMASK);
+           vmesa->regHTXnMPMD_1 |= get_wrap_mode( texObj->WrapS,
+                                                  texObj->WrapT );
 
             switch (texUnit1->EnvMode) {
             case GL_MODULATE: