diff options
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_context.c | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/unichrome/via_state.c | 65 |
2 files changed, 47 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index a496380c79e..4ebf393ac87 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -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 }; diff --git a/src/mesa/drivers/dri/unichrome/via_state.c b/src/mesa/drivers/dri/unichrome/via_state.c index 44858bd8e0b..c8a3234c954 100644 --- a/src/mesa/drivers/dri/unichrome/via_state.c +++ b/src/mesa/drivers/dri/unichrome/via_state.c @@ -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: |