Convert all uses of CARD32 and CARD8 to int32_t and int8_t.
[mesa.git] / src / mesa / drivers / dri / radeon / radeon_tex.c
index ca6acba16af7c327313fe32c2685c5cc300aeee7..87c26f89780f8262ea0df952594a6bc6be88ff4a 100644 (file)
@@ -401,7 +401,6 @@ static void radeonTexImage1D( GLcontext *ctx, GLenum target, GLint level,
 {
    driTextureObject * t = (driTextureObject *) texObj->DriverData;
 
-   assert(t);
    if ( t ) {
       driSwapOutTextureObject( t );
    }
@@ -464,8 +463,6 @@ static void radeonTexImage2D( GLcontext *ctx, GLenum target, GLint level,
    driTextureObject * t = (driTextureObject *) texObj->DriverData;
    GLuint face;
 
-   assert(t);
-
    /* which cube face or ordinary 2D image */
    switch (target) {
    case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
@@ -626,10 +623,6 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,
               _mesa_lookup_enum_by_nr( pname ) );
    }
 
-   if ( ( target != GL_TEXTURE_2D ) &&
-       ( target != GL_TEXTURE_1D ) )
-      return;
-
    switch ( pname ) {
    case GL_TEXTURE_MIN_FILTER:
    case GL_TEXTURE_MAG_FILTER:
@@ -669,8 +662,6 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target,
 }
 
 
-#if 00
-/* not needed anymore */
 static void radeonBindTexture( GLcontext *ctx, GLenum target,
                               struct gl_texture_object *texObj )
 {
@@ -679,13 +670,11 @@ static void radeonBindTexture( GLcontext *ctx, GLenum target,
               ctx->Texture.CurrentUnit );
    }
 
-   if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) {
-      if ( texObj->DriverData == NULL ) {
-        radeonAllocTexObj( texObj );
-      }
-   }
+   assert( (target != GL_TEXTURE_1D && target != GL_TEXTURE_2D &&
+            target != GL_TEXTURE_RECTANGLE_NV) ||
+           (texObj->DriverData != NULL) );
 }
-#endif
+
 
 static void radeonDeleteTexture( GLcontext *ctx,
                                 struct gl_texture_object *texObj )
@@ -698,7 +687,6 @@ static void radeonDeleteTexture( GLcontext *ctx,
               _mesa_lookup_enum_by_nr( texObj->Target ) );
    }
 
-   assert(t);
    if ( t != NULL ) {
       if ( rmesa ) {
          RADEON_FIREVERTICES( rmesa );
@@ -734,22 +722,19 @@ static void radeonTexGen( GLcontext *ctx,
 /**
  * Allocate a new texture object.
  * Called via ctx->Driver.NewTextureObject.
+ * Note: we could use containment here to 'derive' the driver-specific
+ * texture object from the core mesa gl_texture_object.  Not done at this time.
  */
 static struct gl_texture_object *
 radeonNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
 {
    radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
    struct gl_texture_object *obj;
-   driTextureObject *t;
    obj = _mesa_new_texture_object(ctx, name, target);
    if (!obj)
       return NULL;
    obj->MaxAnisotropy = rmesa->initialMaxAnisotropy;
-   t = (driTextureObject *) radeonAllocTexObj(obj);
-   if (!t) {
-      _mesa_delete_texture_object(ctx, obj);
-      return NULL;
-   }
+   radeonAllocTexObj( obj );
    return obj;
 }
 
@@ -763,7 +748,7 @@ void radeonInitTextureFuncs( struct dd_function_table *functions )
    functions->TexSubImage2D            = radeonTexSubImage2D;
 
    functions->NewTextureObject         = radeonNewTextureObject;
-   /*functions->BindTexture            = radeonBindTexture;*/
+   functions->BindTexture              = radeonBindTexture;
    functions->DeleteTexture            = radeonDeleteTexture;
    functions->IsTextureResident                = driIsTextureResident;