fix some float/ubyte mistakes (Daniel Borca)
[mesa.git] / src / mesa / drivers / glide / fxtexman.c
index 2e989a04b4105b5c9cc2e9eecc79bc83db33743a..b03122f8c1ba88c04dced11e9a013157feca179d 100644 (file)
@@ -1,9 +1,10 @@
+/* $Id: fxtexman.c,v 1.15 2001/09/23 16:50:01 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
- * Version:  3.3
+ * Version:  4.0
  *
- * Copyright (C) 1999-2000  Brian Paul   All Rights Reserved.
+ * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- *
- *
- * Original Mesa / 3Dfx device driver (C) 1999 David Bucciarelli, by the
- * terms stated above.
- *
- * Thank you for your contribution, David!
- *
- * Please make note of the above copyright/license statement.  If you
- * contributed code or bug fixes to this code under the previous (GNU
- * Library) license and object to the new license, your code will be
- * removed at your request.  Please see the Mesa docs/COPYRIGHT file
- * for more information.
- *
- * Additional Mesa/3Dfx driver developers:
- *   Daryll Strauss <daryll@precisioninsight.com>
- *   Keith Whitwell <keith@precisioninsight.com>
- *
- * See fxapi.h for more revision/author details.
  */
 
+/* Authors:
+ *    David Bucciarelli
+ *    Brian Paul
+ *    Daryll Strauss
+ *    Keith Whitwell
+ */
 
 /* fxtexman.c - 3Dfx VooDoo texture memory functions */
 
@@ -499,6 +488,9 @@ fxTMReloadMipMapLevel(fxMesaContext fxMesa, struct gl_texture_object *tObj,
    tfxMipMapLevel *mml = FX_MIPMAP_DATA(texImage);
 
    assert(mml);
+   assert(mml->width > 0);
+   assert(mml->height > 0);
+   assert(mml->glideFormat > 0);
 
    if (!ti->validated) {
       fprintf(stderr,
@@ -714,13 +706,15 @@ fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj)
 
    for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
       struct gl_texture_image *texImage = tObj->Image[i];
-      if (texImage->Data) {
-        FREE(texImage->Data);
-        texImage->Data = NULL;
-      }
-      if (texImage->DriverData) {
-        FREE(texImage->DriverData);
-        texImage->DriverData = NULL;
+      if (texImage) {
+         if (texImage->Data) {
+            FREE(texImage->Data);
+            texImage->Data = NULL;
+         }
+         if (texImage->DriverData) {
+            FREE(texImage->DriverData);
+            texImage->DriverData = NULL;
+         }
       }
    }
    switch (ti->whichTMU) {