Add color tiling support to miniglx for radeon
[mesa.git] / src / mesa / drivers / dri / mach64 / mach64_tex.c
index 02d76067aeda526e87db6754d007a4b6935d3845..6459deef7841ce23f4cf8d97667afd26708e5657 100644 (file)
@@ -42,6 +42,8 @@
 #include "enums.h"
 #include "texstore.h"
 #include "texformat.h"
+#include "teximage.h"
+#include "texobj.h"
 #include "imports.h"
 
 
@@ -377,8 +379,8 @@ void mach64EmitTexStateLocked( mach64ContextPtr mmesa,
                               mach64TexObjPtr t0,
                               mach64TexObjPtr t1 )
 {
-   ATISAREAPrivPtr sarea = mmesa->sarea;
-   mach64_context_regs_t *regs = &(mmesa->setup);
+   drm_mach64_sarea_t *sarea = mmesa->sarea;
+   drm_mach64_context_regs_t *regs = &(mmesa->setup);
 
    /* for multitex, both textures must be local or AGP */
    if ( t0 && t1 )
@@ -403,7 +405,7 @@ void mach64EmitTexStateLocked( mach64ContextPtr mmesa,
       mmesa->setup.secondary_tex_off = t1->offset;
    }
 
-   memcpy( &sarea->ContextState.tex_size_pitch, &regs->tex_size_pitch,
+   memcpy( &sarea->context_state.tex_size_pitch, &regs->tex_size_pitch,
           MACH64_NR_TEXTURE_REGS * sizeof(GLuint) );
 }
 
@@ -568,6 +570,9 @@ static void mach64DDDeleteTexture( GLcontext *ctx,
 
       mach64DestroyTexObj( mmesa, t );
       tObj->DriverData = NULL;
+      /* Free mipmap images and the texture object itself */
+      _mesa_delete_texture_object(ctx, tObj);
+
    }
 }
 
@@ -580,26 +585,26 @@ static GLboolean mach64DDIsTextureResident( GLcontext *ctx,
 }
 
 
-void mach64DDInitTextureFuncs( GLcontext *ctx )
+void mach64InitTextureFuncs( struct dd_function_table *functions )
 {
-   ctx->Driver.TexEnv                  = mach64DDTexEnv;
-   ctx->Driver.ChooseTextureFormat     = mach64ChooseTextureFormat;
-   ctx->Driver.TexImage1D              = mach64TexImage1D;
-   ctx->Driver.TexSubImage1D           = mach64TexSubImage1D;
-   ctx->Driver.TexImage2D              = mach64TexImage2D;
-   ctx->Driver.TexSubImage2D           = mach64TexSubImage2D;
-   ctx->Driver.TexImage3D               = _mesa_store_teximage3d;
-   ctx->Driver.TexSubImage3D            = _mesa_store_texsubimage3d;
-   ctx->Driver.CopyTexImage1D           = _swrast_copy_teximage1d;
-   ctx->Driver.CopyTexImage2D           = _swrast_copy_teximage2d;
-   ctx->Driver.CopyTexSubImage1D        = _swrast_copy_texsubimage1d;
-   ctx->Driver.CopyTexSubImage2D        = _swrast_copy_texsubimage2d;
-   ctx->Driver.CopyTexSubImage3D        = _swrast_copy_texsubimage3d;
-   ctx->Driver.TexParameter            = mach64DDTexParameter;
-   ctx->Driver.BindTexture             = mach64DDBindTexture;
-   ctx->Driver.DeleteTexture           = mach64DDDeleteTexture;
-   ctx->Driver.UpdateTexturePalette    = NULL;
-   ctx->Driver.ActiveTexture           = NULL;
-   ctx->Driver.IsTextureResident       = mach64DDIsTextureResident;
-   ctx->Driver.PrioritizeTexture       = NULL;
+   functions->TexEnv                   = mach64DDTexEnv;
+   functions->ChooseTextureFormat      = mach64ChooseTextureFormat;
+   functions->TexImage1D               = mach64TexImage1D;
+   functions->TexSubImage1D            = mach64TexSubImage1D;
+   functions->TexImage2D               = mach64TexImage2D;
+   functions->TexSubImage2D            = mach64TexSubImage2D;
+   functions->TexImage3D               = _mesa_store_teximage3d;
+   functions->TexSubImage3D            = _mesa_store_texsubimage3d;
+   functions->CopyTexImage1D           = _swrast_copy_teximage1d;
+   functions->CopyTexImage2D           = _swrast_copy_teximage2d;
+   functions->CopyTexSubImage1D        = _swrast_copy_texsubimage1d;
+   functions->CopyTexSubImage2D        = _swrast_copy_texsubimage2d;
+   functions->CopyTexSubImage3D        = _swrast_copy_texsubimage3d;
+   functions->TexParameter             = mach64DDTexParameter;
+   functions->BindTexture              = mach64DDBindTexture;
+   functions->DeleteTexture            = mach64DDDeleteTexture;
+   functions->UpdateTexturePalette     = NULL;
+   functions->ActiveTexture            = NULL;
+   functions->IsTextureResident        = mach64DDIsTextureResident;
+   functions->PrioritizeTexture        = NULL;
 }