diff options
author | Brian Paul <[email protected]> | 2009-02-21 14:53:25 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-02-21 14:53:25 -0700 |
commit | 9818734e0148510967ca9ee0d1aa8b196b509f02 (patch) | |
tree | 28f32aeadff161ca159674699151063c4728d1bc /src/mesa/drivers | |
parent | 4d24b639d160fe485a3e8f7395e7654538be29e0 (diff) |
mesa: use an array for current texture objects
Use loops to consolidate lots of texture object code.
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/common/texmem.c | 10 | ||||
-rw-r--r-- | src/mesa/drivers/dri/gamma/gamma_tex.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/mga/mga_texstate.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/dri/r300/r300_state.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/s3v/s3v_tex.c | 8 | ||||
-rw-r--r-- | src/mesa/drivers/x11/xm_api.c | 6 |
6 files changed, 21 insertions, 21 deletions
diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index ff174a251d2..041d8c6e97b 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1063,31 +1063,31 @@ void driInitTextureObjects( GLcontext *ctx, driTextureObject * swapped, ctx->Texture.CurrentUnit = i; if ( (targets & DRI_TEXMGR_DO_TEXTURE_1D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current1D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_1D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_1D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_2D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current2D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_2D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_2D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_3D) != 0 ) { - texObj = ctx->Texture.Unit[i].Current3D; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_3D_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_3D, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_CUBE) != 0 ) { - texObj = ctx->Texture.Unit[i].CurrentCubeMap; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_CUBE_INDEX]Map; ctx->Driver.BindTexture( ctx, GL_TEXTURE_CUBE_MAP_ARB, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } if ( (targets & DRI_TEXMGR_DO_TEXTURE_RECT) != 0 ) { - texObj = ctx->Texture.Unit[i].CurrentRect; + texObj = ctx->Texture.Unit[i].CurrentTex[TEXTURE_RECT_INDEX]; ctx->Driver.BindTexture( ctx, GL_TEXTURE_RECTANGLE_NV, texObj ); move_to_tail( swapped, (driTextureObject *) texObj->DriverData ); } diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c index 2ffb790f28a..ca33c1740ff 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tex.c +++ b/src/mesa/drivers/dri/gamma/gamma_tex.c @@ -400,19 +400,19 @@ void gammaInitTextureObjects( GLcontext *ctx ) ctx->Texture.CurrentUnit = 0; - texObj = ctx->Texture.Unit[0].Current1D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[0].Current2D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_2D, texObj ); #if 0 ctx->Texture.CurrentUnit = 1; - texObj = ctx->Texture.Unit[1].Current1D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[1].Current2D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX]; gammaBindTexture( ctx, GL_TEXTURE_2D, texObj ); #endif diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index d4c5b6fd97b..ad765d1dd76 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -206,8 +206,8 @@ static void mgaUpdateTextureEnvG200( GLcontext *ctx, GLuint unit ) mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; - if (tObj != ctx->Texture.Unit[0].Current2D && - tObj != ctx->Texture.Unit[0].CurrentRect) + if (tObj != ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX] && + tObj != ctx->Texture.Unit[0].CurrentTex[TEXTURE_RECT_INDEX]) return; @@ -635,8 +635,8 @@ static void mgaUpdateTextureEnvG400( GLcontext *ctx, GLuint unit ) mgaTextureObjectPtr t = (mgaTextureObjectPtr) tObj->DriverData; GLenum format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; - if (tObj != ctx->Texture.Unit[source].Current2D && - tObj != ctx->Texture.Unit[source].CurrentRect) + if (tObj != ctx->Texture.Unit[source].CurrentTex[TEXTURE_2D_INDEX] && + tObj != ctx->Texture.Unit[source].CurrentTex[TEXTURE_RECT_INDEX]) return; switch (ctx->Texture.Unit[source].EnvMode) { diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index c192fecca49..ade45f581ca 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1199,7 +1199,7 @@ r300FetchStateParameter(GLcontext * ctx, case STATE_R300_TEXRECT_FACTOR:{ struct gl_texture_object *t = - ctx->Texture.Unit[state[2]].CurrentRect; + ctx->Texture.Unit[state[2]].CurrentTex[TEXTURE_RECT_INDEX]; if (t && t->Image[0][t->BaseLevel]) { struct gl_texture_image *image = diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c index 8bf2ea98783..db660263638 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ b/src/mesa/drivers/dri/s3v/s3v_tex.c @@ -502,20 +502,20 @@ static void s3vInitTextureObjects( GLcontext *ctx ) #if 1 ctx->Texture.CurrentUnit = 0; - texObj = ctx->Texture.Unit[0].Current1D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[0].Current2D; + texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); #endif #if 0 ctx->Texture.CurrentUnit = 1; - texObj = ctx->Texture.Unit[1].Current1D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - texObj = ctx->Texture.Unit[1].Current2D; + texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX]; s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); #endif diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 2a8c3a4fd36..62d30a69878 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -2461,13 +2461,13 @@ XMesaBindTexImage(XMesaDisplay *dpy, XMesaBuffer drawable, int buffer, #if 0 switch (drawable->TextureTarget) { case GLX_TEXTURE_1D_EXT: - texObj = texUnit->Current1D; + texObj = texUnit->CurrentTex[TEXTURE_1D_INDEX]; break; case GLX_TEXTURE_2D_EXT: - texObj = texUnit->Current2D; + texObj = texUnit->CurrentTex[TEXTURE_2D_INDEX]; break; case GLX_TEXTURE_RECTANGLE_EXT: - texObj = texUnit->CurrentRect; + texObj = texUnit->CurrentTex[TEXTURE_RECT_INDEX]; break; default: return; /* BadMatch error */ |