{
driTextureObject * t = (driTextureObject *) texObj->DriverData;
- assert(t);
if ( t != NULL ) {
driSwapOutTextureObject( t );
}
* created with current state before it is used, so we don't have
* to do anything now
*/
- assert(t);
if ( (t == NULL) ||
(target != GL_TEXTURE_2D &&
target != GL_TEXTURE_RECTANGLE_NV) ) {
}
-#if 0
-/* no longer needed */
static void
mgaBindTexture( GLcontext *ctx, GLenum target,
struct gl_texture_object *tObj )
{
- if ( target == GL_TEXTURE_2D ||
- target == GL_TEXTURE_RECTANGLE_NV ) {
- if ( tObj->DriverData == NULL ) {
- mgaAllocTexObj( tObj );
- }
- }
+ assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_NV) ||
+ (tObj->DriverData != NULL) );
}
-#endif
static void
mgaContextPtr mmesa = MGA_CONTEXT( ctx );
driTextureObject * t = (driTextureObject *) tObj->DriverData;
- assert(t);
if ( t ) {
if ( mmesa ) {
FLUSH_BATCH( mmesa );
driDestroyTextureObject( t );
}
+
+ /* Free mipmap images and the texture object itself */
+ _mesa_delete_texture_object(ctx, tObj);
}
* Called via ctx->Driver.NewTextureObject.
* Note: this function will be called during context creation to
* allocate the default texture objects.
- * Fixup MaxAnisotropy according to user preference.
+ * 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 *
mgaNewTextureObject( GLcontext *ctx, GLuint name, GLenum target )
{
- mgaContextPtr rmesa = MGA_CONTEXT(ctx);
struct gl_texture_object *obj;
- driTextureObject *t;
obj = _mesa_new_texture_object(ctx, name, target);
- if (!obj)
- return NULL;
- t = (driTextureObject *) mgaAllocTexObj( obj );
- if (!t) {
- _mesa_delete_texture_object(ctx, obj);
- return NULL;
- }
+ mgaAllocTexObj( obj );
return obj;
}
functions->ChooseTextureFormat = mgaChooseTextureFormat;
functions->TexImage2D = mgaTexImage2D;
functions->TexSubImage2D = mgaTexSubImage2D;
- /*ctx->Driver.BindTexture = mgaBindTexture;*/
+ functions->BindTexture = mgaBindTexture;
functions->NewTextureObject = mgaNewTextureObject;
functions->DeleteTexture = mgaDeleteTexture;
- functions->IsTextureResident = driIsTextureResident;
+ functions->IsTextureResident = driIsTextureResident;
functions->TexEnv = mgaTexEnv;
functions->TexParameter = mgaTexParameter;
}