diff options
author | Ian Romanick <idr@us.ibm.com> | 2005-09-22 21:25:31 +0000 |
---|---|---|
committer | Ian Romanick <idr@us.ibm.com> | 2005-09-22 21:25:31 +0000 |
commit | 7b01068a231f7a1c21b58f5191a6f5f11df79d3f (patch) | |
tree | cc0a85b7bec636a90e81c083dd4281103ced7fb6 /src | |
parent | 676d0accf5cc43e86057b14cfb8bba9316932582 (diff) |
Enable GL_ARB_texture_mirrored_repeat on Savage4. Refactor the code that
sets the texture wrap mode and texture filter mode for Savage4 to the new
functions savage4_set_wrap_mode and savage4_set_filter_mode.
This was tested with texwrap and tunnel.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/savage/savage_xmesa.c | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagedd.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/savage/savagetex.c | 146 |
3 files changed, 80 insertions, 69 deletions
diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index c3c0a8c971..bf8ec304f7 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -142,6 +142,7 @@ static const struct dri_extension card_extensions[] = static const struct dri_extension s4_extensions[] = { { "GL_ARB_texture_env_add", NULL }, + { "GL_ARB_texture_mirrored_repeat", NULL }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/savage/savagedd.c b/src/mesa/drivers/dri/savage/savagedd.c index 72d7d33ce3..ced44e562f 100644 --- a/src/mesa/drivers/dri/savage/savagedd.c +++ b/src/mesa/drivers/dri/savage/savagedd.c @@ -42,7 +42,7 @@ #include "utils.h" -#define DRIVER_DATE "20050501" +#define DRIVER_DATE "20050829" /*************************************** * Mesa's Driver Functions diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 5584e371e6..ce9d1def8e 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -1086,6 +1086,78 @@ static void savageUploadTexImages( savageContextPtr imesa, savageTexObjPtr t ) } +static void +savage4_set_wrap_mode( savageContextPtr imesa, unsigned unit, + GLenum s_mode, GLenum t_mode ) +{ + switch( s_mode ) { + case GL_REPEAT: + imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Wrap; + break; + case GL_CLAMP: + case GL_CLAMP_TO_EDGE: + imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Clamp; + break; + case GL_MIRRORED_REPEAT: + imesa->regs.s4.texCtrl[ unit ].ni.uMode = TAM_Mirror; + break; + } + + switch( t_mode ) { + case GL_REPEAT: + imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Wrap; + break; + case GL_CLAMP: + case GL_CLAMP_TO_EDGE: + imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Clamp; + break; + case GL_MIRRORED_REPEAT: + imesa->regs.s4.texCtrl[ unit ].ni.vMode = TAM_Mirror; + break; + } +} + + +/** + * Sets the hardware bits for the specified GL texture filter modes. + * + * \todo + * Does the Savage4 have the ability to select the magnification filter? + */ +static void +savage4_set_filter_mode( savageContextPtr imesa, unsigned unit, + GLenum minFilter, GLenum magFilter ) +{ + (void) magFilter; + + switch (minFilter) { + case GL_NEAREST: + imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Point; + imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_FALSE; + break; + + case GL_LINEAR: + imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Bilin; + imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_FALSE; + break; + + case GL_NEAREST_MIPMAP_NEAREST: + imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Point; + imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE; + break; + + case GL_LINEAR_MIPMAP_NEAREST: + imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Bilin; + imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE; + break; + + case GL_NEAREST_MIPMAP_LINEAR: + case GL_LINEAR_MIPMAP_LINEAR: + imesa->regs.s4.texCtrl[ unit ].ni.filterMode = TFM_Trilin; + imesa->regs.s4.texCtrl[ unit ].ni.mipmapEnable = GL_TRUE; + break; + } +} static void savageUpdateTex0State_s4( GLcontext *ctx ) @@ -1301,39 +1373,8 @@ static void savageUpdateTex0State_s4( GLcontext *ctx ) break; } - imesa->regs.s4.texCtrl[0].ni.uMode = - t->setup.sWrapMode == GL_REPEAT ? 0 : 1; - imesa->regs.s4.texCtrl[0].ni.vMode = - t->setup.tWrapMode == GL_REPEAT ? 0 : 1; - - switch (t->setup.minFilter) - { - case GL_NEAREST: - imesa->regs.s4.texCtrl[0].ni.filterMode = TFM_Point; - imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_FALSE; - break; - - case GL_LINEAR: - imesa->regs.s4.texCtrl[0].ni.filterMode = TFM_Bilin; - imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_FALSE; - break; - - case GL_NEAREST_MIPMAP_NEAREST: - imesa->regs.s4.texCtrl[0].ni.filterMode = TFM_Point; - imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_TRUE; - break; - - case GL_LINEAR_MIPMAP_NEAREST: - imesa->regs.s4.texCtrl[0].ni.filterMode = TFM_Bilin; - imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_TRUE; - break; - - case GL_NEAREST_MIPMAP_LINEAR: - case GL_LINEAR_MIPMAP_LINEAR: - imesa->regs.s4.texCtrl[0].ni.filterMode = TFM_Trilin; - imesa->regs.s4.texCtrl[0].ni.mipmapEnable = GL_TRUE; - break; - } + savage4_set_wrap_mode( imesa, 0, t->setup.sWrapMode, t->setup.tWrapMode ); + savage4_set_filter_mode( imesa, 0, t->setup.minFilter, t->setup.magFilter ); if((ctx->Texture.Unit[0].LodBias !=0.0F) || (imesa->regs.s4.texCtrl[0].ni.dBias != 0)) @@ -1514,45 +1555,14 @@ static void savageUpdateTex1State_s4( GLcontext *ctx ) break; default: - fprintf(stderr, "unkown tex 1 env mode\n"); + fprintf(stderr, "unknown tex 1 env mode\n"); exit(1); break; } - imesa->regs.s4.texCtrl[1].ni.uMode = - t->setup.sWrapMode == GL_REPEAT ? 0 : 1; - imesa->regs.s4.texCtrl[1].ni.vMode = - t->setup.tWrapMode == GL_REPEAT ? 0 : 1; + savage4_set_wrap_mode( imesa, 1, t->setup.sWrapMode, t->setup.tWrapMode ); + savage4_set_filter_mode( imesa, 1, t->setup.minFilter, t->setup.magFilter ); - switch (t->setup.minFilter) - { - case GL_NEAREST: - imesa->regs.s4.texCtrl[1].ni.filterMode = TFM_Point; - imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_FALSE; - break; - - case GL_LINEAR: - imesa->regs.s4.texCtrl[1].ni.filterMode = TFM_Bilin; - imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_FALSE; - break; - - case GL_NEAREST_MIPMAP_NEAREST: - imesa->regs.s4.texCtrl[1].ni.filterMode = TFM_Point; - imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_TRUE; - break; - - case GL_LINEAR_MIPMAP_NEAREST: - imesa->regs.s4.texCtrl[1].ni.filterMode = TFM_Bilin; - imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_TRUE; - break; - - case GL_NEAREST_MIPMAP_LINEAR: - case GL_LINEAR_MIPMAP_LINEAR: - imesa->regs.s4.texCtrl[1].ni.filterMode = TFM_Trilin; - imesa->regs.s4.texCtrl[1].ni.mipmapEnable = GL_TRUE; - break; - } - if((ctx->Texture.Unit[1].LodBias !=0.0F) || (imesa->regs.s4.texCtrl[1].ni.dBias != 0)) { @@ -1650,7 +1660,7 @@ static void savageUpdateTexState_s3d( GLcontext *ctx ) imesa->regs.s3d.drawCtrl.ni.texBlendCtrl = SAVAGETBC_MODULATEALPHA_S3D; break; default: - fprintf(stderr, "unkown tex env mode\n"); + fprintf(stderr, "unknown tex env mode\n"); /*exit(1);*/ break; } |