#include <stdio.h>
#include "macros.h"
-#define DRIVER_DATE "20020221"
+#define DRIVER_DATE "20040923"
#include "utils.h"
"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
};
}
}
+/**
+ * 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);
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
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: